Message ID | 20230906061902.591996-1-eadavis@sina.com (mailing list archive) |
---|---|
State | New |
Headers | show |
Series | mm: as the same logic with queue_pages_range | expand |
On Wed, Sep 06, 2023 at 02:19:02PM +0800, Edward AD wrote: > Only dealwith queue_pages_range locked vmas. What? > Signed-off-by: Edward AD <eadavis@sina.com> > --- > mm/mempolicy.c | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/mm/mempolicy.c b/mm/mempolicy.c > index 42b5567e3773..13050b968479 100644 > --- a/mm/mempolicy.c > +++ b/mm/mempolicy.c > @@ -1342,6 +1342,8 @@ static long do_mbind(unsigned long start, unsigned long len, > vma_iter_init(&vmi, mm, start); > prev = vma_prev(&vmi); > for_each_vma_range(vmi, vma, end) { > + if (!vma || start < vma->vm_start) > + continue; #define for_each_vma_range(__vmi, __vma, __end) \ while (((__vma) = vma_find(&(__vmi), (__end))) != NULL) How can this produce a vma that is either NULL or has a vm_start after start?
Hello, kernel test robot noticed "ltp.vma02.fail" on: commit: 8dfdaf99160833af1a0a4ffef60c94627c77025b ("[PATCH] mm: as the same logic with queue_pages_range") url: https://github.com/intel-lab-lkp/linux/commits/Edward-AD/mm-as-the-same-logic-with-queue_pages_range/20230906-142110 base: https://git.kernel.org/cgit/linux/kernel/git/akpm/mm.git mm-everything patch link: https://lore.kernel.org/all/20230906061902.591996-1-eadavis@sina.com/ patch subject: [PATCH] mm: as the same logic with queue_pages_range in testcase: ltp version: ltp-x86_64-14c1f76-1_20230715 with following parameters: disk: 1HDD test: mm-00/vma02 compiler: gcc-12 test machine: 8 threads 1 sockets Intel(R) Core(TM) i7-7700 CPU @ 3.60GHz (Kaby Lake) with 32G memory (please refer to attached dmesg/kmsg for entire log/backtrace) If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags | Reported-by: kernel test robot <oliver.sang@intel.com> | Closes: https://lore.kernel.org/oe-lkp/202309121302.8864096c-oliver.sang@intel.com Running tests....... <<<test_start>>> tag=vma02 stime=1694438526 cmdline="vma02" contacts="" analysis=exit <<<test_output>>> vma02 0 TINFO : pid = 3639 addr = 0x7f5202dd6000 vma02 0 TINFO : start = 0x7f5202dd6000, end = 0x7f5202dd7000 vma02 0 TINFO : start = 0x7f5202dd7000, end = 0x7f5202dd8000 vma02 0 TINFO : start = 0x7f5202dd8000, end = 0x7f5202dd9000 vma02 1 TFAIL : vma02.c:144: >1 unmerged VMAs. incrementing stop <<<execution_status>>> initiation_status="ok" duration=0 termination_type=exited termination_id=1 corefile=no cutime=0 cstime=7 <<<test_end>>> INFO: ltp-pan reported some tests FAIL LTP Version: 20230516-75-g2e582e743 ############################################################### Done executing testcases. LTP Version: 20230516-75-g2e582e743 ############################################################### The kernel config and materials to reproduce are available at: https://download.01.org/0day-ci/archive/20230912/202309121302.8864096c-oliver.sang@intel.com
Hi! > Running tests....... > <<<test_start>>> > tag=vma02 stime=1694438526 > cmdline="vma02" > contacts="" > analysis=exit > <<<test_output>>> > vma02 0 TINFO : pid = 3639 addr = 0x7f5202dd6000 > vma02 0 TINFO : start = 0x7f5202dd6000, end = 0x7f5202dd7000 > vma02 0 TINFO : start = 0x7f5202dd7000, end = 0x7f5202dd8000 > vma02 0 TINFO : start = 0x7f5202dd8000, end = 0x7f5202dd9000 > vma02 1 TFAIL : vma02.c:144: >1 unmerged VMAs. > incrementing stop So the test is reproducer for: commit 9d8cebd4bcd7c3878462fdfda34bbcdeb4df7ef4 Author: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com> Date: Fri Mar 5 13:41:57 2010 -0800 mm: fix mbind vma merge problem Strangely, current mbind() doesn't merge vma with neighbor vma although it's possible. Unfortunately, many vma can reduce performance... And what the test does is: - map 3 continous pages - popluate - mbind() first page - mbind() all three pages - checks that there is only single VMA for the pages after second mbind()
diff --git a/mm/mempolicy.c b/mm/mempolicy.c index 42b5567e3773..13050b968479 100644 --- a/mm/mempolicy.c +++ b/mm/mempolicy.c @@ -1342,6 +1342,8 @@ static long do_mbind(unsigned long start, unsigned long len, vma_iter_init(&vmi, mm, start); prev = vma_prev(&vmi); for_each_vma_range(vmi, vma, end) { + if (!vma || start < vma->vm_start) + continue; err = mbind_range(&vmi, vma, &prev, start, end, new); if (err) break;
Only dealwith queue_pages_range locked vmas. Signed-off-by: Edward AD <eadavis@sina.com> --- mm/mempolicy.c | 2 ++ 1 file changed, 2 insertions(+)