From owner-freebsd-arch@freebsd.org Thu Nov 30 21:01:36 2017 Return-Path: Delivered-To: freebsd-arch@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 827F8DBA4E7 for ; Thu, 30 Nov 2017 21:01:36 +0000 (UTC) (envelope-from markjdb@gmail.com) Received: from mail-it0-x233.google.com (mail-it0-x233.google.com [IPv6:2607:f8b0:4001:c0b::233]) (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 45B7F75795 for ; Thu, 30 Nov 2017 21:01:36 +0000 (UTC) (envelope-from markjdb@gmail.com) Received: by mail-it0-x233.google.com with SMTP id z6so61312iti.4 for ; Thu, 30 Nov 2017 13:01:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=mvvJj/29SSZUubjoLANuyFG9KwcbA44Kd4oh6y2mqys=; b=QwFNzyWInxmP1qhgNF/w8L94Fg8U/6VVuquV1qr9UIIakpZiuDR2RwYEs+SIwvURyv u8UovgkR7OK0jaGAPbAqzDmXWIZoXwaeTBf0HbBH55tFtCUazWxj6bvU51gAg157QBf2 MUF79ecQKl2Eznp9vhwPHrJiSQsUdoWH+v7XiPkhS1Ta4M1dXUh0O6fH5ZaZTiIaIluc TDitRFkCJXvKeHa6Fr/mhzjvoR1GZ7dDOS2TIwv488uqfJV+HKHxT/XM0MwwyzFZykDE pwOIznjU64WqrvlMw7o8t2FOL6sFYbOiGv4+vmBO4h2q6J5Oc8zLZ6bVO9/GgTjdZVBq 8RhA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :references:mime-version:content-disposition:in-reply-to:user-agent; bh=mvvJj/29SSZUubjoLANuyFG9KwcbA44Kd4oh6y2mqys=; b=g2Ks+ftd7yZFwIczFHlu5vz3wl1RRlbuV8tmzLlI6QI2w0X1oi7C4JhBYEHOHAWRAk zF5H8z+YiN0CumV6MoFHW9WsSPv3w8dNMHKRg0PvBoy2APUtPaLGnkCX9FSu9lfmiWX9 Yhcf66dcEbZhoewkPVgt4OujZ15jyYlpV0ddIT7/sRqLwhzypHMKSV+/90b3b3F/PA6I IBMZSQuPMauS2cLRmym6XcbleZqzvI93uyyiK4QszF3Kj2piUf/g6k9slYHhxIYdQBgW 8UcwyeOWPwXGxLsG9ojzFmJuPFRSMGJ1bIVXyAeNJ6hm7YMEQKSLgiEYHN+QY68zLNLr OEvQ== X-Gm-Message-State: AJaThX6AbrrpmYKir8edOglSu3bdMU/+njImRCUsQJzueNJNGLUQoNgn sKjpSFzZ78IAvY2eV+QFIsg= X-Google-Smtp-Source: AGs4zMYJuz+mDVYMFAocpAB4NAeDFeqED1s0gIUWfNwbrp1sfrUfy1CkXM0S/wNEpfqlSqTtT+3KVg== X-Received: by 10.36.222.68 with SMTP id d65mr5328624itg.67.1512075695491; Thu, 30 Nov 2017 13:01:35 -0800 (PST) Received: from raichu (toroon0560w-lp140-01-69-159-38-22.dsl.bell.ca. [69.159.38.22]) by smtp.gmail.com with ESMTPSA id 23sm2728358itj.15.2017.11.30.13.01.33 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 30 Nov 2017 13:01:34 -0800 (PST) Sender: Mark Johnston Date: Thu, 30 Nov 2017 16:01:31 -0500 From: Mark Johnston To: Larry McVoy Cc: Warner Losh , Scott Long , Kevin Bowling , Drew Gallatin , "freebsd-arch@freebsd.org" Subject: Re: small patch for pageout. Comments? Message-ID: <20171130210131.GC21606@raichu> References: <20171130173424.GA811@mcvoy.com> <20171130184923.GA30262@mcvoy.com> <20171130204750.GB21606@raichu> <20171130205041.GA3924@mcvoy.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20171130205041.GA3924@mcvoy.com> User-Agent: Mutt/1.9.1 (2017-09-22) X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Nov 2017 21:01:36 -0000 On Thu, Nov 30, 2017 at 12:50:41PM -0800, Larry McVoy wrote: > On Thu, Nov 30, 2017 at 03:47:50PM -0500, Mark Johnston wrote: > > > I dunno if there is a "right amount". I could make it a little smarter by > > > keeping track of how many pages we freed and sleep if we freed none in a > > > scan (which seems really unlikely). > > > > This situation can happen if the inactive queue is full of dirty pages. > > A problem with your patch is that we might not give enough time to the > > laundry thread (the thread responsible for writing the contents of dirty > > pages to disk and returning them to inactive queue for the page daemon > > to free) to write out dirty pages. In this case we might trigger the OOM > > killer prematurely, and in fact this scenario is what motivated r300865. > > So I would argue that we do in fact need to sleep if the page daemon is > > failing to make progress, in order to give time for I/O to complete. > > OK, that sounds reasonable. So what defines progress? v_dfree not > increasing? Is one page freed progress? One page freed is progress. We currently invoke the OOM killer only when the page daemon is making no progress. This turns out to be too conservative, which is what kib's patch attempts to address. wrt your patch, I'm saying that I think we should still sleep after a scan that failed to free any pages.