[RFC] One solution for the oom/overcommit debate

From: Helge Hafting (helgehaf@idb.hist.no)
Date: Mon Mar 27 2000 - 06:44:04 EST


>1. How can I avoid using stack or library functions, especially doing file
> IO? Right now I simply ignore the SIGHUP if system memory is low, but
> the daemon still must read the /proc/[PID] files periodically.

You may avoid library calls by doing system calls directly. Look at
(g)libc
sources to see how "fread()" etc. is implemented.

I don't think you can avoid the stack completely, but you can probably
keep it down
to 1 page. Don't use any local non-static variables. Keep them all
global or static. If you want to be extreme - implement everything in
main() and use goto's instead of functions. This is normally not
necessary though,
you can safely use functions if you keep the nesting limit low. The
return
address, parameters, and local variables is what you get on the stack -
make
sure parameter lists are short and that the works-case usage is way
below the page size.
You can avoid parameters by using global variables instead. Don't use
recursion.

Helge Hafting

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



This archive was generated by hypermail 2b29 : Fri Mar 31 2000 - 21:00:19 EST