diff mbox series

[13/28] mm/gup: Expose mm_populate_vma() for use when the vma is known

Message ID 20201210170402.3468568-14-Liam.Howlett@Oracle.com (mailing list archive)
State New, archived
Headers show
Series RFC mm: Introducing the Maple Tree | expand

Commit Message

Liam R. Howlett Dec. 10, 2020, 5:03 p.m. UTC
When a vma is known, avoid calling mm_populate to search for the vma to
populate.

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
---
 include/linux/mm.h |  4 ++++
 mm/gup.c           | 20 ++++++++++++++++++++
 2 files changed, 24 insertions(+)

Comments

kernel test robot Dec. 10, 2020, 9:03 p.m. UTC | #1
Hi "Liam,

I love your patch! Perhaps something to improve:

[auto build test WARNING on efi/next]
[cannot apply to tip/x86/core linus/master hnaz-linux-mm/master v5.10-rc7 next-20201210]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Liam-R-Howlett/RFC-mm-Introducing-the-Maple-Tree/20201211-011029
base:   https://git.kernel.org/pub/scm/linux/kernel/git/efi/efi.git next
config: sh-allmodconfig (attached as .config)
compiler: sh4-linux-gcc (GCC) 9.3.0
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # https://github.com/0day-ci/linux/commit/e89ae5d0c814effeca4f7907d7dad47134561db2
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Liam-R-Howlett/RFC-mm-Introducing-the-Maple-Tree/20201211-011029
        git checkout e89ae5d0c814effeca4f7907d7dad47134561db2
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=sh 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All warnings (new ones prefixed by >>):

   In file included from include/linux/mm_types.h:11,
                    from include/linux/mmzone.h:21,
                    from include/linux/gfp.h:6,
                    from include/linux/mm.h:10,
                    from arch/sh/kernel/asm-offsets.c:14:
   include/linux/maple_tree.h:79:22: error: 'MAPLE_RANGE64_SLOTS' undeclared here (not in a function)
      79 |  unsigned long pivot[MAPLE_RANGE64_SLOTS - 1];
         |                      ^~~~~~~~~~~~~~~~~~~
   include/linux/maple_tree.h:85:22: error: 'MAPLE_ARANGE64_SLOTS' undeclared here (not in a function)
      85 |  unsigned long pivot[MAPLE_ARANGE64_SLOTS - 1];
         |                      ^~~~~~~~~~~~~~~~~~~~
   include/linux/maple_tree.h:91:28: error: 'MAPLE_NODE_SLOTS' undeclared here (not in a function); did you mean 'MAPLE_ALLOC_SLOTS'?
      91 | #define MAPLE_ALLOC_SLOTS (MAPLE_NODE_SLOTS - 1)
         |                            ^~~~~~~~~~~~~~~~
   include/linux/maple_tree.h:96:27: note: in expansion of macro 'MAPLE_ALLOC_SLOTS'
      96 |  struct maple_alloc *slot[MAPLE_ALLOC_SLOTS];
         |                           ^~~~~~~~~~~~~~~~~
   In file included from arch/sh/kernel/asm-offsets.c:14:
>> include/linux/mm.h:2594:6: warning: no previous prototype for 'mm_populate_vma' [-Wmissing-prototypes]
    2594 | void mm_populate_vma(struct vm_area_struct *vma, unsigned long start,
         |      ^~~~~~~~~~~~~~~
   make[2]: *** [scripts/Makefile.build:117: arch/sh/kernel/asm-offsets.s] Error 1
   make[2]: Target '__build' not remade because of errors.
   make[1]: *** [Makefile:1200: prepare0] Error 2
   make[1]: Target 'modules_prepare' not remade because of errors.
   make: *** [Makefile:185: __sub-make] Error 2
   make: Target 'modules_prepare' not remade because of errors.

vim +/mm_populate_vma +2594 include/linux/mm.h

  2581	
  2582	#ifdef CONFIG_MMU
  2583	extern int __mm_populate(unsigned long addr, unsigned long len,
  2584				 int ignore_errors);
  2585	static inline void mm_populate(unsigned long addr, unsigned long len)
  2586	{
  2587		/* Ignore errors */
  2588		(void) __mm_populate(addr, len, 1);
  2589	}
  2590	extern void mm_populate_vma(struct vm_area_struct *vma, unsigned long start,
  2591				    unsigned long end);
  2592	#else
  2593	static inline void mm_populate(unsigned long addr, unsigned long len) {}
> 2594	void mm_populate_vma(struct vm_area_struct *vma, unsigned long start,
  2595			     unsigned long end) {}
  2596	#endif
  2597	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
diff mbox series

Patch

diff --git a/include/linux/mm.h b/include/linux/mm.h
index 1bfa2ee41187d..6cc8825f26414 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -2587,8 +2587,12 @@  static inline void mm_populate(unsigned long addr, unsigned long len)
 	/* Ignore errors */
 	(void) __mm_populate(addr, len, 1);
 }
+extern void mm_populate_vma(struct vm_area_struct *vma, unsigned long start,
+			    unsigned long end);
 #else
 static inline void mm_populate(unsigned long addr, unsigned long len) {}
+void mm_populate_vma(struct vm_area_struct *vma, unsigned long start,
+		     unsigned long end) {}
 #endif
 
 /* These take the mm semaphore themselves */
diff --git a/mm/gup.c b/mm/gup.c
index 102877ed77a4b..522f8fd491ead 100644
--- a/mm/gup.c
+++ b/mm/gup.c
@@ -1431,6 +1431,26 @@  long populate_vma_page_range(struct vm_area_struct *vma,
 				NULL, NULL, locked);
 }
 
+/*
+ * mm_populate_vma() - Populate a single range in a single vma.
+ * @vma: The vma to populate.
+ * @start: The start address to populate
+ * @end: The end address to stop populating
+ *
+ * Note: Ignores errors.
+ */
+void mm_populate_vma(struct vm_area_struct *vma, unsigned long start,
+		unsigned long end)
+{
+	struct mm_struct *mm = current->mm;
+	int locked = 1;
+
+	mmap_read_lock(mm);
+	populate_vma_page_range(vma, start, end, &locked);
+	if (locked)
+		mmap_read_unlock(mm);
+}
+
 /*
  * __mm_populate - populate and/or mlock pages within a range of address space.
  *