From: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
To: balbir@linux.vnet.ibm.com
Cc: "linux-mm@kvack.org" <linux-mm@kvack.org>,
"nishimura@mxp.nes.nec.co.jp" <nishimura@mxp.nes.nec.co.jp>
Subject: Re: [RFC][PATCH] memcg remove css_get/put per pages
Date: Wed, 9 Jun 2010 09:47:34 +0900 [thread overview]
Message-ID: <20100609094734.cbb744aa.kamezawa.hiroyu@jp.fujitsu.com> (raw)
In-Reply-To: <20100608054003.GY4603@balbir.in.ibm.com>
On Tue, 8 Jun 2010 11:10:04 +0530
Balbir Singh <balbir@linux.vnet.ibm.com> wrote:
> * KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com> [2010-06-08 12:19:01]:
>
> > Now, I think pre_destroy->force_empty() works very well and we can get rid of
> > css_put/get per pages. This has very big effect in some special case.
> >
> > This is a test result with a multi-thread page fault program
> > (I used at rwsem discussion.)
> >
> > [Before patch]
> > 25.72% multi-fault-all [kernel.kallsyms] [k] clear_page_c
> > 8.18% multi-fault-all [kernel.kallsyms] [k] try_get_mem_cgroup_from_mm
> > 8.17% multi-fault-all [kernel.kallsyms] [k] down_read_trylock
> > 8.03% multi-fault-all [kernel.kallsyms] [k] _raw_spin_lock_irqsave
> > 5.46% multi-fault-all [kernel.kallsyms] [k] __css_put
> > 5.45% multi-fault-all [kernel.kallsyms] [k] __alloc_pages_nodemask
> > 4.36% multi-fault-all [kernel.kallsyms] [k] _raw_spin_lock_irq
> > 4.35% multi-fault-all [kernel.kallsyms] [k] up_read
> > 3.59% multi-fault-all [kernel.kallsyms] [k] css_put
> > 2.37% multi-fault-all [kernel.kallsyms] [k] _raw_spin_lock
> > 1.80% multi-fault-all [kernel.kallsyms] [k] mem_cgroup_add_lru_list
> > 1.78% multi-fault-all [kernel.kallsyms] [k] __rmqueue
> > 1.65% multi-fault-all [kernel.kallsyms] [k] handle_mm_fault
> >
> > try_get_mem_cgroup_from_mm() is a one of heavy ops because of false-sharing in
> > css's counter for css_get/put.
> >
> > I removed that.
> >
> > [After]
> > 26.16% multi-fault-all [kernel.kallsyms] [k] clear_page_c
> > 11.73% multi-fault-all [kernel.kallsyms] [k] _raw_spin_lock
> > 9.23% multi-fault-all [kernel.kallsyms] [k] _raw_spin_lock_irqsave
> > 9.07% multi-fault-all [kernel.kallsyms] [k] down_read_trylock
> > 6.09% multi-fault-all [kernel.kallsyms] [k] _raw_spin_lock_irq
> > 5.57% multi-fault-all [kernel.kallsyms] [k] __alloc_pages_nodemask
> > 4.86% multi-fault-all [kernel.kallsyms] [k] up_read
> > 2.54% multi-fault-all [kernel.kallsyms] [k] __mem_cgroup_commit_charge
> > 2.29% multi-fault-all [kernel.kallsyms] [k] _cond_resched
> > 2.04% multi-fault-all [kernel.kallsyms] [k] mem_cgroup_add_lru_list
> > 1.82% multi-fault-all [kernel.kallsyms] [k] handle_mm_fault
> >
> > Hmm. seems nice. But I don't convince my patch has no race.
> > I'll continue test but your help is welcome.
> >
>
> Looks nice, Kamezawa-San could you please confirm the source of
> raw_spin_lock_irqsave and trylock from /proc/lock_stat?
>
Sure. But above result can be got when lockdep etc..are off.
(it increase lock overhead)
But yes, new _raw_spin_lock seems strange.
> > ==
> > From: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
> >
> > Now, memory cgroup increments css(cgroup subsys state)'s reference
> > count per a charged page. And the reference count is kept until
> > the page is uncharged. But this has 2 bad effect.
> >
> > 1. Because css_get/put calls atoimic_inc()/dec, heavy call of them
> > on large smp will not scale well.
> > 2. Because css's refcnt cannot be in a state as "ready-to-release",
> > cgroup's notify_on_release handler can't work with memcg.
> >
> > This is a trial to remove css's refcnt per a page. Even if we remove
> ^^ (per page)
> > refcnt, pre_destroy() does enough synchronization.
>
> Could you also document what the rules for css_get/put now become? I
> like the idea, but I am not sure if I understand the new rules
> correctly by looking at the code.
Hm. I'll try....but this just removes css_get/put per pages..
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/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
next prev parent reply other threads:[~2010-06-09 0:51 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-06-08 3:19 KAMEZAWA Hiroyuki
2010-06-08 5:40 ` Balbir Singh
2010-06-09 0:47 ` KAMEZAWA Hiroyuki [this message]
2010-06-09 5:14 ` KAMEZAWA Hiroyuki
2010-06-08 7:31 ` Daisuke Nishimura
2010-06-09 0:54 ` KAMEZAWA Hiroyuki
2010-06-09 2:05 ` Daisuke Nishimura
2010-06-09 6:59 ` [RFC][PATCH] memcg remove css_get/put per pages v2 KAMEZAWA Hiroyuki
2010-06-10 2:34 ` Daisuke Nishimura
2010-06-10 2:49 ` KAMEZAWA Hiroyuki
2010-06-11 4:37 ` Daisuke Nishimura
2010-06-11 4:52 ` KAMEZAWA Hiroyuki
2010-06-11 4:59 ` Daisuke Nishimura
2010-06-11 6:11 ` Balbir Singh
2010-06-11 6:21 ` KAMEZAWA Hiroyuki
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=20100609094734.cbb744aa.kamezawa.hiroyu@jp.fujitsu.com \
--to=kamezawa.hiroyu@jp.fujitsu.com \
--cc=balbir@linux.vnet.ibm.com \
--cc=linux-mm@kvack.org \
--cc=nishimura@mxp.nes.nec.co.jp \
/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