linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Hugh Dickins <hughd@google.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: Johannes Weiner <hannes@cmpxchg.org>,
	KOSAKI Motohiro <kosaki.motohiro@gmail.com>,
	linux-mm@kvack.org
Subject: [PATCH 4/6] mm: remove del_page_from_lru, add page_off_lru
Date: Sat, 31 Dec 2011 23:45:19 -0800 (PST)	[thread overview]
Message-ID: <alpine.LSU.2.00.1112312343570.18500@eggly.anvils> (raw)
In-Reply-To: <alpine.LSU.2.00.1112312333380.18500@eggly.anvils>

del_page_from_lru() repeats del_page_from_lru_list(), also working out
which LRU the page was on, clearing the relevant bits.  Decouple those
functions: remove del_page_from_lru() and add page_off_lru().

Signed-off-by: Hugh Dickins <hughd@google.com>
---
 include/linux/mm_inline.h |   15 +++++++++------
 mm/swap.c                 |    4 ++--
 2 files changed, 11 insertions(+), 8 deletions(-)

--- mmotm.orig/include/linux/mm_inline.h	2011-12-31 14:49:11.044022084 -0800
+++ mmotm/include/linux/mm_inline.h	2011-12-31 14:55:00.860030864 -0800
@@ -54,8 +54,14 @@ static inline enum lru_list page_lru_bas
 	return LRU_INACTIVE_ANON;
 }
 
-static inline void
-del_page_from_lru(struct zone *zone, struct page *page)
+/**
+ * page_off_lru - which LRU list was page on? clearing its lru flags.
+ * @page: the page to test
+ *
+ * Returns the LRU list a page was on, as an index into the array of LRU
+ * lists; and clears its Unevictable or Active flags, ready for freeing.
+ */
+static inline enum lru_list page_off_lru(struct page *page)
 {
 	enum lru_list lru;
 
@@ -69,9 +75,7 @@ del_page_from_lru(struct zone *zone, str
 			lru += LRU_ACTIVE;
 		}
 	}
-	mem_cgroup_lru_del_list(page, lru);
-	list_del(&page->lru);
-	__mod_zone_page_state(zone, NR_LRU_BASE + lru, -hpage_nr_pages(page));
+	return lru;
 }
 
 /**
@@ -92,7 +96,6 @@ static inline enum lru_list page_lru(str
 		if (PageActive(page))
 			lru += LRU_ACTIVE;
 	}
-
 	return lru;
 }
 
--- mmotm.orig/mm/swap.c	2011-12-30 21:29:54.415350465 -0800
+++ mmotm/mm/swap.c	2011-12-31 14:55:00.860030864 -0800
@@ -53,7 +53,7 @@ static void __page_cache_release(struct
 		spin_lock_irqsave(&zone->lru_lock, flags);
 		VM_BUG_ON(!PageLRU(page));
 		__ClearPageLRU(page);
-		del_page_from_lru(zone, page);
+		del_page_from_lru_list(zone, page, page_off_lru(page));
 		spin_unlock_irqrestore(&zone->lru_lock, flags);
 	}
 }
@@ -617,7 +617,7 @@ void release_pages(struct page **pages,
 			}
 			VM_BUG_ON(!PageLRU(page));
 			__ClearPageLRU(page);
-			del_page_from_lru(zone, page);
+			del_page_from_lru_list(zone, page, page_off_lru(page));
 		}
 
 		list_add(&page->lru, &pages_to_free);

--
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/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

  parent reply	other threads:[~2012-01-01  7:45 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-01-01  7:39 [PATCH 0/6] mm: trivial cleanups Hugh Dickins
2012-01-01  7:41 ` [PATCH 1/6] mm: fewer underscores in ____pagevec_lru_add Hugh Dickins
2012-01-01  8:17   ` KOSAKI Motohiro
2012-01-01  7:42 ` [PATCH 2/6] mm: no blank line after EXPORT_SYMBOL in swap.c Hugh Dickins
2012-01-01  8:18   ` KOSAKI Motohiro
2012-01-01  7:43 ` [PATCH 3/6] mm: enum lru_list lru Hugh Dickins
2012-01-01  8:19   ` KOSAKI Motohiro
2012-01-01  7:45 ` Hugh Dickins [this message]
2012-01-01  8:22   ` [PATCH 4/6] mm: remove del_page_from_lru, add page_off_lru KOSAKI Motohiro
2012-01-01  7:46 ` [PATCH 5/6] mm: remove isolate_pages Hugh Dickins
2012-01-01  9:36   ` KOSAKI Motohiro
2012-01-01  7:48 ` [PATCH 6/6] mm: rearrange putback_inactive_pages Hugh Dickins

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=alpine.LSU.2.00.1112312343570.18500@eggly.anvils \
    --to=hughd@google.com \
    --cc=akpm@linux-foundation.org \
    --cc=hannes@cmpxchg.org \
    --cc=kosaki.motohiro@gmail.com \
    --cc=linux-mm@kvack.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox