How to determine the size of the kernel stack

I need to determine the stack size of a running Linux kernel inside a kernel module. I know that the THREAD_SIZE macro gives the stack size for this architecture, but I cannot use it. Because compilation and launch machines are different. Is there a way to do this through the proc, kernel api, or exported character interface? Thanks

+4
source share
2 answers

try it

system("getconf _POSIX_THREAD_ATTR_STACKSIZE"); 

getconf -a list of system variables may be displayed in the console

0
source

I think you can find it in thread_info.h of your architecture. Usually the kernel stack is 2 pages (8 KB), but it depends on your configuration.

0
source

Source: https://habr.com/ru/post/1434646/


All Articles