Re: Memory hogs

Bernd Paysan (bernd.paysan@gmx.de)
Fri, 16 Jul 1999 15:43:29 +0200 (MEST)


Khimenko Victor wrote:
> Greeaatt idea. Can you cook up patch or something ? Andrea
> (andrea@suse.de) Rik (riel@nl.linux.org) and others tried really
> hard to make things better but so far no really acceptable (for
> Linus :-) solution was found AFAIK...

I'll try over the weekend. The algorithm I have in mind looks as follows:

Every process has a score. Allocating a (real, if overcommit is true) page
increments the score, freeing decrements. You get malus points for causing
swap out of other pages (perhaps even depending on their age: swapping out
really old pages shouldn't cost you much). Once in a while, all scores are
multiplied by a constant <1 (e.g. once per second by 0.95 or so), to filter
out history. A linear search for the top score process is only required when
memory is sparse, so the performance impact should be neglectible. Processes
inherit scores from their parent (increases scores of fork-bomb childs), as
well as from exec().

There will be four limits: user "warning" level (send a QUIT signal), user
"kill" level (kill -9 the process), root warning level and root kill level.
This allows root to kill a DOS attack that knows that after receiving a
QUIT signal, you should not allocate further pages for risk of being kill-9'ed.

-- 
Bernd Paysan
"If you want it done right, you have to do it yourself"
http://www.jwdt.com/~paysan/

Sent through Global Message Exchange - http://www.gmx.net

- 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/