From: Vladimir Davydov <vdavydov@parallels.com> To: Johannes Weiner <hannes@cmpxchg.org> Cc: Andrew Morton <akpm@linux-foundation.org>, Michal Hocko <mhocko@suse.cz>, <linux-mm@kvack.org>, <cgroups@vger.kernel.org>, <linux-kernel@vger.kernel.org> Subject: Re: [patch 2/3] mm: memcontrol: consolidate memory controller initialization Date: Mon, 12 Jan 2015 14:14:40 +0300 [thread overview] Message-ID: <20150112111440.GC384@esperanza> (raw) In-Reply-To: <1420856041-27647-2-git-send-email-hannes@cmpxchg.org> On Fri, Jan 09, 2015 at 09:14:00PM -0500, Johannes Weiner wrote: > The initialization code for the per-cpu charge stock and the soft > limit tree is compact enough to inline it into mem_cgroup_init(). > > Signed-off-by: Johannes Weiner <hannes@cmpxchg.org> > --- > mm/memcontrol.c | 57 ++++++++++++++++++++++++--------------------------------- > 1 file changed, 24 insertions(+), 33 deletions(-) > > diff --git a/mm/memcontrol.c b/mm/memcontrol.c > index aad254b30708..f66bb8f83ac9 100644 > --- a/mm/memcontrol.c > +++ b/mm/memcontrol.c [...] > @@ -5927,10 +5896,32 @@ void mem_cgroup_migrate(struct page *oldpage, struct page *newpage, > */ > static int __init mem_cgroup_init(void) > { > + int cpu, nid; > + > hotcpu_notifier(memcg_cpu_hotplug_callback, 0); > + > + for_each_possible_cpu(cpu) > + INIT_WORK(&per_cpu_ptr(&memcg_stock, cpu)->work, > + drain_local_stock); > + > + for_each_node(nid) { > + struct mem_cgroup_tree_per_node *rtpn; > + int zone; > + > + rtpn = kzalloc_node(sizeof(*rtpn), GFP_KERNEL, nid); I'd like to see BUG_ON(!rtpn) here, just for clarity. Not critical though. Reviewed-by: Vladimir Davydov <vdavydov@parallels.com> > + > + for (zone = 0; zone < MAX_NR_ZONES; zone++) { > + struct mem_cgroup_tree_per_zone *rtpz; > + > + rtpz = &rtpn->rb_tree_per_zone[zone]; > + rtpz->rb_root = RB_ROOT; > + spin_lock_init(&rtpz->lock); > + } > + soft_limit_tree.rb_tree_per_node[nid] = rtpn; > + } > + > enable_swap_cgroup(); > - mem_cgroup_soft_limit_tree_init(); > - memcg_stock_init(); > + > return 0; > } > subsys_initcall(mem_cgroup_init); > -- > 2.2.0 >
WARNING: multiple messages have this Message-ID (diff)
From: Vladimir Davydov <vdavydov@parallels.com> To: Johannes Weiner <hannes@cmpxchg.org> Cc: Andrew Morton <akpm@linux-foundation.org>, Michal Hocko <mhocko@suse.cz>, linux-mm@kvack.org, cgroups@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [patch 2/3] mm: memcontrol: consolidate memory controller initialization Date: Mon, 12 Jan 2015 14:14:40 +0300 [thread overview] Message-ID: <20150112111440.GC384@esperanza> (raw) In-Reply-To: <1420856041-27647-2-git-send-email-hannes@cmpxchg.org> On Fri, Jan 09, 2015 at 09:14:00PM -0500, Johannes Weiner wrote: > The initialization code for the per-cpu charge stock and the soft > limit tree is compact enough to inline it into mem_cgroup_init(). > > Signed-off-by: Johannes Weiner <hannes@cmpxchg.org> > --- > mm/memcontrol.c | 57 ++++++++++++++++++++++++--------------------------------- > 1 file changed, 24 insertions(+), 33 deletions(-) > > diff --git a/mm/memcontrol.c b/mm/memcontrol.c > index aad254b30708..f66bb8f83ac9 100644 > --- a/mm/memcontrol.c > +++ b/mm/memcontrol.c [...] > @@ -5927,10 +5896,32 @@ void mem_cgroup_migrate(struct page *oldpage, struct page *newpage, > */ > static int __init mem_cgroup_init(void) > { > + int cpu, nid; > + > hotcpu_notifier(memcg_cpu_hotplug_callback, 0); > + > + for_each_possible_cpu(cpu) > + INIT_WORK(&per_cpu_ptr(&memcg_stock, cpu)->work, > + drain_local_stock); > + > + for_each_node(nid) { > + struct mem_cgroup_tree_per_node *rtpn; > + int zone; > + > + rtpn = kzalloc_node(sizeof(*rtpn), GFP_KERNEL, nid); I'd like to see BUG_ON(!rtpn) here, just for clarity. Not critical though. Reviewed-by: Vladimir Davydov <vdavydov@parallels.com> > + > + for (zone = 0; zone < MAX_NR_ZONES; zone++) { > + struct mem_cgroup_tree_per_zone *rtpz; > + > + rtpz = &rtpn->rb_tree_per_zone[zone]; > + rtpz->rb_root = RB_ROOT; > + spin_lock_init(&rtpz->lock); > + } > + soft_limit_tree.rb_tree_per_node[nid] = rtpn; > + } > + > enable_swap_cgroup(); > - mem_cgroup_soft_limit_tree_init(); > - memcg_stock_init(); > + > return 0; > } > subsys_initcall(mem_cgroup_init); > -- > 2.2.0 > -- 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:[~2015-01-12 11:14 UTC|newest] Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top 2015-01-10 2:13 [patch 1/3] mm: memcontrol: remove unnecessary soft limit tree node test Johannes Weiner 2015-01-10 2:13 ` Johannes Weiner 2015-01-10 2:14 ` [patch 2/3] mm: memcontrol: consolidate memory controller initialization Johannes Weiner 2015-01-10 2:14 ` Johannes Weiner 2015-01-10 2:14 ` Johannes Weiner 2015-01-12 11:14 ` Vladimir Davydov [this message] 2015-01-12 11:14 ` Vladimir Davydov 2015-01-13 14:53 ` Michal Hocko 2015-01-13 14:53 ` Michal Hocko [not found] ` <1420856041-27647-1-git-send-email-hannes-druUgvl0LCNAfugRpC6u6w@public.gmane.org> 2015-01-10 2:14 ` Johannes Weiner 2015-01-10 2:14 ` [patch 3/3] mm: memcontrol: consolidate swap controller code Johannes Weiner 2015-01-10 2:14 ` Johannes Weiner 2015-01-10 2:14 ` Johannes Weiner 2015-01-10 2:14 ` Johannes Weiner 2015-01-12 11:22 ` Vladimir Davydov 2015-01-12 11:22 ` Vladimir Davydov 2015-01-12 11:22 ` Vladimir Davydov 2015-01-13 15:01 ` Michal Hocko 2015-01-13 15:01 ` Michal Hocko 2015-01-13 15:01 ` Michal Hocko 2015-01-12 11:11 ` [patch 1/3] mm: memcontrol: remove unnecessary soft limit tree node test Vladimir Davydov 2015-01-12 11:11 ` Vladimir Davydov 2015-01-12 11:11 ` Vladimir Davydov 2015-01-13 14:50 ` Michal Hocko 2015-01-13 14:50 ` Michal Hocko
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=20150112111440.GC384@esperanza \ --to=vdavydov@parallels.com \ --cc=akpm@linux-foundation.org \ --cc=cgroups@vger.kernel.org \ --cc=hannes@cmpxchg.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: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.