From owner-freebsd-current@freebsd.org Mon Mar 14 01:30:29 2016 Return-Path: Delivered-To: freebsd-current@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 EEDE8ACFF90 for ; Mon, 14 Mar 2016 01:30:29 +0000 (UTC) (envelope-from markjdb@gmail.com) Received: from mailman.ysv.freebsd.org (mailman.ysv.freebsd.org [IPv6:2001:1900:2254:206a::50:5]) by mx1.freebsd.org (Postfix) with ESMTP id CF1B5D26 for ; Mon, 14 Mar 2016 01:30:29 +0000 (UTC) (envelope-from markjdb@gmail.com) Received: by mailman.ysv.freebsd.org (Postfix) id CABEAACFF8F; Mon, 14 Mar 2016 01:30:29 +0000 (UTC) Delivered-To: current@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 AE132ACFF8E for ; Mon, 14 Mar 2016 01:30:29 +0000 (UTC) (envelope-from markjdb@gmail.com) Received: from mail-pa0-x22f.google.com (mail-pa0-x22f.google.com [IPv6:2607:f8b0:400e:c03::22f]) (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 79557D25 for ; Mon, 14 Mar 2016 01:30:29 +0000 (UTC) (envelope-from markjdb@gmail.com) Received: by mail-pa0-x22f.google.com with SMTP id td3so117785372pab.2 for ; Sun, 13 Mar 2016 18:30:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=tiGsl638ZU9ht3gdFjgU1zZjO9s6cXRO2IEfEMu4toQ=; b=WuWBXJRZmjP/eFYqZBOzTVT2V3uTXjAlnZAh+USzcFSvHcWdJf7cGlzlq16oXeybN8 z5aCS1pccSESi7zCU5bf5ucf9Ag9zJuO3+s23fa8KP83WV2hQT97RzevlaI8IOMsDXRz I3BtlUv0lIAbnTli2tlIBG+MsUrmerzRZMEhRf7gQujwmXh6GVnD+cPgKj3yM3I7G0bU iFGCFVlu/DAK/+GOyBnfaMdoopbcitKUHpRPVSoU/SY5TbbG3r6oJB9S7N0nA3NtR0LL qCCzeErjGoV7whygv4HLgkJFWXohB34HZAWylO1cJgzU1x3twyY9Gy694aEOrd1Sf4bT wGhw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :references:mime-version:content-disposition:in-reply-to:user-agent; bh=tiGsl638ZU9ht3gdFjgU1zZjO9s6cXRO2IEfEMu4toQ=; b=lXJk6vQiNMFuLrwRbHcQOVjCBwWSsVRqcL67v0nQKSYovUzLKMZ51NYiVHolefmwJN LK27wHdiNL7xJP/SbxnrmnDz6gXjJ4YbG/50TgPtB1W7iswRN2WJqlZrZWYzqW3SkHGq Ko7wsGefTXNyuZrkiMRo9dUMGNfME/8qgYg/BN3CMqNFr9HzKekferV+WDHu5idUgDzy CX8srRdNg71wdfkh+sqn4+ohyoouNApVmeSLPTVejRYr7uFzcYJSiIObWyLqacu7+KVw hA9Kul2M7YuCwXn68evciZGB6lANvtChRIxRxN10R+8KiEvmAkLwx8ja7pwwuhfnZJT2 U8tA== X-Gm-Message-State: AD7BkJL5Bji8V1qBS+xN5IPgIH3aUPSuEIYTuw7HE3aQ31JpwXUoBIQ0RuiKdjMhH0L11A== X-Received: by 10.66.253.169 with SMTP id ab9mr34749744pad.62.1457919028902; Sun, 13 Mar 2016 18:30:28 -0700 (PDT) Received: from wkstn-mjohnston.west.isilon.com (c-67-182-131-225.hsd1.wa.comcast.net. [67.182.131.225]) by smtp.gmail.com with ESMTPSA id yh5sm27621344pab.13.2016.03.13.18.30.27 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 13 Mar 2016 18:30:28 -0700 (PDT) Sender: Mark Johnston Date: Sun, 13 Mar 2016 18:33:20 -0700 From: Mark Johnston To: Gary Jennejohn Cc: current@freebsd.org Subject: Re: how to recycle Inact memory more aggressively? Message-ID: <20160314013319.GA68039@wkstn-mjohnston.west.isilon.com> References: <20160312093835.727d7197@ernst.home> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20160312093835.727d7197@ernst.home> User-Agent: Mutt/1.5.24 (2015-08-30) X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 14 Mar 2016 01:30:30 -0000 On Sat, Mar 12, 2016 at 09:38:35AM +0100, Gary Jennejohn wrote: > In the course of the last year or so the behavior of the vm system > has changed in regard to how aggressively Inact memory is recycled. > > My box has 8GB of memory. At the moment I'm copying 100s of gigabytes > from one file system to another one. How exactly are you copying them? How large are the files you're copying? Which filesystems are in use? > > Looking at top I observe that there are about 6GB of Inact memory. > This value hardly changes. Instead of aggressively recycling the > Inact memory the vm now seems to prefer to swap. The VM will swap a small number of dirty pages as it encounters them during inactive queue scans. If the system is swapping more than it used to, it's presumably because the pagedaemon is encountering more dirty pages in the inactive queue than it used to. This could simply be the result of external factors (e.g., the applications you're running are generating more dirty pages than they were a year ago for some reason). On the other hand, some of the changes to remove object page cache uses could cause this: cache pages would be reused in preference to inactive pages, so if pages that were previously cached are now being enqueued at the end of the inactive queue, I'd expect to see more swapping than before. For example, with r281079+r286255, we deactivate pages that precede a faulted page rather than caching them. I think this would result in more churn of the inactive queue, which could lead to increased swap usage. cp(1), for instance, will mmap small source files, so the above-mentioned changes might be relevant if you're copying many small files that aren't already resident in memory. But I think you need to be more specific about your setup. > > Last year, can't rmember excatly when, the behavior was totally > different. The vm very aggessively recycled Inact memory and, > even when copying 100s of GB of files, the system hardly swapped. > > It seems rather strange to me that the vm happily allows gigbytes > of Inact memory to be present and prefers swapping to recyclincg.