From owner-freebsd-questions@FreeBSD.ORG Tue Sep 13 07:16:06 2005 Return-Path: X-Original-To: freebsd-questions@freebsd.org Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 6CD6F16A41F for ; Tue, 13 Sep 2005 07:16:06 +0000 (GMT) (envelope-from martinh@servicefactory.se) Received: from ark.servicefactory.se (ark.servicefactory.se [217.13.255.29]) by mx1.FreeBSD.org (Postfix) with ESMTP id D0FCA43D46 for ; Tue, 13 Sep 2005 07:16:05 +0000 (GMT) (envelope-from martinh@servicefactory.se) Received: from [127.0.0.1] (ark.servicefactory.se [217.13.255.29]) by ark.servicefactory.se (8.12.11/8.12.10) with ESMTP id j8D7GKVw034252 for ; Tue, 13 Sep 2005 09:16:21 +0200 (CEST) (envelope-from martinh@servicefactory.se) Mime-Version: 1.0 (Apple Message framework v622) Content-Transfer-Encoding: 7bit Message-Id: <0fba7a7ededb5920029abeea87308d2c@servicefactory.se> Content-Type: text/plain; charset=US-ASCII; format=flowed To: freebsd-questions@freebsd.org From: Martin Hedenfalk Date: Tue, 13 Sep 2005 09:16:01 +0200 X-Mailer: Apple Mail (2.622) Subject: Swapless system: processes killed in favor of disk cache? X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 13 Sep 2005 07:16:06 -0000 Hello list, We're running a swapless FreeBSD 4.10 system. Although we do have a disk in this particular system, it is currently not used as swap. The problem we're experiencing is that when storing a large file on the disk, a lot of memory is used (same as the size of the file). This leads to random processes being killed with an "out of swap space" message. Running top when dd'ing 30 MiB from /dev/zero to a file on disk shows free memory dropping 30 MiB, and Inact and Wired combined increasing for the same amount. I was able to change this behaviour by opening the file with the O_DIRECT flag. But this only fixes one problem in one particular application, and I'd like to understand what is actually going on. So, is all this memory used for disk cache? If so, why is it not invalidated when a process wants to allocate memory? Are there any sysctl's that controls this behaviour? I've tried setting vm.swap_enabled=0, vm.defer_swapspace_pageouts=1, and vm.disable_swapspace_pageouts=1. Thanks in advance Martin Hedenfalk