All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
To: linux-kernel@vger.kernel.org
Cc: Ben Segall <bsegall@google.com>,
	Boqun Feng <boqun.feng@gmail.com>,
	Daniel Bristot de Oliveira <bristot@redhat.com>,
	Dietmar Eggemann <dietmar.eggemann@arm.com>,
	Ingo Molnar <mingo@redhat.com>,
	Juri Lelli <juri.lelli@redhat.com>, Mel Gorman <mgorman@suse.de>,
	Peter Zijlstra <peterz@infradead.org>,
	Steven Rostedt <rostedt@goodmis.org>,
	Thomas Gleixner <tglx@linutronix.de>,
	Vincent Guittot <vincent.guittot@linaro.org>,
	Waiman Long <longman@redhat.com>, Will Deacon <will@kernel.org>,
	Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Subject: [PATCH 01/11] sched: Trigger warning if ->migration_disabled counter underflows.
Date: Mon, 29 Nov 2021 18:46:44 +0100	[thread overview]
Message-ID: <20211129174654.668506-2-bigeasy@linutronix.de> (raw)
In-Reply-To: <20211129174654.668506-1-bigeasy@linutronix.de>

If migrate_enable() is used more often than its counter part then it
remains undetected and rq::nr_pinned will underflow, too.

Add a warning if migrate_enable() is attempted if without a matching a
migrate_disable().

Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
---
 kernel/sched/core.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index 76f9deeaa9420..02be3f6144e97 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -2171,6 +2171,8 @@ void migrate_enable(void)
 	if (p->migration_disabled > 1) {
 		p->migration_disabled--;
 		return;
+	} else if (WARN_ON_ONCE(p->migration_disabled == 0)) {
+		return;
 	}
 
 	/*
-- 
2.34.0


  reply	other threads:[~2021-11-29 22:44 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-29 17:46 [PATCH 00/11] lockdep: Unbreak lockdep's selftest work on PREEMPT_RT Sebastian Andrzej Siewior
2021-11-29 17:46 ` Sebastian Andrzej Siewior [this message]
2021-12-02 21:02   ` [PATCH 01/11] sched: Trigger warning if ->migration_disabled counter underflows Peter Zijlstra
2021-12-06 15:15   ` [tip: locking/core] " tip-bot2 for Sebastian Andrzej Siewior
2021-11-29 17:46 ` [PATCH 02/11] locking: Remove rt_rwlock_is_contended() Sebastian Andrzej Siewior
2021-12-06 15:15   ` [tip: locking/core] " tip-bot2 for Sebastian Andrzej Siewior
2021-11-29 17:46 ` [PATCH 03/11] locking/rtmutex: Squash self-deadlock check for ww_rt_mutex Sebastian Andrzej Siewior
2021-12-06 15:15   ` [tip: locking/core] " tip-bot2 for Peter Zijlstra
2021-11-29 17:46 ` [PATCH 04/11] locking/rtmutex: Add rt_mutex_lock_nest_lock() and rt_mutex_lock_killable() Sebastian Andrzej Siewior
2021-12-06 15:15   ` [tip: locking/core] " tip-bot2 for Sebastian Andrzej Siewior
2021-11-29 17:46 ` [PATCH 05/11] lockdep: Remove softirq accounting on PREEMPT_RT Sebastian Andrzej Siewior
2021-12-06 15:15   ` [tip: locking/core] " tip-bot2 for Thomas Gleixner
2021-11-29 17:46 ` [PATCH 06/11] lockdep/selftests: Avoid using local_lock_{acquire|release}() Sebastian Andrzej Siewior
2021-12-06 15:15   ` [tip: locking/core] " tip-bot2 for Sebastian Andrzej Siewior
2021-11-29 17:46 ` [PATCH 07/11] lockdep/selftests: Unbalanced migrate_disable() & rcu_read_lock() Sebastian Andrzej Siewior
2021-12-06 15:15   ` [tip: locking/core] " tip-bot2 for Sebastian Andrzej Siewior
2021-11-29 17:46 ` [PATCH 08/11] lockdep/selftests: Skip the softirq related tests on PREEMPT_RT Sebastian Andrzej Siewior
2021-12-06 15:15   ` [tip: locking/core] " tip-bot2 for Sebastian Andrzej Siewior
2021-11-29 17:46 ` [PATCH 09/11] lockdep/selftests: Adapt ww-tests for PREEMPT_RT Sebastian Andrzej Siewior
2021-12-06 15:15   ` [tip: locking/core] " tip-bot2 for Sebastian Andrzej Siewior
2021-11-29 17:46 ` [PATCH 10/11] x86/mm: Include spinlock_t definition in pgtable Sebastian Andrzej Siewior
2021-12-07 14:22   ` [tip: locking/core] " tip-bot2 for Sebastian Andrzej Siewior
2021-11-29 17:46 ` [PATCH 11/11] locking: Allow to include asm/spinlock_types.h from linux/spinlock_types_raw.h Sebastian Andrzej Siewior
2021-11-29 17:46   ` Sebastian Andrzej Siewior
2021-11-29 17:46   ` Sebastian Andrzej Siewior
2021-11-29 17:46   ` Sebastian Andrzej Siewior
2021-11-29 17:46   ` Sebastian Andrzej Siewior
2021-11-29 17:46   ` Sebastian Andrzej Siewior
2021-12-07 14:22   ` [tip: locking/core] " tip-bot2 for Sebastian Andrzej Siewior
2021-12-02 21:12 ` [PATCH 00/11] lockdep: Unbreak lockdep's selftest work on PREEMPT_RT Peter Zijlstra
2021-12-06 15:26   ` Sebastian Andrzej Siewior
2021-12-06 15:43     ` Peter Zijlstra
2021-12-07 14:19       ` Peter Zijlstra
2021-12-07 14:30         ` Sebastian Andrzej Siewior

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=20211129174654.668506-2-bigeasy@linutronix.de \
    --to=bigeasy@linutronix.de \
    --cc=boqun.feng@gmail.com \
    --cc=bristot@redhat.com \
    --cc=bsegall@google.com \
    --cc=dietmar.eggemann@arm.com \
    --cc=juri.lelli@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=longman@redhat.com \
    --cc=mgorman@suse.de \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    --cc=rostedt@goodmis.org \
    --cc=tglx@linutronix.de \
    --cc=vincent.guittot@linaro.org \
    --cc=will@kernel.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 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.