From: Johannes Weiner <hannes@cmpxchg.org>
To: Roman Gushchin <guroan@gmail.com>
Cc: linux-mm@kvack.org, kernel-team@fb.com,
linux-kernel@vger.kernel.org, Tejun Heo <tj@kernel.org>,
Rik van Riel <riel@surriel.com>, Michal Hocko <mhocko@kernel.org>,
Roman Gushchin <guro@fb.com>
Subject: Re: [PATCH 2/5] mm: prepare to premature release of per-node lruvec_stat_cpu
Date: Mon, 11 Mar 2019 13:17:48 -0400 [thread overview]
Message-ID: <20190311171748.GB10823@cmpxchg.org> (raw)
In-Reply-To: <20190307230033.31975-3-guro@fb.com>
On Thu, Mar 07, 2019 at 03:00:30PM -0800, Roman Gushchin wrote:
> Similar to the memcg's vmstats_percpu, per-memcg per-node stats
> consists of percpu- and atomic counterparts, and we do expect
> that both coexist during the whole life-cycle of the memcg.
>
> To prepare for a premature release of percpu per-node data,
> let's pretend that lruvec_stat_cpu is a rcu-protected pointer,
> which can be NULL. This patch adds corresponding checks whenever
> required.
>
> Signed-off-by: Roman Gushchin <guro@fb.com>
Acked-by: Johannes Weiner <hannes@cmpxchg.org>
> @@ -4430,7 +4436,8 @@ static int alloc_mem_cgroup_per_node_info(struct mem_cgroup *memcg, int node)
> if (!pn)
> return 1;
>
> - pn->lruvec_stat_cpu = alloc_percpu(struct lruvec_stat);
> + rcu_assign_pointer(pn->lruvec_stat_cpu,
> + alloc_percpu(struct lruvec_stat));
> if (!pn->lruvec_stat_cpu) {
Nitpick: wouldn't this have to use rcu_dereference()? Might be cleaner
to use an intermediate variable and only assign after the NULL check.
next prev parent reply other threads:[~2019-03-11 17:17 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-03-07 23:00 [PATCH 0/5] mm: reduce the memory footprint of dying memory cgroups Roman Gushchin
2019-03-07 23:00 ` [PATCH 1/5] mm: prepare to premature release of memcg->vmstats_percpu Roman Gushchin
2019-03-11 17:14 ` Johannes Weiner
2019-03-07 23:00 ` [PATCH 2/5] mm: prepare to premature release of per-node lruvec_stat_cpu Roman Gushchin
2019-03-11 17:17 ` Johannes Weiner [this message]
2019-03-07 23:00 ` [PATCH 3/5] mm: release memcg percpu data prematurely Roman Gushchin
2019-03-11 17:25 ` Johannes Weiner
2019-03-07 23:00 ` [PATCH 4/5] mm: release per-node " Roman Gushchin
2019-03-11 17:27 ` Johannes Weiner
2019-03-07 23:00 ` [PATCH 5/5] mm: spill memcg percpu stats and events before releasing Roman Gushchin
2019-03-11 17:38 ` Johannes Weiner
2019-03-11 19:27 ` Roman Gushchin
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=20190311171748.GB10823@cmpxchg.org \
--to=hannes@cmpxchg.org \
--cc=guro@fb.com \
--cc=guroan@gmail.com \
--cc=kernel-team@fb.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mhocko@kernel.org \
--cc=riel@surriel.com \
--cc=tj@kernel.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