All of lore.kernel.org
 help / color / mirror / Atom feed
From: Frederic Weisbecker <frederic@kernel.org>
To: Peter Zijlstra <peterz@infradead.org>, Ingo Molnar <mingo@kernel.org>
Cc: LKML <linux-kernel@vger.kernel.org>,
	Frederic Weisbecker <frederic@kernel.org>
Subject: [PATCH 2/2] sched: Always print out preempt dynamic state
Date: Tue,  8 Jun 2021 14:04:42 +0200	[thread overview]
Message-ID: <20210608120442.93587-3-frederic@kernel.org> (raw)
In-Reply-To: <20210608120442.93587-1-frederic@kernel.org>

Previously the preempt dynamic mode wasn't printed out if it wasn't
overriden with the "preempt=" boot option.

But now that the default preempt dynamic behaviour can be selected at
Kconfig time, we can't assume anymore that preempt=full is the default.
The only way to retrieve that information is to browse the kernel config
file.

Better print it out unconditionally then.

Signed-off-by: Frederic Weisbecker <frederic@kernel.org>
---
 kernel/sched/core.c | 21 ++++++++++++++++-----
 1 file changed, 16 insertions(+), 5 deletions(-)

diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index df47a8275c37..6b883adad8f7 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -6262,6 +6262,21 @@ int sched_dynamic_mode(const char *str)
 
 void sched_dynamic_update(int mode)
 {
+	switch (mode) {
+		case preempt_dynamic_none:
+			pr_info("Dynamic Preempt: none\n");
+			break;
+		case preempt_dynamic_voluntary:
+			pr_info("Dynamic Preempt: voluntary\n");
+			break;
+		case preempt_dynamic_full:
+			pr_info("Dynamic Preempt: full\n");
+			break;
+		default:
+			pr_info("Dynamic Preempt: incorrect\n");
+			return;
+	}
+
 	if (preempt_dynamic_mode == mode)
 		return;
 
@@ -6282,7 +6297,6 @@ void sched_dynamic_update(int mode)
 		static_call_update(preempt_schedule, NULL);
 		static_call_update(preempt_schedule_notrace, NULL);
 		static_call_update(irqentry_exit_cond_resched, NULL);
-		pr_info("Dynamic Preempt: none\n");
 		break;
 
 	case preempt_dynamic_voluntary:
@@ -6291,7 +6305,6 @@ void sched_dynamic_update(int mode)
 		static_call_update(preempt_schedule, NULL);
 		static_call_update(preempt_schedule_notrace, NULL);
 		static_call_update(irqentry_exit_cond_resched, NULL);
-		pr_info("Dynamic Preempt: voluntary\n");
 		break;
 
 	case preempt_dynamic_full:
@@ -6300,7 +6313,6 @@ void sched_dynamic_update(int mode)
 		static_call_update(preempt_schedule, __preempt_schedule_func);
 		static_call_update(preempt_schedule_notrace, __preempt_schedule_notrace_func);
 		static_call_update(irqentry_exit_cond_resched, irqentry_exit_cond_resched);
-		pr_info("Dynamic Preempt: full\n");
 		break;
 	}
 
@@ -6323,8 +6335,7 @@ __setup("preempt=", setup_preempt_mode);
 
 static void __init init_preempt(void)
 {
-	if (preempt_dynamic_mode_init != preempt_dynamic_full)
-		sched_dynamic_update(preempt_dynamic_mode_init);
+	sched_dynamic_update(preempt_dynamic_mode_init);
 }
 #else
 static inline void init_preempt(void) { }
-- 
2.25.1


  parent reply	other threads:[~2021-06-08 12:04 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-08 12:04 [PATCH 0/2] sched: Define default preempt dynamic boot mode on Kconfig Frederic Weisbecker
2021-06-08 12:04 ` [PATCH 1/2] sched: Add default dynamic preempt mode Kconfig Frederic Weisbecker
2021-06-08 13:55   ` Peter Zijlstra
2021-06-08 14:04     ` Peter Zijlstra
2021-06-09 11:27       ` Frederic Weisbecker
2021-06-09 11:13     ` Frederic Weisbecker
2021-06-08 13:55   ` Peter Zijlstra
2021-06-09 11:25     ` Frederic Weisbecker
2021-06-08 12:04 ` Frederic Weisbecker [this message]
2021-06-08 13:56   ` [PATCH 2/2] sched: Always print out preempt dynamic state Peter Zijlstra

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=20210608120442.93587-3-frederic@kernel.org \
    --to=frederic@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=peterz@infradead.org \
    --subject='Re: [PATCH 2/2] sched: Always print out preempt dynamic state' \
    /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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.