lkml.org 
[lkml]   [2011]   [Jun]   [19]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 5/7] Fix not good check of mem_cgroup_local_usage()
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
> >  - unevictable pages
> >  - 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>
> > ---
> >  mm/memcontrol.c |   43 +++++++++++++++++++++++++++++++++----------
> >  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
> >        return val;
> >  }
> >
> > -static long mem_cgroup_local_usage(struct mem_cgroup *mem)
> > -{
> > -       long ret;
> > -
> > -       ret = mem_cgroup_read_stat(mem, MEM_CGROUP_STAT_RSS);
> > -       ret += mem_cgroup_read_stat(mem, MEM_CGROUP_STAT_CACHE);
> > -       return ret;
> > -}
> > -
> >  static void mem_cgroup_swap_statistics(struct mem_cgroup *mem,
> >                                         bool charge)
> >  {
> > @@ -1713,6 +1704,23 @@ static void mem_cgroup_numascan_init(str
> >        mutex_init(&mem->numascan_mutex);
> >  }
> >
> > +static bool mem_cgroup_reclaimable(struct mem_cgroup *mem, bool noswap)
> > +{
> > +       if (!nodes_empty(mem->scan_nodes))
> > +               return true;
> > +       /* slow path */
> > +       if (mem_cgroup_get_local_zonestat(mem, LRU_INACTIVE_FILE))
> > +               return true;
> > +       if (mem_cgroup_get_local_zonestat(mem, LRU_ACTIVE_FILE))
> > +               return true;
>
> Wondering if we can simplify this like:
>
> if (mem_cgroup_nr_file_lru_pages(mem))
> return true;
>
>
> > +       if (noswap || !total_swap_pages)
> > +               return false;
> > +       if (mem_cgroup_get_local_zonestat(mem, LRU_INACTIVE_ANON))
> > +               return true;
> > +       if (mem_cgroup_get_local_zonestat(mem, LRU_ACTIVE_ANON))
> > +               return true;
>
> the same:
> if (mem_cgroup_nr_anon_lru_pages(mem))
> return true;
>
> > +       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 from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2011-06-20 01:55    [W:0.172 / U:0.256 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site