From owner-freebsd-hackers@freebsd.org Sun Nov 18 00:13:23 2018 Return-Path: Delivered-To: freebsd-hackers@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1645C110C447 for ; Sun, 18 Nov 2018 00:13:23 +0000 (UTC) (envelope-from markjdb@gmail.com) Received: from mail-io1-xd41.google.com (mail-io1-xd41.google.com [IPv6:2607:f8b0:4864:20::d41]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4F57F8834F; Sun, 18 Nov 2018 00:13:22 +0000 (UTC) (envelope-from markjdb@gmail.com) Received: by mail-io1-xd41.google.com with SMTP id f12-v6so19823278iog.0; Sat, 17 Nov 2018 16:13:22 -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:content-transfer-encoding:in-reply-to :user-agent; bh=Jym2OMjb0O+7D4t4j5vD2uyzkE/fGqxs4ZhFuqxOTbI=; b=EjhafZRpLZ1ULayOBeXe81XhlAuoEP3ELO0lIhPIaTQENrEBzbyC0oeHnDzwX/TfHe C4v1nUs38I37d0T4BXwSoezJCk3VhRve2pJCa8LoAbOOmIpUBXwgTWiRfGgjsr65Aekp OC/nv0qy+jOk8x5Q9Go6+KTbuVNzI/v4ldI35ZqZScBF92dbtc//2J5OZPqDMCxWxT0h f60ZZHmKs8/yh4HH0e5RL4f7fLX1LE2lrg3LxV3BPQWtOHU+wl/qqUQI2RbOxO8e49wl kZ7LqZ8ruPAfjAoYBtrkxoAHmUZNU6EXP2yY5EwoO971qkguN2sraNCi8sM/hwjC4BDy bj4w== 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 :content-transfer-encoding:in-reply-to:user-agent; bh=Jym2OMjb0O+7D4t4j5vD2uyzkE/fGqxs4ZhFuqxOTbI=; b=aiuvXDl+81q0SKad1swJPTXXEruS0Ytt0FQ9m6oEmoBacdeIpnhvda1tXCYpkSgeL1 YGhcFavgPT/yANxg0FDqfbsblNoeD08B2mj91BssMO+MyIzZtFKRvN0k3pECO8bm6SRV NNOMDQegRBjxXhmr1NAv0mp2w7ryrG/5/9XzEeC2Ya2OfVDsOfnnjriLrAa64b5Lvs5k wCO1X+BxhZFPoSX+e1oE+jowvRRiCX0GyjOVPW5v394Ngh+OiD4VusfUrFpX/vZeMJc/ QSMfdg7sQd1bUBLqMQ9z/1xvzj1bCVfRyUJBYQo9jM5SuFyPCxl5EAkJY3fchhE7pgit j8Hg== X-Gm-Message-State: AGRZ1gKNWbSbblmp611yZGCFEgn+dFJHItffpW4dnuni1cl8YBomNJBI wqKQYzul8LBDHA6lJUWZcvVVIqV7bQM= X-Google-Smtp-Source: AJdET5fIya1ejygqD7TIJXGQ2JPDlO9bA64y+4AaOqgFhkSpVHEMolnus+ei1R3BrQYqVT+2R0Us7g== X-Received: by 2002:a6b:c082:: with SMTP id q124-v6mr13546618iof.25.1542500001378; Sat, 17 Nov 2018 16:13:21 -0800 (PST) Received: from raichu (toroon0560w-lp130-07-64-229-95-98.dsl.bell.ca. [64.229.95.98]) by smtp.gmail.com with ESMTPSA id t6sm6341558ioc.87.2018.11.17.16.13.20 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sat, 17 Nov 2018 16:13:20 -0800 (PST) Sender: Mark Johnston Date: Sat, 17 Nov 2018 19:13:18 -0500 From: Mark Johnston To: Ian Lepore Cc: Wojciech Puchar , Rebecca Cran , freebsd-hackers Hackers Subject: Re: 13-CURRENT: several GB swap being used despite plenty of free RAM Message-ID: <20181118001318.GB2799@raichu> References: <1748688.u6MfGjpqfb@photon.int.bluestop.org> <1542499188.56571.59.camel@freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <1542499188.56571.59.camel@freebsd.org> User-Agent: Mutt/1.10.1 (2018-07-13) X-Rspamd-Queue-Id: 4F57F8834F X-Spamd-Result: default: False [-1.29 / 15.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; R_DKIM_ALLOW(-0.20)[gmail.com]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; R_SPF_ALLOW(-0.20)[+ip6:2607:f8b0:4000::/36]; MIME_GOOD(-0.10)[text/plain]; RCVD_TLS_LAST(0.00)[]; DMARC_NA(0.00)[freebsd.org]; RCVD_COUNT_THREE(0.00)[3]; TO_MATCH_ENVRCPT_SOME(0.00)[]; TO_DN_ALL(0.00)[]; DKIM_TRACE(0.00)[gmail.com:+]; MX_GOOD(-0.01)[cached: alt3.gmail-smtp-in.l.google.com]; RCVD_IN_DNSWL_NONE(0.00)[1.4.d.0.0.0.0.0.0.0.0.0.0.0.0.0.0.2.0.0.4.6.8.4.0.b.8.f.7.0.6.2.list.dnswl.org : 127.0.5.0]; NEURAL_HAM_SHORT(-0.94)[-0.939,0]; IP_SCORE(-0.64)[ip: (1.26), ipnet: 2607:f8b0::/32(-2.61), asn: 15169(-1.77), country: US(-0.10)]; FORGED_SENDER(0.30)[markj@freebsd.org,markjdb@gmail.com]; MID_RHS_NOT_FQDN(0.50)[]; FREEMAIL_ENVFROM(0.00)[gmail.com]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; FROM_NEQ_ENVFROM(0.00)[markj@freebsd.org,markjdb@gmail.com] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Nov 2018 00:13:23 -0000 On Sat, Nov 17, 2018 at 04:59:48PM -0700, Ian Lepore wrote: > On Sat, 2018-11-17 at 22:52 +0100, Wojciech Puchar wrote: > > freebsd will not swap with that lots of free ram. > > but it's 90GB free NOW, how about before? > > > > Your information is outdated. For at least a couple years now (since > approximately the 10.1 - 10.2 timeframe is my vague estimate), freebsd > will page out application memory that hasn't been referenced for some > time, even when the system has no shortage of free memory at all. No, FreeBSD will only ever swap when there is a free page shortage. The difference is that we now slowly age unreferenced pages into the inactive queue, which makes them candidates for pageout and subsequent eviction. With pageout_update_period=0, anonymous memory won't get paged out unless there's a shortage of inactive pages, or an application calls madvise(MADV_DONTNEED) on a range of memory (which moves any backing pages to the inactive queue). > The advice I was recently given to revert to the old behavior is: > >   sysctl vm.pageout_update_period=0 > > I've been using it on a couple systems here for a few days now, and so > far results are promising, I am no longer seeing gratuitous swapfile > usage on systems that have so much free physical ram that they should > never need to page anything out. I haven't yet pushed one of those > systems hard enough to check what happens when they do need to start > proactively paging out inactive memory due to shortages -- it could be > that turning off the new behavior has downsides for some workloads.