How much kernel stack can be used in non-terminal function inside module ?
Lev Olshvang
levonshe at yandex.com
Thu Aug 16 17:24:30 IDT 2018
Having the kernel stack is limited to 4K, how can I know how many of this 4K was used
before mu function X() is called ?
I need to extract 512 bytes of some data from storage using vfs_getxattr(). I can call for kmalloc or just use buffer on stack.
But how can assess whether I can safely do this or not ?
What was the stack utilization till my function was called, how much space is left?
And while I may take a diff of SP and Stack segment register to know stack utilization to the current moment ( I wonder whether if there are some kernel macro exist?) I do knot know how to calculate future consumption of stack memory down the vfs call chain.
Regards,
Lev
More information about the Linux-il
mailing list