mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 1/2] sched: fix thread_union::task visibility
@ 2020-06-18 16:17 Masahiro Yamada
  2020-06-18 16:17 ` [PATCH 2/2] init: annotate init_task as __init_task_data for all arches Masahiro Yamada
  0 siblings, 1 reply; 2+ messages in thread
From: Masahiro Yamada @ 2020-06-18 16:17 UTC (permalink / raw)
  To: David Howells
  Cc: Masahiro Yamada, Ben Segall, Dietmar Eggemann, Ingo Molnar,
	Juri Lelli, Mel Gorman, Peter Zijlstra, Steven Rostedt,
	Thomas Gleixner, Vincent Guittot, linux-kernel

When CONFIG_ARCH_TASK_STRUCT_ON_STACK=y (i.e. ARCH=ia64), task_struct
and the thread stack are shared.

The ifdef condition of CONFIG_ARCH_TASK_STRUCT_ON_STACK is opposite.

Now that the init thread stack is constructed by the linker script,
this is not a practical problem, but let's fix the code just in case.

Fixes: 0500871f21b2 ("Construct init thread stack in the linker script rather than by union")
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
---

 include/linux/sched.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/linux/sched.h b/include/linux/sched.h
index b62e6aaf28f0..6d6c4d38c063 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -1674,7 +1674,7 @@ extern void ia64_set_curr_task(int cpu, struct task_struct *p);
 void yield(void);
 
 union thread_union {
-#ifndef CONFIG_ARCH_TASK_STRUCT_ON_STACK
+#ifdef CONFIG_ARCH_TASK_STRUCT_ON_STACK
 	struct task_struct task;
 #endif
 #ifndef CONFIG_THREAD_INFO_IN_TASK
-- 
2.25.1


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

* [PATCH 2/2] init: annotate init_task as __init_task_data for all arches
  2020-06-18 16:17 [PATCH 1/2] sched: fix thread_union::task visibility Masahiro Yamada
@ 2020-06-18 16:17 ` Masahiro Yamada
  0 siblings, 0 replies; 2+ messages in thread
From: Masahiro Yamada @ 2020-06-18 16:17 UTC (permalink / raw)
  To: David Howells
  Cc: Masahiro Yamada, Eric W. Biederman, Ingo Molnar, Marco Elver,
	Mike Rapoport, Paul E. McKenney, Sami Tolvanen, Thomas Gleixner,
	linux-kernel

__init_task_data is no-op when CONFIG_ARCH_TASK_STRUCT_ON_STACK=n,
so you can always annotate init_task as __init_task_data.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
---

 init/init_task.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/init/init_task.c b/init/init_task.c
index 15089d15010a..0110b2941c4d 100644
--- a/init/init_task.c
+++ b/init/init_task.c
@@ -61,11 +61,7 @@ unsigned long init_shadow_call_stack[SCS_SIZE / sizeof(long)]
  * Set up the first task table, touch at your own risk!. Base=0,
  * limit=0x1fffff (=2MB)
  */
-struct task_struct init_task
-#ifdef CONFIG_ARCH_TASK_STRUCT_ON_STACK
-	__init_task_data
-#endif
-= {
+struct task_struct init_task __init_task_data = {
 #ifdef CONFIG_THREAD_INFO_IN_TASK
 	.thread_info	= INIT_THREAD_INFO(init_task),
 	.stack_refcount	= REFCOUNT_INIT(1),
-- 
2.25.1


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

end of thread, other threads:[~2020-06-18 16:20 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-18 16:17 [PATCH 1/2] sched: fix thread_union::task visibility Masahiro Yamada
2020-06-18 16:17 ` [PATCH 2/2] init: annotate init_task as __init_task_data for all arches Masahiro Yamada

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®