From owner-freebsd-current@FreeBSD.ORG Fri Jan 4 15:08:20 2008 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id F125E16A419 for ; Fri, 4 Jan 2008 15:08:20 +0000 (UTC) (envelope-from vadimnuclight@tpu.ru) Received: from relay1.tpu.ru (relay1.tpu.ru [213.183.112.102]) by mx1.freebsd.org (Postfix) with ESMTP id 40C5A13C478 for ; Fri, 4 Jan 2008 15:08:20 +0000 (UTC) (envelope-from vadimnuclight@tpu.ru) Received: from localhost (localhost.localdomain [127.0.0.1]) by relay1.tpu.ru (Postfix) with ESMTP id 9FE11104677 for ; Fri, 4 Jan 2008 21:08:18 +0600 (NOVT) X-Virus-Scanned: amavisd-new at tpu.ru Received: from relay1.tpu.ru ([127.0.0.1]) by localhost (relay1.tpu.ru [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Lb93gKFq3U3n for ; Fri, 4 Jan 2008 21:08:15 +0600 (NOVT) Received: from mail.main.tpu.ru (mail.main.tpu.ru [10.0.0.3]) by relay1.tpu.ru (Postfix) with ESMTP id B5C5A104669 for ; Fri, 4 Jan 2008 21:08:15 +0600 (NOVT) Received: from mail.tpu.ru ([213.183.112.105]) by mail.main.tpu.ru with Microsoft SMTPSVC(6.0.3790.3959); Fri, 4 Jan 2008 21:08:15 +0600 Received: from nuclight.avtf.net ([78.140.2.250]) by mail.tpu.ru over TLS secured channel with Microsoft SMTPSVC(6.0.3790.3959); Fri, 4 Jan 2008 21:08:14 +0600 Date: Fri, 04 Jan 2008 21:08:12 +0600 To: "freebsd-current@freebsd.org" From: "Vadim Goncharov" Organization: AVTF TPU Hostel Content-Type: text/plain; format=flowed; delsp=yes; charset=koi8-r MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Message-ID: User-Agent: Opera M2/7.54 (Win32, build 3865) X-OriginalArrivalTime: 04 Jan 2008 15:08:15.0715 (UTC) FILETIME=[A1AE3330:01C84EE3] X-Mailman-Approved-At: Fri, 04 Jan 2008 15:16:43 +0000 Subject: sbrk(2), OOM-killer and malloc() overcommit X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 04 Jan 2008 15:08:21 -0000 Hi, There were talks in 'sbrk(2) broken' thread about memory hogs which can easily eat all available VM despite of resources. That'smust be fixed or it will make a bad reputation for FreeBSD as a server platform. But there are related "bug", in that of malloc overcommit, which can be demonstrated by this short program (if no resource limits are present, you'll see): #include /* http://alter.tomsk.ru/bugs/head/ */ /* (C) Vladimir */ /* alter at alter tom ru */ int main(int argc, char **argv){ #define MB 1048576 const size_t step = MB; size_t size = (size_t) 4095 * MB; char *p; printf("%s $Rev: 54 $\n", argv[0]); printf("start size = %u MiB, step = %uMiB\n", size / MB, step / MB); for(;size;){ p = (char *)malloc(size); if(p){ printf("allocated %u MiB\n", size / MB); puts("calling bzero()..."); puts("NEXT MESSAGE SHOULD BE \"*** OK ***\", ELSE - THERE IS BUG IN A KERNEL"); bzero(p, size); puts("*** OK *** Seems this OS doesn't contain the bug!"); return(0); } else { size -= step; } } return(0); } There are people with long-running data-mining big processes that blame FreeBSD for being "not serious for serious server tasks" due to this bug, because other systems allow for some kind of memory reserving from additional files or other overcommit tuning (Linux has overcommit probability reducing tunable, which is enough for most such tasks). I know there exists a patch (which was again mentioned in thread), http://people.freebsd.org/~kib/overcommit/index.html - but it has never gone into src tree. So why we still have this problem, why not have at least this patch?.. -- WBR, Vadim Goncharov