From: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
To: Ying Han <yinghan@google.com>
Cc: "linux-mm@kvack.org" <linux-mm@kvack.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"akpm@linux-foundation.org" <akpm@linux-foundation.org>,
"nishimura@mxp.nes.nec.co.jp" <nishimura@mxp.nes.nec.co.jp>,
"bsingharora@gmail.com" <bsingharora@gmail.com>,
Michal Hocko <mhocko@suse.cz>,
"hannes@cmpxchg.org" <hannes@cmpxchg.org>
Subject: Re: [PATCH 5/7] Fix not good check of mem_cgroup_local_usage()
Date: Mon, 20 Jun 2011 08:44:54 +0900 [thread overview]
Message-ID: <20110620084454.85f048f9.kamezawa.hiroyu@jp.fujitsu.com> (raw)
In-Reply-To: <BANLkTi=4o-xY46OtsvNCxVKUT-qJBXRMMFZCe-m7eMV-_mesXw@mail.gmail.com>
On Fri, 17 Jun 2011 15:27:36 -0700
Ying Han <yinghan@google.com> wrote:
> On Wed, Jun 15, 2011 at 8:54 PM, KAMEZAWA Hiroyuki
> <kamezawa.hiroyu@jp.fujitsu.com> wrote:
> > From fcfc6ee9847b0b2571cd6e9847572d7c70e1e2b2 Mon Sep 17 00:00:00 2001
> > From: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
> > Date: Thu, 16 Jun 2011 09:23:54 +0900
> > Subject: [PATCH 5/7] Fix not good check of mem_cgroup_local_usage()
> >
> > Now, mem_cgroup_local_usage(memcg) is used as hint for scanning memory
> > cgroup hierarchy. If it returns true, the memcg has some reclaimable memory.
> >
> > But this function doesn't take care of
> > A - unevictable pages
> > A - anon pages on swapless system.
> >
> > This patch fixes the function to use LRU information.
> > For NUMA, for avoid scanning, numa scan bitmap is used. If it's
> > empty, some more precise check will be done.
> >
> > Signed-off-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
> > ---
> > A mm/memcontrol.c | A 43 +++++++++++++++++++++++++++++++++----------
> > A 1 files changed, 33 insertions(+), 10 deletions(-)
> >
> > Index: mmotm-0615/mm/memcontrol.c
> > ===================================================================
> > --- mmotm-0615.orig/mm/memcontrol.c
> > +++ mmotm-0615/mm/memcontrol.c
> > @@ -632,15 +632,6 @@ static long mem_cgroup_read_stat(struct
> > A A A A return val;
> > A }
> >
> > -static long mem_cgroup_local_usage(struct mem_cgroup *mem)
> > -{
> > - A A A long ret;
> > -
> > - A A A ret = mem_cgroup_read_stat(mem, MEM_CGROUP_STAT_RSS);
> > - A A A ret += mem_cgroup_read_stat(mem, MEM_CGROUP_STAT_CACHE);
> > - A A A return ret;
> > -}
> > -
> > A static void mem_cgroup_swap_statistics(struct mem_cgroup *mem,
> > A A A A A A A A A A A A A A A A A A A A bool charge)
> > A {
> > @@ -1713,6 +1704,23 @@ static void mem_cgroup_numascan_init(str
> > A A A A mutex_init(&mem->numascan_mutex);
> > A }
> >
> > +static bool mem_cgroup_reclaimable(struct mem_cgroup *mem, bool noswap)
> > +{
> > + A A A if (!nodes_empty(mem->scan_nodes))
> > + A A A A A A A return true;
> > + A A A /* slow path */
> > + A A A if (mem_cgroup_get_local_zonestat(mem, LRU_INACTIVE_FILE))
> > + A A A A A A A return true;
> > + A A A if (mem_cgroup_get_local_zonestat(mem, LRU_ACTIVE_FILE))
> > + A A A A A A A return true;
>
> Wondering if we can simplify this like:
>
> if (mem_cgroup_nr_file_lru_pages(mem))
> return true;
>
>
> > + A A A if (noswap || !total_swap_pages)
> > + A A A A A A A return false;
> > + A A A if (mem_cgroup_get_local_zonestat(mem, LRU_INACTIVE_ANON))
> > + A A A A A A A return true;
> > + A A A if (mem_cgroup_get_local_zonestat(mem, LRU_ACTIVE_ANON))
> > + A A A A A A A return true;
>
> the same:
> if (mem_cgroup_nr_anon_lru_pages(mem))
> return true;
>
> > + A A A return false;
> > +}
>
> The two functions above are part of memory.numa_stat patch which is in
> mmotm i believe. Just feel the functionality a bit duplicate except
> the noswap parameter and scan_nodes.
>
Ah, I didn't noticed such function.
Hm, considering more, I think we don't have to scann all nodes and
make sum of number because what we check is whether pages == 0 or
pages != 0.
I'll make an update.
Thanks,
-Kame
--
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>
next prev parent reply other threads:[~2011-06-19 23:51 UTC|newest]
Thread overview: 34+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-06-16 3:47 [PATCH 0/7] memcg numa node scan update KAMEZAWA Hiroyuki
2011-06-16 3:51 ` [PATCH 1/7] Fix mem_cgroup_hierarchical_reclaim() to do stable hierarchy walk KAMEZAWA Hiroyuki
2011-06-22 15:15 ` Michal Hocko
2011-06-22 18:33 ` Michal Hocko
2011-06-23 6:21 ` KAMEZAWA Hiroyuki
2011-06-16 3:52 ` [PATCH 2/7] export memory cgroup's swappines by mem_cgroup_swappiness() KAMEZAWA Hiroyuki
2011-06-22 15:22 ` Michal Hocko
2011-06-22 16:31 ` Ying Han
2011-06-16 3:53 ` [PATCH 3/7] memcg: add memory.scan_stat KAMEZAWA Hiroyuki
2011-06-17 22:04 ` Ying Han
2011-06-19 23:41 ` KAMEZAWA Hiroyuki
2011-06-20 4:02 ` KAMEZAWA Hiroyuki
2011-06-20 6:59 ` Ying Han
2011-06-21 6:49 ` Ying Han
2011-06-21 6:52 ` Ying Han
2011-06-22 0:20 ` KAMEZAWA Hiroyuki
2011-06-24 21:40 ` Ying Han
2011-06-27 1:49 ` KAMEZAWA Hiroyuki
2011-06-16 3:54 ` [PATCH 4/7] memcg: update numa information based on event counter KAMEZAWA Hiroyuki
2011-06-22 15:53 ` Michal Hocko
2011-06-23 6:27 ` KAMEZAWA Hiroyuki
2011-06-23 8:12 ` Michal Hocko
2011-06-16 3:54 ` [PATCH 5/7] Fix not good check of mem_cgroup_local_usage() KAMEZAWA Hiroyuki
2011-06-17 22:27 ` Ying Han
2011-06-19 23:44 ` KAMEZAWA Hiroyuki [this message]
2011-06-22 15:58 ` Michal Hocko
2011-06-16 3:56 ` [PATCH 6/7] memcg: calc NUMA node's weight for scan KAMEZAWA Hiroyuki
2011-06-23 13:35 ` Michal Hocko
2011-06-23 14:27 ` Hiroyuki Kamezawa
2011-06-16 3:57 ` [PATCH 7/7] memcg: proportional fair vicitm node selection KAMEZAWA Hiroyuki
2011-06-23 13:48 ` Michal Hocko
2011-06-23 14:10 ` Hiroyuki Kamezawa
2011-06-23 14:30 ` Michal Hocko
2011-06-23 22:20 ` Hiroyuki Kamezawa
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=20110620084454.85f048f9.kamezawa.hiroyu@jp.fujitsu.com \
--to=kamezawa.hiroyu@jp.fujitsu.com \
--cc=akpm@linux-foundation.org \
--cc=bsingharora@gmail.com \
--cc=hannes@cmpxchg.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mhocko@suse.cz \
--cc=nishimura@mxp.nes.nec.co.jp \
--cc=yinghan@google.com \
/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