Thread (9 messages) 9 messages, 3 authors, 2019-12-16

Re: [PATCH] lib: Check for migrate_disable only on SMP systems

From: Scott Wood <hidden>
Date: 2019-12-07 03:22:07

On Fri, 2019-12-06 at 20:39 +0100, Daniel Wagner wrote:
Hi Scott,

On Fri, Dec 06, 2019 at 12:49:12PM -0600, Scott Wood wrote:
quoted
On Fri, 2019-12-06 at 15:21 +0100, Daniel Wagner wrote:
quoted
In case the kernel configuration is UP is, the migrate_disable member
in task_struct is missing.

linux/lib/smp_processor_id.c: In function ‘check_preemption_disabled’:
linux/lib/smp_processor_id.c:26:13: error: ‘struct task_struct’ has no
member named ‘migrate_disable’
    26 |  if (current->migrate_disable)
       |             ^~

Fixes: 425c5b38779a ("sched: Lazy migrate_disable processing")
Cc: Scott Wood <redacted>
Cc: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Daniel Wagner <redacted>
---
 lib/smp_processor_id.c | 2 ++
 1 file changed, 2 insertions(+)
diff --git a/lib/smp_processor_id.c b/lib/smp_processor_id.c
index 5f2618d346c4..a914f73e3652 100644
--- a/lib/smp_processor_id.c
+++ b/lib/smp_processor_id.c
@@ -23,8 +23,10 @@ unsigned int check_preemption_disabled(const char
*what1, const char *what2)
 	 * Kernel threads bound to a single CPU can safely use
 	 * smp_processor_id():
 	 */
+#if defined(CONFIG_SMP) && defined(CONFIG_PREEMPT_RT_BASE)
 	if (current->migrate_disable)
 		goto out;
+#endif
Won't this give false positives on UP with CONFIG_PREEMPT_RT_BASE and
CONFIG_DEBUG_PREEMPT? If we have CONFIG_SCHED_DEBUG then we can still
check
migrate_disable.
Ohhh, I see what you mean. I didn't realize that migrate_disable is
also available with CONFIG_SCHED_DEBUG. So the ifdef should be
something like:

#if defined(CONFIG_PREEMP_RT_BASE) && \
    (defined(CONFIG_SMP) || \
      (!defined(CONFIG_SMP) && defined(CONFIG_SCHED_DEBUG)))
That would still leave the issue with false positives if you have
CONFIG_DEBUG_PREEMPT but not CONFIG_SCHED_DEBUG (which should be the only
config currently experiencing build problems).

-Scott

Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help