From owner-freebsd-hackers@freebsd.org Fri Dec 8 17:27:44 2017 Return-Path: Delivered-To: freebsd-hackers@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id EA702E89522 for ; Fri, 8 Dec 2017 17:27:44 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-it0-x22e.google.com (mail-it0-x22e.google.com [IPv6:2607:f8b0:4001:c0b::22e]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id B364D7B5BC for ; Fri, 8 Dec 2017 17:27:44 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-it0-x22e.google.com with SMTP id z6so6360708iti.4 for ; Fri, 08 Dec 2017 09:27:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20150623.gappssmtp.com; s=20150623; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=sw/hcGltL4+hNfGTjfHRtURGvOv0oCNGh2WXvQnkX0I=; b=zz7378t1CdImMliKYFHKTACxvJQ78cy/ofc72UcvjRdz6QvfIwWeSw3XlI6a/GgOwW APxC8oYmkiiYZxDyo8SAQFjaqXD1Z5U+zHyLdIJ5xss5naowNIZluJ7MF6ZmeZnpEoeA KWEobhWMkvIVJaEl6eQaqMHIrTBD3S4v7Tk42xzGWuijT9iSbpjtoS9GcNxKr/c4Jgob jxoXgcEWNsKtqcYqw9L80VIcJxqrrrY6fP1UHtVHWeUvMTPNBOd0MXO08+KPCGMtb/LQ BuRSIMk9hslmTH7nyL2znKvLCGqPSQ7Vgru20bDjjO1NrCyXSA9IdNQXkKSmYyfHhChJ im/Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=sw/hcGltL4+hNfGTjfHRtURGvOv0oCNGh2WXvQnkX0I=; b=GLcKI0+5LJde0kPC6643VM2RK/xYCPqoRox7/yifMdXc8uWkQV/2dXWTreK/ogWsZq 5wUjJWoUAdFTDuMhZygEAPnnXdfhTiArUYDkldG/GeTi0iymFxXMyDsssHK3JCPEQ++Z FwvUbREuqEWEyzWgOFQtI58KJ47iuZ7A0QnO26QJszRTc3pVmOvsFOyAQzEBbIXSd/yF 0VPPJj4qFt4kkOrXjpD6+n93wRbDfz7UANXqhjW2mcJHvHrN4NR5a4LK3260JN1zPUGP RI2s7Cez4Acm454pvAuKjB2O5dZcuaTHZLBzfB8ZfnVIhzTwdd9MshEFaaAB+7n1gvnN pntQ== X-Gm-Message-State: AKGB3mKqxUX2vl6MgZ3yMenrgGNxLViujZdC5XCFMfKi3JweRgaGhqQw Onb5vMMt8lrKk+BiCTly9Gf2JU1/AFEfaHw/+0L19Z02 X-Google-Smtp-Source: AGs4zMYRiKQkX2DONZyti9K5z7Y/pD4SG4n0QTFhZZOAfxdadb9mK+MLEpIi++vdMgu7JD5RoQ9BOoBLg8XsWRP/8vo= X-Received: by 10.36.131.200 with SMTP id d191mr7048776ite.97.1512754063540; Fri, 08 Dec 2017 09:27:43 -0800 (PST) MIME-Version: 1.0 Sender: wlosh@bsdimp.com Received: by 10.79.108.204 with HTTP; Fri, 8 Dec 2017 09:27:42 -0800 (PST) X-Originating-IP: [2603:300b:6:5100:1052:acc7:f9de:2b6d] In-Reply-To: <20171208150333.GI16028@mcvoy.com> References: <20171208011430.GA16016@mcvoy.com> <20171208101658.GD2272@kib.kiev.ua> <20171208150333.GI16028@mcvoy.com> From: Warner Losh Date: Fri, 8 Dec 2017 10:27:42 -0700 X-Google-Sender-Auth: 8Xkzva9TL4tLwELPdBpaTk9iRf4 Message-ID: Subject: Re: OOM problem? To: Larry McVoy Cc: Konstantin Belousov , "freebsd-hackers@freebsd.org" , Johannes Lundberg Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.25 X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Dec 2017 17:27:45 -0000 On Fri, Dec 8, 2017 at 8:03 AM, Larry McVoy wrote: > On Fri, Dec 08, 2017 at 12:16:58PM +0200, Konstantin Belousov wrote: > > On Fri, Dec 08, 2017 at 08:18:21AM +0000, Johannes Lundberg wrote: > > > Regarding potential oom overhaul. Personally I like the idea of an oom > > > signal. The idea comes from iOS where applications get a callback when > > > system memory is low and they're given a chance to free unused > > > resources or resources that can easily be recreated, before getting > > > killed completely. > > The OOM signal is a topic which was discussed to death many times before. > > The summary is that it does not work, because you need to provide pages > > for userspace to be able to handle the signal. > > Just for the record, what I was proposing wasn't as ambitious as what > Johannes suggested (while I like his idea it's "weird" and it's unlikely > that Firefox et al would use it unless we got Linux to have the same > thing). > > I was just suggesting that processes sleeping in vm_wait() wake up once > in a while to respect signals, as in, if I kill -9 that process I want it > to go away. Currently, it doesn't. AIX had SIGDANGER that would be sent when pages were getting scarce. There were still pages to be had in the system, just not many, and the idea was when you got tight on, but not out of, memory, you'd signal all the programs in the system to give them a chance to return pages to the OS they were done with. I don't recall all the details, but AIX's syslog-ish thing would create an error log when that happened. Some programs would flush all or part of their cache, etc. It worked fairly well (in that the signal was delivered), but did depend on the cooperation of the running processes not to do something stupid. https://www.ibm.com/support/knowledgecenter/en/ssw_aix_72/com.ibm.aix.osdevice/page_space_trouble.htm has a minimalistic description. Not that I'm advocating it, per se, but there is historical precedent for this feature. Warner