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: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>,
	Johannes Weiner <hannes@cmpxchg.org>,
	Michal Hocko <mhocko@suse.cz>,
	Balbir Singh <bsingharora@gmail.com>,
	KOSAKI Motohiro <kosaki.motohiro@gmail.com>,
	linux-mm@kvack.org
Subject: [PATCH 3/5] memcg: lru_size instead of MEM_CGROUP_ZSTAT
Date: Sat, 31 Dec 2011 23:30:38 -0800 (PST)	[thread overview]
Message-ID: <alpine.LSU.2.00.1112312329240.18500@eggly.anvils> (raw)
In-Reply-To: <alpine.LSU.2.00.1112312322200.18500@eggly.anvils>

I never understood why we need a MEM_CGROUP_ZSTAT(mz, idx) macro
to obscure the LRU counts.  For easier searching?  So call it
lru_size rather than bare count (lru_length sounds better, but
would be wrong, since each huge page raises lru_size hugely).

Signed-off-by: Hugh Dickins <hughd@google.com>
---
 mm/memcontrol.c |   14 ++++++--------
 1 file changed, 6 insertions(+), 8 deletions(-)

--- mmotm.orig/mm/memcontrol.c	2011-12-30 21:22:05.679339324 -0800
+++ mmotm/mm/memcontrol.c	2011-12-30 21:23:28.243341326 -0800
@@ -135,7 +135,7 @@ struct mem_cgroup_reclaim_iter {
  */
 struct mem_cgroup_per_zone {
 	struct lruvec		lruvec;
-	unsigned long		count[NR_LRU_LISTS];
+	unsigned long		lru_size[NR_LRU_LISTS];
 
 	struct mem_cgroup_reclaim_iter reclaim_iter[DEF_PRIORITY + 1];
 
@@ -147,8 +147,6 @@ struct mem_cgroup_per_zone {
 	struct mem_cgroup	*memcg;		/* Back pointer, we cannot */
 						/* use container_of	   */
 };
-/* Macro for accessing counter */
-#define MEM_CGROUP_ZSTAT(mz, idx)	((mz)->count[(idx)])
 
 struct mem_cgroup_per_node {
 	struct mem_cgroup_per_zone zoneinfo[MAX_NR_ZONES];
@@ -713,7 +711,7 @@ mem_cgroup_zone_nr_lru_pages(struct mem_
 
 	for_each_lru(l) {
 		if (BIT(l) & lru_mask)
-			ret += MEM_CGROUP_ZSTAT(mz, l);
+			ret += mz->lru_size[l];
 	}
 	return ret;
 }
@@ -1048,7 +1046,7 @@ struct lruvec *mem_cgroup_lru_add_list(s
 	memcg = pc->mem_cgroup;
 	mz = page_cgroup_zoneinfo(memcg, page);
 	/* compound_order() is stabilized through lru_lock */
-	MEM_CGROUP_ZSTAT(mz, lru) += 1 << compound_order(page);
+	mz->lru_size[lru] += 1 << compound_order(page);
 	return &mz->lruvec;
 }
 
@@ -1076,8 +1074,8 @@ void mem_cgroup_lru_del_list(struct page
 	VM_BUG_ON(!memcg);
 	mz = page_cgroup_zoneinfo(memcg, page);
 	/* huge page split is done under lru_lock. so, we have no races. */
-	VM_BUG_ON(MEM_CGROUP_ZSTAT(mz, lru) < (1 << compound_order(page)));
-	MEM_CGROUP_ZSTAT(mz, lru) -= 1 << compound_order(page);
+	VM_BUG_ON(mz->lru_size[lru] < (1 << compound_order(page)));
+	mz->lru_size[lru] -= 1 << compound_order(page);
 }
 
 void mem_cgroup_lru_del(struct page *page)
@@ -3615,7 +3613,7 @@ static int mem_cgroup_force_empty_list(s
 	mz = mem_cgroup_zoneinfo(memcg, node, zid);
 	list = &mz->lruvec.lists[lru];
 
-	loop = MEM_CGROUP_ZSTAT(mz, lru);
+	loop = mz->lru_size[lru];
 	/* give some margin against EBUSY etc...*/
 	loop += 256;
 	busy = NULL;

--
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:30 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-01-01  7:26 [PATCH 0/5] memcg: trivial cleanups Hugh Dickins
2012-01-01  7:27 ` [PATCH 1/5] memcg: replace MEM_CONT by MEM_RES_CTLR Hugh Dickins
2012-01-01  7:33   ` KOSAKI Motohiro
2012-01-02 11:53   ` Michal Hocko
2012-01-05  6:30   ` KAMEZAWA Hiroyuki
2012-01-01  7:29 ` [PATCH 2/5] memcg: replace mem and mem_cont stragglers Hugh Dickins
2012-01-01  7:34   ` KOSAKI Motohiro
2012-01-02 12:25   ` Michal Hocko
2012-01-05  6:31   ` KAMEZAWA Hiroyuki
2012-01-01  7:30 ` Hugh Dickins [this message]
2012-01-01  7:37   ` [PATCH 3/5] memcg: lru_size instead of MEM_CGROUP_ZSTAT KOSAKI Motohiro
2012-01-02 12:59   ` Michal Hocko
2012-01-02 19:43     ` Hugh Dickins
2012-01-03 11:05       ` Michal Hocko
2012-01-05  6:33   ` KAMEZAWA Hiroyuki
2012-01-05 20:14     ` Hugh Dickins
2012-01-01  7:31 ` [PATCH 4/5] memcg: enum lru_list lru Hugh Dickins
2012-01-01  7:38   ` KOSAKI Motohiro
2012-01-02 13:01   ` Michal Hocko
2012-01-05  6:34   ` KAMEZAWA Hiroyuki
2012-01-01  7:33 ` [PATCH 5/5] memcg: remove redundant returns Hugh Dickins
2012-01-01  7:38   ` KOSAKI Motohiro
2012-01-02 13:03   ` Michal Hocko
2012-01-05  6:35   ` KAMEZAWA Hiroyuki
2012-01-01 17:01 ` [PATCH 0/5] memcg: trivial cleanups Kirill A. Shutemov
2012-01-09 13:03 ` Johannes Weiner
2012-01-15  0:07   ` Hugh Dickins
2012-01-15  0:09     ` [PATCH 1/5] memcg: replace MEM_CONT by MEM_RES_CTLR Hugh Dickins
2012-01-15  0:10     ` [PATCH 2/5] memcg: replace mem and mem_cont stragglers Hugh Dickins
2012-01-15  0:12     ` [PATCH 3/5] memcg: lru_size instead of MEM_CGROUP_ZSTAT Hugh Dickins
2012-01-15  0:13     ` [PATCH 4/5] memcg: enum lru_list lru Hugh Dickins
2012-01-15  0:14     ` [PATCH 5/5] memcg: remove redundant returns Hugh Dickins
2012-01-16  9:47     ` [PATCH 0/5] memcg: trivial cleanups Michal Hocko

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.1112312329240.18500@eggly.anvils \
    --to=hughd@google.com \
    --cc=akpm@linux-foundation.org \
    --cc=bsingharora@gmail.com \
    --cc=hannes@cmpxchg.org \
    --cc=kamezawa.hiroyu@jp.fujitsu.com \
    --cc=kosaki.motohiro@gmail.com \
    --cc=linux-mm@kvack.org \
    --cc=mhocko@suse.cz \
    /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