Files
linux-nv-oot/drivers/video/tegra/nvmap/nvmap_dmabuf.h
Ketan Patil f650780b9f video: tegra: nvmap: Avoid double updation of RSS counter
The RSS counter is updated during buffer allocation as well as mmap,
which is leading to double updation. Fix this by decrementing the RSS
counter during page fault while increment it back during unmap flow.

Bug 5222690

Change-Id: I77972185f20d9d710571cc07ae1c5188060bfa1f
Signed-off-by: Ketan Patil <ketanp@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3447073
(cherry picked from commit 5ef68aa58f)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3458548
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
Tested-by: Amulya Yarlagadda <ayarlagadda@nvidia.com>
Reviewed-by: Amulya Yarlagadda <ayarlagadda@nvidia.com>
2025-09-25 14:36:08 -07:00

69 lines
1.7 KiB
C

/* SPDX-License-Identifier: GPL-2.0-only */
/* SPDX-FileCopyrightText: Copyright (c) 2024-2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. */
#ifndef __NVMAP_DMABUF_H
#define __NVMAP_DMABUF_H
#define __DMA_ATTR(attrs) attrs
#define DEFINE_DMA_ATTRS(attrs) unsigned long attrs = 0
/**
* dma_set_attr - set a specific attribute
* @attr: attribute to set
* @attrs: struct dma_attrs (may be NULL)
*/
#define dma_set_attr(attr, attrs) (attrs |= attr)
/**
* dma_get_attr - check for a specific attribute
* @attr: attribute to set
* @attrs: struct dma_attrs (may be NULL)
*/
#define dma_get_attr(attr, attrs) (attrs & attr)
int nvmap_dmabuf_stash_init(void);
void nvmap_dmabuf_stash_deinit(void);
bool dmabuf_is_nvmap(struct dma_buf *dmabuf);
struct dma_buf *__nvmap_make_dmabuf(struct nvmap_client *client,
struct nvmap_handle *handle,
bool ro_buf);
int nvmap_get_dmabuf_fd(struct nvmap_client *client,
struct nvmap_handle *h,
bool is_ro);
struct nvmap_handle *nvmap_handle_get_from_dmabuf_fd(
struct nvmap_client *client,
int fd);
int is_nvmap_dmabuf_fd_ro(int fd, bool *is_ro);
int nvmap_dmabuf_duplicate_gen_fd(struct nvmap_client *client,
struct dma_buf *dmabuf);
struct nvmap_vma_list {
struct list_head list;
struct vm_area_struct *vma;
unsigned long save_vm_flags;
pid_t pid;
atomic_t ref;
};
struct nvmap_vma_priv {
struct nvmap_handle *handle;
size_t offs;
atomic_t count; /* number of processes cloning the VMA */
u64 map_rss_count;
struct mm_struct *mm;
struct mutex vma_lock;
};
int is_nvmap_vma(struct vm_area_struct *vma);
void nvmap_vma_open(struct vm_area_struct *vma);
extern struct vm_operations_struct nvmap_vma_ops;
#endif /* __NVMAP_DMABUF_H */