RE: Killing/balancing processes when overcommited

From: Thunder from the hill (thunder@lightweight.ods.org)
Date: Thu Sep 12 2002 - 13:30:53 EST


Hi,

On Thu, 12 Sep 2002, Giuliano Pochini wrote:
> It's not difficult to make the kerner choose the right processes
> to kill. It's impossible.

Not quite. But it's expensive. It adds 4 bytes per task, plus a second
OOM killer.

> Imagine that when it goes oom the system stops and asks you what
> processes have to be killed. What do you kill ?

Rather whom would you ask?

> Probably we do need an oomd that the sysadmin can configure as he likes.

That's bad, it could get killed. ;-)

Mostly the mem eaters are those who hang in an malloc() deadloop.

        char *x = NULL;

        /*
         * We need this variable, so if we don't get it, we reallocate it
         * regardless of what happened.
         */
        do {
                x = malloc(X_SIZE);
        } while (!x);

That's possibly a candidate.

So if we just count how often per second that stubborn process uses
malloc(), you'll catch the right guy most of the time. If you don't get
a process that's over the threshold, do usual OOM killing...

                        Thunder

-- 
--./../...-/. -.--/---/..-/.-./..././.-../..-. .---/..-/.../- .-
--/../-./..-/-/./--..-- ../.----./.-../.-.. --./../...-/. -.--/---/..-
.- -/---/--/---/.-./.-./---/.--/.-.-.-
--./.-/-.../.-./.././.-../.-.-.-

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



This archive was generated by hypermail 2b29 : Sun Sep 15 2002 - 22:00:30 EST