From: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
To: Peter Zijlstra <peterz@infradead.org>
Cc: Aaron Lu <aaron.lu@intel.com>,
linux-kernel@vger.kernel.org, Olivier Dion <odion@efficios.com>,
michael.christie@oracle.com
Subject: Re: [RFC PATCH v4] sched: Fix performance regression introduced by mm_cid
Date: Thu, 13 Apr 2023 11:37:18 -0400 [thread overview]
Message-ID: <47f42d31-4b74-0273-62c1-0b75fffbf066@efficios.com> (raw)
In-Reply-To: <20230413152023.GO4253@hirez.programming.kicks-ass.net>
On 2023-04-13 11:20, Peter Zijlstra wrote:
> On Thu, Apr 13, 2023 at 09:56:38AM -0400, Mathieu Desnoyers wrote:
>
>>> Mathieu, WDYT? -- other than that the patch is an obvious hack :-)
>>
>> I hate it with passion :-)
>>
>> It is quite specific to your workload/configuration.
>>
>> If we take for instance a process with a large mm_users count which is
>> eventually affined to a subset of the cpus with cpusets or
>> sched_setaffinity, your patch will prevent compaction of the concurrency ids
>> when it really should not.
>
> I don't think it will, it will only kick in once the higest cid is
> handed out (I should've used num_online_cpus() instead of nr_cpu_ids),
> and with affinity at play that should never happen.
So in that case, this optimization will only work if affinity is not
set. E.g. a hackbench with cpuset or sched_setaffinity excluding one
core from the set will still be slower.
>
> Now, the more fancy scheme with:
>
> min(t->nr_cpus_allowed, atomic_read(&t->mm->mm_users))
>
> that does get to be more complex; and I've yet to find a working version
> that doesn't also need a for_each_cpu() loop on for reclaim :/
Indeed. And with a allowed cpus approach, we need to carefully consider
what happens if we change a allowed cpu mask from one set to another
set, e.g, from allowing cpus 0, 1 to allowing only cpus 2, 3. There will
be task migration, and we need to reclaim the cids from 0, 1, but we can
very well be in a case where the number of mm_users is above the number
of allowed cpus.
>
> Anyway, I think the hack as presented is safe, but a hack none-the-less.
I don't think it is _unsafe_, but it will only trigger in specific
scenarios, which makes it harder to understand more subtle performance
regressions for scenarios that are not covered by this hack.
Thanks,
Mathieu
--
Mathieu Desnoyers
EfficiOS Inc.
https://www.efficios.com
next prev parent reply other threads:[~2023-04-13 15:37 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-04-10 15:01 Mathieu Desnoyers
2023-04-10 21:51 ` michael.christie
2023-04-11 4:52 ` Aaron Lu
2023-04-11 13:12 ` Aaron Lu
2023-04-12 9:10 ` Peter Zijlstra
2023-04-12 11:42 ` Aaron Lu
2023-04-12 14:26 ` Peter Zijlstra
2023-04-12 14:39 ` Aaron Lu
2023-04-13 11:10 ` Peter Zijlstra
2023-04-13 13:49 ` Aaron Lu
2023-04-13 13:56 ` Mathieu Desnoyers
2023-04-13 15:20 ` Peter Zijlstra
2023-04-13 15:37 ` Mathieu Desnoyers [this message]
2023-04-12 4:27 ` Aaron Lu
2023-04-12 20:57 ` Mathieu Desnoyers
2023-04-13 13:13 ` Aaron Lu
2023-04-13 13:38 ` Mathieu Desnoyers
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=47f42d31-4b74-0273-62c1-0b75fffbf066@efficios.com \
--to=mathieu.desnoyers@efficios.com \
--cc=aaron.lu@intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=michael.christie@oracle.com \
--cc=odion@efficios.com \
--cc=peterz@infradead.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
all inboxes | Powered by JetHome®