]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
mm: Change mmap do_brk_flags() to populate the existing VMA
authorLiam R. Howlett <Liam.Howlett@Oracle.com>
Mon, 21 Sep 2020 16:22:15 +0000 (12:22 -0400)
committerLiam R. Howlett <Liam.Howlett@Oracle.com>
Fri, 30 Oct 2020 19:12:03 +0000 (15:12 -0400)
do_brk_flags has already located the modified VMA, so just populate the
region.  Add mm_populate_vma() to mm/gup.c and call the new function
which ignores errors.

Benckmarks in KVM before:
$ ./mmtests/work/sources/wis-0-installed/brk1_threads
testcase:brk increase/decrease of one page
warmup
min:886150 max:886150 total:886150
min:901488 max:901488 total:901488
min:897594 max:897594 total:897594
min:897422 max:897422 total:897422
min:900700 max:900700 total:900700
min:900714 max:900714 total:900714
measurement
min:903016 max:903016 total:903016
min:901224 max:901224 total:901224
min:902626 max:902626 total:902626
min:900518 max:900518 total:900518

Benchmark in KVM after change:
/mmtests/work/sources/wis-0-installed/brk1_threads
testcase:brk increase/decrease of one page
warmup
min:895650 max:895650 total:895650
min:904936 max:904936 total:904936
min:904776 max:904776 total:904776
min:905358 max:905358 total:905358
min:908792 max:908792 total:908792
min:907648 max:907648 total:907648
measurement
min:904368 max:904368 total:904368
min:903936 max:903936 total:903936
min:904720 max:904720 total:904720
min:906626 max:906626 total:906626

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
mm/gup.c
mm/mmap.c

index 102877ed77a4b42af7e0a625cfc4b79791494f95..522f8fd491ead4cba4d68f26a0ad9ab174c44c63 100644 (file)
--- 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.
  *
index cffa49eaf2b83e2e20fb4d2c25e3faae96cef7d0..3e8426baba8b105bcd1e821ca3727b99023f3b15 100644 (file)
--- a/mm/mmap.c
+++ b/mm/mmap.c
@@ -277,7 +277,7 @@ success:
                mmap_write_unlock(mm);
        userfaultfd_unmap_complete(mm, &uf);
        if (populate)
-               mm_populate(oldbrk, newbrk - oldbrk);
+               mm_populate_vma(vma_brk, oldbrk, newbrk);
        return brk;
 
 out: