From: Gabriele Monaco <gmonaco@redhat.com>
To: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>,
Ingo Molnar <mingo@redhat.com>,
Peter Zijlstra <peterz@infradead.org>,
Juri Lelli <juri.lelli@redhat.com>,
Vincent Guittot <vincent.guittot@linaro.org>,
Dietmar Eggemann <dietmar.eggemann@arm.com>,
Steven Rostedt <rostedt@goodmis.org>,
Ben Segall <bsegall@google.com>, Mel Gorman <mgorman@suse.de>,
Valentin Schneider <vschneid@redhat.com>,
linux-kernel@vger.kernel.org
Cc: Gabriele Monaco <gmonaco@redhat.com>
Subject: [PATCH 1/2] sched: Optimise task_mm_cid_work duration
Date: Mon, 2 Dec 2024 15:07:34 +0100 [thread overview]
Message-ID: <20241202140735.56368-2-gmonaco@redhat.com> (raw)
In-Reply-To: <20241202140735.56368-1-gmonaco@redhat.com>
The current behaviour of task_mm_cid_work is to loop through all
possible CPUs twice to clean up old mm_cid remotely, this can be a waste
of resources especially on tasks with a CPU affinity.
This patch reduces the CPUs involved in the remote CID cleanup carried
on by task_mm_cid_work.
Using the mm_cidmask for the remote cleanup can considerably reduce the
function runtime in highly isolated environments, where each process has
affinity to a single core. Likewise, in the worst case, the mask is
equivalent to all possible CPUs and we don't see any difference with the
current behaviour.
Signed-off-by: Gabriele Monaco <gmonaco@redhat.com>
---
kernel/sched/core.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index 95e40895a519..57b50b5952fa 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -10553,14 +10553,14 @@ static void task_mm_cid_work(struct callback_head *work)
return;
cidmask = mm_cidmask(mm);
/* Clear cids that were not recently used. */
- for_each_possible_cpu(cpu)
+ for_each_cpu_from(cpu, cidmask)
sched_mm_cid_remote_clear_old(mm, cpu);
weight = cpumask_weight(cidmask);
/*
* Clear cids that are greater or equal to the cidmask weight to
* recompact it.
*/
- for_each_possible_cpu(cpu)
+ for_each_cpu_from(cpu, cidmask)
sched_mm_cid_remote_clear_weight(mm, cpu, weight);
}
--
2.47.0
next prev parent reply other threads:[~2024-12-02 14:08 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-12-02 14:07 [PATCH 0/2] sched: improve task_mm_cid_work impact on isolated systems Gabriele Monaco
2024-12-02 14:07 ` Gabriele Monaco [this message]
2024-12-02 14:21 ` [PATCH 1/2] sched: Optimise task_mm_cid_work duration Mathieu Desnoyers
2024-12-02 14:56 ` Gabriele Monaco
2024-12-02 15:01 ` Mathieu Desnoyers
2024-12-02 15:59 ` Gabriele Monaco
2024-12-03 2:14 ` kernel test robot
2024-12-02 14:07 ` [PATCH 2/2] sched: Move task_mm_cid_work to RCU callback Gabriele Monaco
2024-12-02 14:34 ` Mathieu Desnoyers
2024-12-02 15:21 ` Gabriele Monaco
2024-12-03 15:00 ` Joel Fernandes
2024-12-04 8:01 ` Gabriele Monaco
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=20241202140735.56368-2-gmonaco@redhat.com \
--to=gmonaco@redhat.com \
--cc=bsegall@google.com \
--cc=dietmar.eggemann@arm.com \
--cc=juri.lelli@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mathieu.desnoyers@efficios.com \
--cc=mgorman@suse.de \
--cc=mingo@redhat.com \
--cc=peterz@infradead.org \
--cc=rostedt@goodmis.org \
--cc=vincent.guittot@linaro.org \
--cc=vschneid@redhat.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
all inboxes | Powered by JetHome®