linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mm/madvise: fix WILLNEED on SHM/ANON to actually do something
@ 2014-05-23 12:12 David Herrmann
  2014-05-23 20:55 ` David Rientjes
  0 siblings, 1 reply; 3+ messages in thread
From: David Herrmann @ 2014-05-23 12:12 UTC (permalink / raw)
  To: linux-kernel
  Cc: Andrew Morton, Wanpeng Li, Naoya Horiguchi, David Rientjes,
	Vladimir Cernov, linux-mm, David Herrmann

Currently, madvise(MADV_WILLNEED) on shmem with swap enabled is a no-op.
Problem is, we use find_get_page() to lookup shmem pages in the given
range. However, what we're actually interested in is swapped-out pages.
Therefore, our current code is a no-op:
    page = find_get_page(mapping, index);
    if (!radix_tree_exceptional_entry(page))
        bail-out;

find_get_page() never returns exceptional entries. Fix this by using
find_get_entry(). This was probably meant to be used right from the
beginning.

Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
---
 mm/madvise.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mm/madvise.c b/mm/madvise.c
index 539eeb9..a402f8f 100644
--- a/mm/madvise.c
+++ b/mm/madvise.c
@@ -195,7 +195,7 @@ static void force_shm_swapin_readahead(struct vm_area_struct *vma,
 	for (; start < end; start += PAGE_SIZE) {
 		index = ((start - vma->vm_start) >> PAGE_SHIFT) + vma->vm_pgoff;
 
-		page = find_get_page(mapping, index);
+		page = find_get_entry(mapping, index);
 		if (!radix_tree_exceptional_entry(page)) {
 			if (page)
 				page_cache_release(page);
-- 
1.9.3

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

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

end of thread, other threads:[~2014-05-23 21:49 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-05-23 12:12 [PATCH] mm/madvise: fix WILLNEED on SHM/ANON to actually do something David Herrmann
2014-05-23 20:55 ` David Rientjes
2014-05-23 21:49   ` David Herrmann

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).