Re: [PATCH 08/11] memcg: make zone_reclaim_stat

From: KOSAKI Motohiro
Date: Thu Dec 04 2008 - 02:15:58 EST



> > +struct zone_reclaim_stat *mem_cgroup_get_reclaim_stat(struct mem_cgroup *memcg,
> > + struct zone *zone)
> > +{
> > + int nid = zone->zone_pgdat->node_id;
> > + int zid = zone_idx(zone);
> > + struct mem_cgroup_per_zone *mz = mem_cgroup_zoneinfo(memcg, nid, zid);
> > +
> > + return &mz->reclaim_stat;
> > +}
> > +
> > +struct zone_reclaim_stat *mem_cgroup_get_reclaim_stat_by_page(struct page *page)
> > +{
>
> I would prefer to use stat_from_page instead of stat_by_page, by page
> is confusing.

ok.
will fix.


> > @@ -172,6 +173,12 @@ void activate_page(struct page *page)
> >
> > reclaim_stat->recent_rotated[!!file]++;
> > reclaim_stat->recent_scanned[!!file]++;
> > +
> > + memcg_reclaim_stat = mem_cgroup_get_reclaim_stat_by_page(page);
> > + if (memcg_reclaim_stat) {
> > + memcg_reclaim_stat->recent_rotated[!!file]++;
> > + memcg_reclaim_stat->recent_scanned[!!file]++;
> > + }
>
> Does it make sense to write two inline routines like
>
> update_recent_rotated(page)
> {
> zone = page_zone(page);
>
> zone->reclaim_stat->recent_rotated[!!file]++;
> mem_reclaim_stat = mem_cgroup_get_reclaim_stat_by_page(page);
> if (mem_reclaim_stat)
> mem_cg_reclaim_stat->recent_rotated[!!file]++;
> ...
>
> }
>
> and similarly update_recent_reclaimed(page)

makes sense. good cleanup.

will fix.



> > Index: b/mm/vmscan.c
> > ===================================================================
> > --- a/mm/vmscan.c
> > +++ b/mm/vmscan.c
> > @@ -134,6 +134,9 @@ static DECLARE_RWSEM(shrinker_rwsem);
> > static struct zone_reclaim_stat *get_reclaim_stat(struct zone *zone,
> > struct scan_control *sc)
> > {
> > + if (!scan_global_lru(sc))
> > + mem_cgroup_get_reclaim_stat(sc->mem_cgroup, zone);
>
> What do we gain by just calling mem_cgroup_get_reclaim_stat? Where do
> we return/use this value?

Agghh.
My last cleanup is _not_ cleanup..

thanks! will fix.





--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/