Skip to content

Commit

Permalink
mm: fix madvise WILLNEED performance problem
Browse files Browse the repository at this point in the history
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%.

Fixes: e6e8871 ("mm: optimise madvise WILLNEED")
Reported-by: kernel test robot <[email protected]>
Signed-off-by: Matthew Wilcox (Oracle) <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Tested-by: Xing Zhengjun <[email protected]>
Acked-by: Johannes Weiner <[email protected]>
Cc: William Kucharski <[email protected]>
Cc: Feng Tang <[email protected]>
Cc: "Chen, Rong A" <[email protected]>
Link: https://lkml.kernel.org/r/[email protected]
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
Matthew Wilcox (Oracle) authored and torvalds committed Nov 22, 2020
1 parent 488dac0 commit 6638380
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion mm/madvise.c
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ static void force_shm_swapin_readahead(struct vm_area_struct *vma,
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();
Expand Down

0 comments on commit 6638380

Please sign in to comment.