mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] [RFC] sched/core: avoid checking in_atomic_preempt_off twice
@ 2023-08-25  2:35 liming.wu
  2023-09-22  9:59 ` [tip: sched/core] sched/debug: Avoid checking in_atomic_preempt_off() twice in schedule_debug() tip-bot2 for Liming Wu
  0 siblings, 1 reply; 2+ messages in thread
From: liming.wu @ 2023-08-25  2:35 UTC (permalink / raw)
  To: mingo, peterz, juri.lelli, vincent.guittot, dietmar.eggemann,
	rostedt, bsegall, mgorman, bristot, vschneid, brauner,
	linux-kernel, 398776277
  Cc: Liming Wu

From: Liming Wu <liming.wu@jaguarmicro.com>

in_atomic_preempt_off is checked twice in schedule_debug, and
__schedule_bug only called in schedule_debug. remove the redundant
in_atomic_preempt_off check in __schedule_bug.

Signed-off-by: Liming Wu <liming.wu@jaguarmicro.com>
---
 kernel/sched/core.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index a68d1276bab0..ae44958b3851 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -5884,8 +5884,7 @@ static noinline void __schedule_bug(struct task_struct *prev)
 	print_modules();
 	if (irqs_disabled())
 		print_irqtrace_events(prev);
-	if (IS_ENABLED(CONFIG_DEBUG_PREEMPT)
-	    && in_atomic_preempt_off()) {
+	if (IS_ENABLED(CONFIG_DEBUG_PREEMPT)) {
 		pr_err("Preemption disabled at:");
 		print_ip_sym(KERN_ERR, preempt_disable_ip);
 	}
-- 
2.25.1


^ permalink raw reply	[flat|nested] 2+ messages in thread

* [tip: sched/core] sched/debug: Avoid checking in_atomic_preempt_off() twice in schedule_debug()
  2023-08-25  2:35 [PATCH] [RFC] sched/core: avoid checking in_atomic_preempt_off twice liming.wu
@ 2023-09-22  9:59 ` tip-bot2 for Liming Wu
  0 siblings, 0 replies; 2+ messages in thread
From: tip-bot2 for Liming Wu @ 2023-09-22  9:59 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: Liming Wu, Ingo Molnar, x86, linux-kernel

The following commit has been merged into the sched/core branch of tip:

Commit-ID:     dc461c48deda8a2d243fbaf49e276d555eb833d8
Gitweb:        https://git.kernel.org/tip/dc461c48deda8a2d243fbaf49e276d555eb833d8
Author:        Liming Wu <liming.wu@jaguarmicro.com>
AuthorDate:    Fri, 25 Aug 2023 10:35:00 +08:00
Committer:     Ingo Molnar <mingo@kernel.org>
CommitterDate: Fri, 22 Sep 2023 11:50:49 +02:00

sched/debug: Avoid checking in_atomic_preempt_off() twice in schedule_debug()

in_atomic_preempt_off() already gets called in schedule_debug() once,
which is the only caller of __schedule_bug().

Skip the second call within __schedule_bug(), it should always be true
at this point.

[ mingo: Clarified the changelog. ]

Signed-off-by: Liming Wu <liming.wu@jaguarmicro.com>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Link: https://lore.kernel.org/r/20230825023501.1848-1-liming.wu@jaguarmicro.com
---
 kernel/sched/core.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index 52ceb85..1074934 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -5899,8 +5899,7 @@ static noinline void __schedule_bug(struct task_struct *prev)
 	print_modules();
 	if (irqs_disabled())
 		print_irqtrace_events(prev);
-	if (IS_ENABLED(CONFIG_DEBUG_PREEMPT)
-	    && in_atomic_preempt_off()) {
+	if (IS_ENABLED(CONFIG_DEBUG_PREEMPT)) {
 		pr_err("Preemption disabled at:");
 		print_ip_sym(KERN_ERR, preempt_disable_ip);
 	}

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-09-22  9:59 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-08-25  2:35 [PATCH] [RFC] sched/core: avoid checking in_atomic_preempt_off twice liming.wu
2023-09-22  9:59 ` [tip: sched/core] sched/debug: Avoid checking in_atomic_preempt_off() twice in schedule_debug() tip-bot2 for Liming Wu

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®