LWN.net Logo

Shrinking the x86 stack

Shrinking the x86 stack

Posted Dec 15, 2002 11:48 UTC (Sun) by rwmj (guest, #5474)
In reply to: Shrinking the x86 stack by cpeterso
Parent article: Shrinking the x86 stack

I can't comment on other architectures, but on the x86, the 8 KB (2 page)
area actually has two purposes. It contains the (fixed-size) task_struct
at the bottom end, and the kernel stack growing down from the top end.

On x86, the pseudo-variable "current" which points to the current process's
task_struct is actually an assembly macro which does (roughly)

%esp & ~8KB

The observation is that since every process has an 8 KB block, aligned
to 8 KB, to find the address of task_struct, one just needs to round down
the stack pointer to the nearest 8 KB-aligned address.

This article didn't make clear what happened to task_struct. Is it still
there? Or somewhere else?


(Log in to post comments)

Shrinking the x86 stack

Posted Dec 15, 2002 11:53 UTC (Sun) by rwmj (guest, #5474) [Link]

To answer my own question: the patch does appear to keep the task structure
along with the reduced stack. Things also seem to have changed with regard
the "current" variable which seems to no longer exist (replaced by
GET_THREAD_INFO, I think).

Copyright © 2012, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds