The patch titled Subject: mm: Fix madvise WILLNEED performance problem has been added to the -mm tree. Its filename is mm-fix-madvise-willneed-performance-problem.patch This patch should soon appear at https://ozlabs.org/~akpm/mmots/broken-out/mm-fix-madvise-willneed-performance-problem.patch and later at https://ozlabs.org/~akpm/mmotm/broken-out/mm-fix-madvise-willneed-performance-problem.patch Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/process/submit-checklist.rst when testing your code *** The -mm tree is included into linux-next and is updated there every 3-4 working days ------------------------------------------------------ From: "Matthew Wilcox (Oracle)" <willy@xxxxxxxxxxxxx> Subject: mm: Fix madvise WILLNEED performance problem The calculation of the end page index was incorrect, leading to a regression of 70% when running stress-ng. With this fix, we instead see a performance improvement of 3%. Link: https://lkml.kernel.org/r/20201109134851.29692-1-willy@xxxxxxxxxxxxx Fixes: e6e88712e43b ("mm: optimise madvise WILLNEED") Signed-off-by: Matthew Wilcox (Oracle) <willy@xxxxxxxxxxxxx> Reported-by: kernel test robot <rong.a.chen@xxxxxxxxx> Tested-by: Xing Zhengjun <zhengjun.xing@xxxxxxxxxxxxxxx> Acked-by: Johannes Weiner <hannes@xxxxxxxxxxx> Cc: William Kucharski <william.kucharski@xxxxxxxxxx> Cc: Feng Tang <feng.tang@xxxxxxxxx> Cc: "Chen, Rong A" <rong.a.chen@xxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- mm/madvise.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/mm/madvise.c~mm-fix-madvise-willneed-performance-problem +++ a/mm/madvise.c @@ -226,7 +226,7 @@ static void force_shm_swapin_readahead(s struct address_space *mapping) { XA_STATE(xas, &mapping->i_pages, linear_page_index(vma, start)); - pgoff_t end_index = end / PAGE_SIZE; + pgoff_t end_index = linear_page_index(vma, end + PAGE_SIZE - 1); struct page *page; rcu_read_lock(); _ Patches currently in -mm which might be from willy@xxxxxxxxxxxxx are mm-fix-readahead_page_batch-for-retry-entries.patch mm-fix-madvise-willneed-performance-problem.patch