From: Johannes Weiner <hannes-druUgvl0LCNAfugRpC6u6w@public.gmane.org>
To: KAMEZAWA Hiroyuki
<kamezawa.hiroyu-+CUm20s59erQFUHtdCDX3A@public.gmane.org>
Cc: Michal Hocko <mhocko-AlSwsSmVLrQ@public.gmane.org>,
Balbir Singh
<bsingharora-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
"linux-mm-Bw31MaZKKs3YtjvyW6yDsg@public.gmane.org"
<linux-mm-Bw31MaZKKs3YtjvyW6yDsg@public.gmane.org>,
cgroups-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: [RFC][PATCH] memcg: remove PCG_ACCT_LRU.
Date: Fri, 2 Dec 2011 13:08:49 +0100 [thread overview]
Message-ID: <20111202120849.GA1295@cmpxchg.org> (raw)
In-Reply-To: <20111202190622.8e0488d6.kamezawa.hiroyu-+CUm20s59erQFUHtdCDX3A@public.gmane.org>
On Fri, Dec 02, 2011 at 07:06:22PM +0900, KAMEZAWA Hiroyuki wrote:
> I'm now testing this patch, removing PCG_ACCT_LRU, onto mmotm.
> How do you think ?
> @@ -1024,18 +1026,8 @@ void mem_cgroup_lru_del_list(struct page *page, enum lru_list lru)
> return;
>
> pc = lookup_page_cgroup(page);
> - /*
> - * root_mem_cgroup babysits uncharged LRU pages, but
> - * PageCgroupUsed is cleared when the page is about to get
> - * freed. PageCgroupAcctLRU remembers whether the
> - * LRU-accounting happened against pc->mem_cgroup or
> - * root_mem_cgroup.
> - */
> - if (TestClearPageCgroupAcctLRU(pc)) {
> - VM_BUG_ON(!pc->mem_cgroup);
> - memcg = pc->mem_cgroup;
> - } else
> - memcg = root_mem_cgroup;
> + memcg = pc->mem_cgroup ? pc->mem_cgroup : root_mem_cgroup;
> + VM_BUG_ON(memcg != pc->mem_cgroup_lru);
> mz = page_cgroup_zoneinfo(memcg, page);
> /* huge page split is done under lru_lock. so, we have no races. */
> MEM_CGROUP_ZSTAT(mz, lru) -= 1 << compound_order(page);
Nobody clears pc->mem_cgroup upon uncharge, so this may end up
mistakenly lru-unaccount a page that was never charged against the
stale pc->mem_cgroup (e.g. a swap readahead page that has not been
charged yet gets isolated by reclaim).
On the other hand, pages that were uncharged just before the lru_del
MUST be lru-unaccounted against pc->mem_cgroup.
PageCgroupAcctLRU made it possible to tell those two scenarios apart.
A possible solution could be to clear pc->mem_cgroup when the page is
finally freed so that only pages that have been charged since their
last allocation have pc->mem_cgroup set. But this means that the page
freeing hotpath will have to grow a lookup_page_cgroup(), amortizing
the winnings at least to some extent.
--
To unsubscribe from this list: send the line "unsubscribe cgroups" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
next prev parent reply other threads:[~2011-12-02 12:08 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-12-02 10:06 [RFC][PATCH] memcg: remove PCG_ACCT_LRU KAMEZAWA Hiroyuki
[not found] ` <20111202190622.8e0488d6.kamezawa.hiroyu-+CUm20s59erQFUHtdCDX3A@public.gmane.org>
2011-12-02 12:08 ` Johannes Weiner [this message]
[not found] ` <20111202120849.GA1295-druUgvl0LCNAfugRpC6u6w@public.gmane.org>
2011-12-05 0:50 ` KAMEZAWA Hiroyuki
[not found] ` <20111205095009.b82a9bdf.kamezawa.hiroyu-+CUm20s59erQFUHtdCDX3A@public.gmane.org>
2011-12-06 0:13 ` Hugh Dickins
2011-12-06 0:58 ` KAMEZAWA Hiroyuki
[not found] ` <20111206095825.69426eb2.kamezawa.hiroyu-+CUm20s59erQFUHtdCDX3A@public.gmane.org>
2011-12-06 7:36 ` Hugh Dickins
2011-12-06 10:21 ` KAMEZAWA Hiroyuki
[not found] ` <20111206192101.8ea75558.kamezawa.hiroyu-+CUm20s59erQFUHtdCDX3A@public.gmane.org>
2011-12-06 23:50 ` Hugh Dickins
[not found] ` <alpine.LSU.2.00.1112061506360.2111-T/S/X05ZC3jbmfIwyoSfiQ@public.gmane.org>
2011-12-07 1:48 ` KAMEZAWA Hiroyuki
[not found] ` <20111207104800.d1851f78.kamezawa.hiroyu-+CUm20s59erQFUHtdCDX3A@public.gmane.org>
2011-12-07 6:30 ` Hugh Dickins
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=20111202120849.GA1295@cmpxchg.org \
--to=hannes-druugvl0lcnafugrpc6u6w@public.gmane.org \
--cc=bsingharora-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
--cc=cgroups-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=kamezawa.hiroyu-+CUm20s59erQFUHtdCDX3A@public.gmane.org \
--cc=linux-mm-Bw31MaZKKs3YtjvyW6yDsg@public.gmane.org \
--cc=mhocko-AlSwsSmVLrQ@public.gmane.org \
/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).