From: Michal Hocko <mhocko@kernel.org>
To: Wei Yang <richardw.yang@linux.intel.com>
Cc: akpm@linux-foundation.org, linux-mm@kvack.org,
linux-kernel@vger.kernel.org, rientjes@google.com
Subject: Re: [PATCH v2] mm/vmscan.c: only adjust related kswapd cpu affinity when online cpu
Date: Mon, 17 Feb 2020 10:31:24 +0100 [thread overview]
Message-ID: <20200217093124.GH31531@dhcp22.suse.cz> (raw)
In-Reply-To: <20200215003753.GA32682@richard>
On Sat 15-02-20 08:37:53, Wei Yang wrote:
> On Fri, Feb 14, 2020 at 09:51:13AM +0100, Michal Hocko wrote:
> >On Fri 14-02-20 15:33:20, Wei Yang wrote:
> >> When onlining a cpu, kswapd_cpu_online() is called to adjust kswapd cpu
> >> affinity.
> >>
> >> Current routine does like this:
> >>
> >> a) Iterate all the numa node
> >> b) Adjust cpu affinity when node has an online cpu
> >>
> >> For a) this is not necessary, since the particular online cpu belongs to
> >> a particular numa node. So it is not necessary to iterate on every nodes
> >> on the system. This new onlined cpu just affect kswapd cpu affinity of
> >> this particular node.
> >>
> >> For b) several cpumask operation is used to check whether the node has
> >> an online CPU. Since at this point we are sure one of our CPU onlined,
> >> we can set the cpu affinity directly to current cpumask_of_node().
> >>
> >> This patch simplifies the logic by set cpu affinity of the affected
> >> kswapd.
> >
> >How have you tested this patch?
> >
>
> I online one cpu and confirm the "cpu" is the one we just onlined.
>
> If my understanding is correct, this is the expected behavior.
>
> >Also this is an old code and quite convoluted but does it still work as
> >inteded? I mean, I do not see any cpu offline callback to reduce the
> >cpu mask as all the CPUs for the given node go offline? Wouldn't the
>
> You are right, I didn't see the counterpart for cpu offline. This is the
> question I want to ask. Seems we didn't handle it at the very beginning.
>
> >scheduler simply go and fallback to no affinity if that happens?
> >In other words what is the value of kswapd_cpu_online in the first
> >place?
>
> Some cases may this function be useful.
>
> If we have a memory node which doesn't have any online cpu, the default
> cpumask is not set. After one of the cpu online, we want to change cpu
> affinity.
>
> Or we want to add more cpu to the system, we could allow kswapd use more cpu
> resources. Otherwise, kswapd would be limited to those original cpus.
OK, so the usecase is when a NUMA node gains a new CPU which wasn't
there at the time when the node got onlined. Is this a scenario we
really do care about? While not completely impossible I haven't seen
a system which would allow such a runtime configurability. Maybe it
would be simply easier to drop the callback for now until we have a real
world usecase to support it and have it documented.
--
Michal Hocko
SUSE Labs
next prev parent reply other threads:[~2020-02-17 9:31 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-02-14 7:33 [PATCH v2] mm/vmscan.c: only adjust related kswapd cpu affinity when online cpu Wei Yang
2020-02-14 8:51 ` Michal Hocko
2020-02-15 0:37 ` Wei Yang
2020-02-17 9:31 ` Michal Hocko [this message]
2020-02-18 0:24 ` Wei Yang
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=20200217093124.GH31531@dhcp22.suse.cz \
--to=mhocko@kernel.org \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=richardw.yang@linux.intel.com \
--cc=rientjes@google.com \
/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).