mm: Fix madvise WILLNEED performance problem
Subsystems (2)
PATCH 1/1 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%.
Reported-by kernel test robot <[email protected]>
Tested-by Xing Zhengjun <[email protected]>
Fixes e6e88712e43b ("mm: optimise madvise WILLNEED")
Signed-off-by Matthew Wilcox (Oracle) <[email protected]>
--- mm/madvise.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
mm/madvise.c +1 -1
@@ -225,7 +225,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 ();
Signature · 1 line
2.28.0
Quoted 8 lines · Matthew Wilcox (Oracle)
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%.
Reported-by kernel test robot <[email protected]>Tested-by Xing Zhengjun <[email protected]>Fixes e6e88712e43b ("mm: optimise madvise WILLNEED")Signed-off-by Matthew Wilcox (Oracle) <[email protected]>
Acked-by Johannes Weiner <[email protected]>