Re: [PATCH 1/4] mm: introduce vma_set_file function v2

From: Matthew Wilcox
Date: Thu Oct 08 2020 - 07:39:45 EST


On Thu, Oct 08, 2020 at 01:23:39PM +0200, Christian König wrote:
> drivers/dma-buf/dma-buf.c | 16 +++++-----------
> drivers/gpu/drm/etnaviv/etnaviv_gem.c | 4 +---
> drivers/gpu/drm/i915/gem/i915_gem_dmabuf.c | 3 +--
> drivers/gpu/drm/i915/gem/i915_gem_mman.c | 4 ++--
> drivers/gpu/drm/msm/msm_gem.c | 4 +---
> drivers/gpu/drm/omapdrm/omap_gem.c | 3 +--
> drivers/gpu/drm/vgem/vgem_drv.c | 3 +--
> drivers/staging/android/ashmem.c | 5 ++---
...
> +++ b/mm/mmap.c
> @@ -136,6 +136,22 @@ void vma_set_page_prot(struct vm_area_struct *vma)
> WRITE_ONCE(vma->vm_page_prot, vm_page_prot);
> }
>
> +/*
> + * Change backing file, only valid to use during initial VMA setup.
> + */
> +struct file *vma_set_file(struct vm_area_struct *vma, struct file *file)
> +{
> + if (file)
> + get_file(file);
> +
> + swap(vma->vm_file, file);
> +
> + if (file)
> + fput(file);
> +
> + return file;
> +}
> +

These users are all potentially modules. You need an EXPORT_SYMBOL()?