Skip to contentSkip to conversation

Documentation: x86: update the thread_info's position

PATCH In review Mingzhe Yang 2 participants 3 messages Dec 5, 2020 – Dec 22, 2020 Documentation

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Documentation: x86: update the thread_info's position

Prior to kernel 4.9 the thread_info structure was at the bottom of the kernel stack. kernel 4.9 moved it into the task_struct.

See commits c65eacb ("sched/core: Allow putting thread_info into task_struct"), 15f4eae ("x86: Move thread_info into task_struct") and 883d50f ("scripts/gdb: fix get_thread_info").

---
 Documentation/x86/kernel-stacks.rst | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
Documentation/x86/kernel-stacks.rst +2 -1
index 6b0bcf0..e9097f3 100644
@@ -15,7 +15,8 @@ Like all other architectures, x86_64 has a kernel stack for every
 active thread.  These thread stacks are THREAD_SIZE (2*PAGE_SIZE) big.
 These stacks contain useful data as long as a thread is alive or a
 zombie. While the thread is in user space the kernel stack is empty
-except for the thread_info structure at the bottom.
+except for the thread_info structure at the bottom (since kernel 4.9,
+the thread_info structure has been moved into task_struct).
 
 In addition to the per thread stacks, there are specialized stacks
 associated with each CPU.  These stacks are only used while the kernel
Signature · 1 line
1.8.3.1
maintainer
#1 lore raw
Quoted 17 lines · On Sat, 5 Dec 2020 13:01:36 +0800 Mingzhe Yang <[email protected]> wrote:

Prior to kernel 4.9 the thread_info structure was at the bottom of the kernel stack. kernel 4.9 moved it into the task_struct.

See commits c65eacb ("sched/core: Allow putting thread_info into task_struct"), 15f4eae ("x86: Move thread_info into task_struct") and 883d50f ("scripts/gdb: fix get_thread_info").

---
 Documentation/x86/kernel-stacks.rst | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
Documentation/x86/kernel-stacks.rst +0 -0
index 6b0bcf0..e9097f3 100644

Documentation/x86/kernel-stacks.rst Like all other architectures, x86_64 has a kernel stack for every · line 19

Quoted 6 lines
Documentation/x86/kernel-stacks.rst +2 -1
@@ -15,7 +15,8 @@ Like all other architectures, x86_64 has a kernel stack for every
 active thread.  These thread stacks are THREAD_SIZE (2*PAGE_SIZE) big.
 These stacks contain useful data as long as a thread is alive or a
 zombie. While the thread is in user space the kernel stack is empty
-except for the thread_info structure at the bottom.
+except for the thread_info structure at the bottom (since kernel 4.9,
+the thread_info structure has been moved into task_struct).

So this has been sitting in my inbox for a bit, sorry. This seems worth fixing, but is this the correct fix? The documentation should reflect the current kernel, rather than what once was with a "(it's not actually that way anymore)" note. Is the kernel stack truly empty now? If so we should just say that; otherwise say what's lurking there in current kernels.

Thanks,

jon

#2 lore raw

Thanks a million!
I truly appreciate your review!

Quoted 37 lines · Jonathan Corbet
Quoted 17 lines · On Sat, 5 Dec 2020 13:01:36 +0800 Mingzhe Yang <[email protected]> wrote:

Prior to kernel 4.9 the thread_info structure was at the bottom of the kernel stack. kernel 4.9 moved it into the task_struct.

See commits c65eacb ("sched/core: Allow putting thread_info into task_struct"), 15f4eae ("x86: Move thread_info into task_struct") and 883d50f ("scripts/gdb: fix get_thread_info").

---
 Documentation/x86/kernel-stacks.rst | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
Documentation/x86/kernel-stacks.rst +0 -0
index 6b0bcf0..e9097f3 100644

Documentation/x86/kernel-stacks.rst Like all other architectures, x86_64 has a kernel stack for every · line 19

Quoted 6 lines
Documentation/x86/kernel-stacks.rst +2 -1
@@ -15,7 +15,8 @@ Like all other architectures, x86_64 has a kernel stack for every
 active thread.  These thread stacks are THREAD_SIZE (2*PAGE_SIZE) big.
 These stacks contain useful data as long as a thread is alive or a
 zombie. While the thread is in user space the kernel stack is empty
-except for the thread_info structure at the bottom.
+except for the thread_info structure at the bottom (since kernel 4.9,
+the thread_info structure has been moved into task_struct).

So this has been sitting in my inbox for a bit, sorry. This seems worth fixing, but is this the correct fix? The documentation should reflect the current kernel, rather than what once was with a "(it's not actually that way anymore)" note. Is the kernel stack truly empty now? If so we should just say that; otherwise say what's lurking there in current kernels.

Thanks,

jon