A way to shrink process impact on kernel memory usage?

Timothy Miller (miller@techsource.com)
Fri, 09 May 2003 13:10:36 -0400


One of the things that's been worked on to reduce kernel memory usage
for processes is to shrink the kernel stack from 8k to 4k. I mean, it's
not like you could shrink it to 6k, right? Well, why not? Why not
allocate an 8k space and put various process-related data structures at
the beginning of it? Sure, a stack overflow could corrupt that data,
but a stack overflow would be disasterous anyhow.

I'm sure that, in addition to the memory allocated by kmalloc, some data
structures are also allocated to track it so that you can know what to
free when you use kfree, right? Well, combining a few things this way
would save a few bytes there too.

Also, if you're really worried about overflow, or you want a guard page
or whatever, then put the data structures at the end and set the initial
stack pointer appropriately.

Someone complained about a process structure already being too bloated.
Unless it's several K in size already, you can bloat it up all you
please this way.

Another advantage is that you could make the datastructures growable.
The stack grows down, and the data grows up. As long as they don't
meet, all is well.

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/