linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [RFC][PATCH] shrink_page_list: save page_mapped() to local val
@ 2010-03-24 12:11 Bob Liu
  2010-03-24 13:26 ` Johannes Weiner
  0 siblings, 1 reply; 2+ messages in thread
From: Bob Liu @ 2010-03-24 12:11 UTC (permalink / raw)
  To: akpm; +Cc: linux-mm, kosaki.motohiro, riel, Bob Liu

In funtion shrink_page_list(), page_mapped() is called several
times,save it to local val to reduce atomic_read.

Signed-off-by: Bob Liu <lliubbo@gmail.com>
---
 mm/vmscan.c |    8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/mm/vmscan.c b/mm/vmscan.c
index 79c8098..08cc3ac 100644
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -637,6 +637,7 @@ static unsigned long shrink_page_list(struct list_head *page_list,
 		struct address_space *mapping;
 		struct page *page;
 		int may_enter_fs;
+		int page_mapcount;
 
 		cond_resched();
 
@@ -653,11 +654,12 @@ static unsigned long shrink_page_list(struct list_head *page_list,
 		if (unlikely(!page_evictable(page, NULL)))
 			goto cull_mlocked;
 
-		if (!sc->may_unmap && page_mapped(page))
+		page_mapcount = page_mapped(page);
+		if (!sc->may_unmap && page_mapcount)
 			goto keep_locked;
 
 		/* Double the slab pressure for mapped and swapcache pages */
-		if (page_mapped(page) || PageSwapCache(page))
+		if (page_mapcount || PageSwapCache(page))
 			sc->nr_scanned++;
 
 		may_enter_fs = (sc->gfp_mask & __GFP_FS) ||
@@ -707,7 +709,7 @@ static unsigned long shrink_page_list(struct list_head *page_list,
 		 * The page is mapped into the page tables of one or more
 		 * processes. Try to unmap it here.
 		 */
-		if (page_mapped(page) && mapping) {
+		if (page_mapcount && mapping) {
 			switch (try_to_unmap(page, TTU_UNMAP)) {
 			case SWAP_FAIL:
 				goto activate_locked;
-- 
1.5.6.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	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2010-03-24 13:26 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-03-24 12:11 [RFC][PATCH] shrink_page_list: save page_mapped() to local val Bob Liu
2010-03-24 13:26 ` Johannes Weiner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox