From owner-freebsd-stable@FreeBSD.ORG Thu Apr 30 13:51:05 2015 Return-Path: Delivered-To: freebsd-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id B7AE8D56 for ; Thu, 30 Apr 2015 13:51:05 +0000 (UTC) Received: from be-well.ilk.org (be-well.ilk.org [23.30.133.173]) by mx1.freebsd.org (Postfix) with ESMTP id 915831BFB for ; Thu, 30 Apr 2015 13:51:05 +0000 (UTC) Received: by be-well.ilk.org (Postfix, from userid 1147) id 4EFBC33C24; Thu, 30 Apr 2015 09:51:04 -0400 (EDT) From: Lowell Gilbert To: "David Magda" Cc: freebsd-stable@freebsd.org Subject: Re: protecting some processes from out-of-swap killer References: <20150425104336.GD13141@ivaldir.etoilebsd.net> <61abe503a5bc8550e1413fd1933bea62.squirrel@webmail.ee.ryerson.ca> Reply-To: freebsd-stable@freebsd.org Date: Thu, 30 Apr 2015 09:51:04 -0400 In-Reply-To: <61abe503a5bc8550e1413fd1933bea62.squirrel@webmail.ee.ryerson.ca> (David Magda's message of "Wed, 29 Apr 2015 13:09:05 -0400") Message-ID: <44iocdpvw7.fsf@be-well.ilk.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (berkeley-unix) MIME-Version: 1.0 Content-Type: text/plain X-BeenThere: freebsd-stable@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: Production branch of FreeBSD source code List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Apr 2015 13:51:05 -0000 "David Magda" writes: > On Tue, April 28, 2015 05:51, Ronald Klop wrote: > >> The OS trying to kill a process is probably not what you want. So when you >> protect(1) postgres the OS will kill another process, which I hope is not >> running without reason. >> My advice would be to >> - or increase your swap space >> - or tune postgresql to use less memory >> - or limit tmpfs (tmpfs uses swap if RAM is short) >> - or tune zfs to use less memory > > Personally I didn't even know FreeBSD had an OOM killer. I regularly run > into Linux's though, but that's because by default Linux allows > over-committing of memory. > > I was under the impression that FreeBSD did not over-subscribe memory, and > so would not allow a process to do a malloc() unless there was enough > RAM+swap to satisfy it. > > Is this a mistaken assumption? (I probably have to buy the McKusick, > Neville-Neil, Watson book.) Yes, that is a mistaken assumption; any system that supports fork(2) pretty much has to do memory overcommit or make terribly inefficient use of its memory. Overcommit is irrelevant to your problem, though. You have processes that are using more virtual memory than the system has.