mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Nicolas Saenz Julienne <nsaenzju@redhat.com>
To: mingo@redhat.com, peterz@infradead.org, frederic@kernel.org,
	rostedt@goodmis.org
Cc: tglx@linutronix.de, mtosatti@redhat.com, bristot@redhat.com,
	linux-kernel@vger.kernel.org,
	Nicolas Saenz Julienne <nsaenzju@redhat.com>
Subject: [RESEND PATCH 1/2] sched/isolation: Use raw_smp_processor_id() in housekeeping_any_cpu()
Date: Mon, 28 Feb 2022 15:15:50 +0100	[thread overview]
Message-ID: <20220228141550.260119-1-nsaenzju@redhat.com> (raw)

housekeeping_any_cpu() will return a housekeeping CPU. That's it. It'll
try to optimize for NUMA locality and to use the local CPU when
possible, but it's not a requisite.

So let's use raw_smp_processor_id() instead of its vanilla counterpart
in order to allow users to query for housekeeping CPUs without having to
disable preemption.

Signed-off-by: Nicolas Saenz Julienne <nsaenzju@redhat.com>
---

NOTE: Resent as I forgot to CC the linux mailing list.

 include/linux/sched/isolation.h | 2 +-
 kernel/sched/isolation.c        | 5 +++--
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/include/linux/sched/isolation.h b/include/linux/sched/isolation.h
index 8c15abd67aed..0c09ff1e4599 100644
--- a/include/linux/sched/isolation.h
+++ b/include/linux/sched/isolation.h
@@ -31,7 +31,7 @@ extern void __init housekeeping_init(void);
 
 static inline int housekeeping_any_cpu(enum hk_type type)
 {
-	return smp_processor_id();
+	return raw_smp_processor_id();
 }
 
 static inline const struct cpumask *housekeeping_cpumask(enum hk_type type)
diff --git a/kernel/sched/isolation.c b/kernel/sched/isolation.c
index b4d10815c45a..3b8e1d47bbc0 100644
--- a/kernel/sched/isolation.c
+++ b/kernel/sched/isolation.c
@@ -43,14 +43,15 @@ int housekeeping_any_cpu(enum hk_type type)
 
 	if (static_branch_unlikely(&housekeeping_overridden)) {
 		if (housekeeping.flags & BIT(type)) {
-			cpu = sched_numa_find_closest(housekeeping.cpumasks[type], smp_processor_id());
+			cpu = sched_numa_find_closest(housekeeping.cpumasks[type],
+						      raw_smp_processor_id());
 			if (cpu < nr_cpu_ids)
 				return cpu;
 
 			return cpumask_any_and(housekeeping.cpumasks[type], cpu_online_mask);
 		}
 	}
-	return smp_processor_id();
+	return raw_smp_processor_id();
 }
 EXPORT_SYMBOL_GPL(housekeeping_any_cpu);
 
-- 
2.35.1


             reply	other threads:[~2022-02-28 14:16 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-28 14:15 Nicolas Saenz Julienne [this message]
2022-02-28 14:15 ` [RESEND PATCH 2/2] tracing: Avoid isolated CPUs when queueing fsnotify irqwork Nicolas Saenz Julienne
2022-02-28 18:07   ` kernel test robot
2022-02-28 18:20     ` Nicolas Saenz Julienne
2022-02-28 19:49   ` kernel test robot

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=20220228141550.260119-1-nsaenzju@redhat.com \
    --to=nsaenzju@redhat.com \
    --cc=bristot@redhat.com \
    --cc=frederic@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=mtosatti@redhat.com \
    --cc=peterz@infradead.org \
    --cc=rostedt@goodmis.org \
    --cc=tglx@linutronix.de \
    /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®