From: Chen Baozi <baozich@gmail.com>
To: Hugh Dickins <hughd@google.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
Konstantin Khlebnikov <khlebnikov@openvz.org>,
KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>,
Johannes Weiner <hannes@cmpxchg.org>,
Michal Hocko <mhocko@suse.cz>,
linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 3/3] mm/memcg: apply add/del_page to lruvec
Date: Fri, 1 Jun 2012 03:14:33 +0800 [thread overview]
Message-ID: <20120531191433.GA14675@centos-guest> (raw)
In-Reply-To: <alpine.LSU.2.00.1205311544400.4561@eggly.anvils>
On Thu, May 31, 2012 at 03:58:59PM -0700, Hugh Dickins wrote:
> On Thu, 31 May 2012, baozich wrote:
> > >
> > > In their place, mem_cgroup_page_lruvec() to decide the lruvec,
> > > previously a side-effect of add, and mem_cgroup_update_lru_size()
> > > to maintain the lru_size stats.
> > I have a stupid question. I'm not sure whether there is reduplication
> > to put both "page" and "zone" parameter in mem_cgroup_page_lruvec(),
> > for I noticed that the "struct zone *zone" parameter are usually from
> > page_zone(page) in most cases. I think that the semantics of this function
> > is to grab the lruvec the page belongs to. So will it be ok if we pass
> > only "page" as the parameter, which I think would be cleaner? Please
> > fix me if I missed something.
>
> I share your dislike for passing down an "unnecessary" argument,
> but I do think it's justified here.
>
> If the zone pointer were available simply by page->zone, then yes,
> I'd agree with you that it's probably silly to pass zone separately.
>
> But page_zone(page) is never as trivial as that, and on some memory
> layouts it can be a lookup that you'd really prefer to avoid repeating.
>
> In every(?) case where we're using mem_cgroup_page_lruvec(), the zone
> is already known: it's just been used for spin_lock_irq(&zone->lru_lock).
>
> And when CONFIG_CGROUP_MEM_RES_CTLR is not set, the inline function
> mem_cgroup_page_lruvec() uses only zone, not page at all: I wouldn't
> want to be slowing down that case with another page_zone(page) lookup.
>
> Also it's somewhat academic (though not for v3.5), in that this function
> goes away in the patches I build upon it; and I expect it also to go away
> in the patches Konstantin would build upon it - mem_cgroup_page_lruvec()
> is a staging point, before we combine memcg/zone lookup with the locking.
>
> Hugh
I see. Thanks for the detailed explaination.
Baozi
prev parent reply other threads:[~2012-06-01 3:14 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-05-14 4:58 [PATCH 0/3] mm/memcg: trivia and more lruvec Hugh Dickins
2012-05-14 5:00 ` [PATCH 1/3] mm/memcg: get_lru_size not get_lruvec_size Hugh Dickins
2012-05-14 10:34 ` KAMEZAWA Hiroyuki
2012-05-14 10:44 ` Konstantin Khlebnikov
2012-05-14 15:49 ` Michal Hocko
2012-05-14 5:01 ` [PATCH 2/3] mm: trivial cleanups in vmscan.c Hugh Dickins
2012-05-14 5:56 ` KOSAKI Motohiro
2012-05-14 10:36 ` KAMEZAWA Hiroyuki
2012-05-14 10:46 ` Konstantin Khlebnikov
2012-05-14 15:52 ` Michal Hocko
2012-05-14 5:02 ` [PATCH 3/3] mm/memcg: apply add/del_page to lruvec Hugh Dickins
2012-05-14 10:40 ` KAMEZAWA Hiroyuki
2012-05-14 11:16 ` Konstantin Khlebnikov
2012-05-14 20:02 ` Hugh Dickins
2012-05-15 8:53 ` Konstantin Khlebnikov
2012-05-15 20:53 ` Hugh Dickins
2012-05-14 16:39 ` Michal Hocko
2012-05-15 12:34 ` Michal Hocko
2012-05-30 22:17 ` baozich
2012-05-31 22:58 ` Hugh Dickins
2012-05-31 19:14 ` Chen Baozi [this message]
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=20120531191433.GA14675@centos-guest \
--to=baozich@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=hannes@cmpxchg.org \
--cc=hughd@google.com \
--cc=kamezawa.hiroyu@jp.fujitsu.com \
--cc=khlebnikov@openvz.org \
--cc=linux-kernel@vger.kernel.org \
--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;
as well as URLs for NNTP newsgroup(s).