All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] mm: Fix madvise WILLNEED performance problem
@ 2020-11-09 13:48 Matthew Wilcox (Oracle)
  2020-11-09 16:03 ` Johannes Weiner
  0 siblings, 1 reply; 2+ messages in thread
From: Matthew Wilcox (Oracle) @ 2020-11-09 13:48 UTC (permalink / raw)
  To: linux-mm, akpm
  Cc: Matthew Wilcox (Oracle),
	william.kucharski, feng.tang, zhengjun.xing, rong.a.chen,
	Xing Zhengjun

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 <rong.a.chen@intel.com>
Tested-by: Xing Zhengjun <zhengjun.xing@linux.intel.com>
Fixes: e6e88712e43b ("mm: optimise madvise WILLNEED")
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
---
 mm/madvise.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mm/madvise.c b/mm/madvise.c
index 9b065d412e5f..e602333f8c0d 100644
--- a/mm/madvise.c
+++ b/mm/madvise.c
@@ -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();
-- 
2.28.0



^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] mm: Fix madvise WILLNEED performance problem
  2020-11-09 13:48 [PATCH] mm: Fix madvise WILLNEED performance problem Matthew Wilcox (Oracle)
@ 2020-11-09 16:03 ` Johannes Weiner
  0 siblings, 0 replies; 2+ messages in thread
From: Johannes Weiner @ 2020-11-09 16:03 UTC (permalink / raw)
  To: Matthew Wilcox (Oracle)
  Cc: linux-mm, akpm, william.kucharski, feng.tang, zhengjun.xing,
	rong.a.chen, Xing Zhengjun

On Mon, Nov 09, 2020 at 01:48:51PM +0000, Matthew Wilcox (Oracle) wrote:
> 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 <rong.a.chen@intel.com>
> Tested-by: Xing Zhengjun <zhengjun.xing@linux.intel.com>
> Fixes: e6e88712e43b ("mm: optimise madvise WILLNEED")
> Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>

Acked-by: Johannes Weiner <hannes@cmpxchg.org>


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-11-09 16:05 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-09 13:48 [PATCH] mm: Fix madvise WILLNEED performance problem Matthew Wilcox (Oracle)
2020-11-09 16:03 ` Johannes Weiner

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.