I need to determine the stack size of the running Linux kernel inside a kernel module. I do know that the macro THREAD_SIZE gives the stack size for a given architecture but I cannot use that. Since the compile and the run machines are different. Is there any way I could do this via a proc interface, kernel api or exported symbol? Thanks
Asked
Active
Viewed 3,970 times
6
-
I think that it's safe to rely on THREAD_SIZE. For example if you compile your module for x86, you can be sure that THREAD_SIZE will always be PAGE_SIZE << THREAD_ORDER == 4K. – strkol Sep 18 '12 at 21:26
-
@strkol That's the whole problem. The kernel on which the module needs to work is a custom one. So this approach wont work. – pandaman Sep 20 '12 at 04:28
2 Answers
0
try this
system("getconf _POSIX_THREAD_ATTR_STACKSIZE");
getconf -a
in console may output the list of system variables

Nahuel Fouilleul
- 18,726
- 2
- 31
- 36
-
1Thanks @Nahuel, But I need the stack size of kernel thread and not the user threads – pandaman Sep 18 '12 at 07:59
0
I think you can find it in thread_info.h of your architecture. Normally the kernel stack is 2 pages (8KB) but it depends on your configuration.

wli
- 1