From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id ; Thu, 12 Sep 2002 14:26:58 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id ; Thu, 12 Sep 2002 14:26:57 -0400 Received: from pD9E23F87.dip.t-dialin.net ([217.226.63.135]:38373 "EHLO hawkeye.luckynet.adm") by vger.kernel.org with ESMTP id ; Thu, 12 Sep 2002 14:26:56 -0400 Date: Thu, 12 Sep 2002 12:30:53 -0600 (MDT) From: Thunder from the hill X-X-Sender: thunder@hawkeye.luckynet.adm To: Giuliano Pochini cc: Jim Sibley , Troy Reed , , , Subject: RE: Killing/balancing processes when overcommited In-Reply-To: Message-ID: X-Location: Dorndorf/Steudnitz; Germany MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org 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 -- --./../...-/. -.--/---/..-/.-./..././.-../..-. .---/..-/.../- .- --/../-./..-/-/./--..-- ../.----./.-../.-.. --./../...-/. -.--/---/..- .- -/---/--/---/.-./.-./---/.--/.-.-.- --./.-/-.../.-./.././.-../.-.-.-