From owner-freebsd-hackers@freebsd.org Wed Oct 4 06:12:33 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 D1CF0E2F81C for ; Wed, 4 Oct 2017 06:12:33 +0000 (UTC) (envelope-from kostikbel@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 B8D5D73491 for ; Wed, 4 Oct 2017 06:12:33 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: by mailman.ysv.freebsd.org (Postfix) id B7FAAE2F81B; Wed, 4 Oct 2017 06:12:33 +0000 (UTC) Delivered-To: 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 B7607E2F81A for ; Wed, 4 Oct 2017 06:12:33 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 34EE773490; Wed, 4 Oct 2017 06:12:33 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from tom.home (kib@localhost [127.0.0.1]) by kib.kiev.ua (8.15.2/8.15.2) with ESMTPS id v946CR4r004353 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Wed, 4 Oct 2017 09:12:27 +0300 (EEST) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua v946CR4r004353 Received: (from kostik@localhost) by tom.home (8.15.2/8.15.2/Submit) id v946CQ3S004351; Wed, 4 Oct 2017 09:12:26 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Wed, 4 Oct 2017 09:12:26 +0300 From: Konstantin Belousov To: Don Lewis Cc: mwlucas@michaelwlucas.com, hackers@freebsd.org Subject: Re: vmstat's w column Message-ID: <20171004061226.GA95911@kib.kiev.ua> References: <20171003202150.GA42540@mail.michaelwlucas.com> <201710032157.v93LvSjD040775@gw.catspoiler.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201710032157.v93LvSjD040775@gw.catspoiler.org> User-Agent: Mutt/1.9.1 (2017-09-22) X-Spam-Status: No, score=-2.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FREEMAIL_FROM,NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.1 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on tom.home X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Oct 2017 06:12:33 -0000 On Tue, Oct 03, 2017 at 02:57:28PM -0700, Don Lewis wrote: > On 3 Oct, Michael W. Lucas wrote: > > Hi, > > > > (This query brought to you courtesy of tech reviews on my new freeBSD > > book.) > > > > On my -current box, vmstat(8) says: > > > > procs Information about the numbers of processes in various states. > > > > r in run queue > > b blocked for resources (i/o, paging, etc.) > > w runnable or short sleeper (< 20 secs) but swapped > > > > I've had a couple people report to me that they have w entries even > > when only a few kilobytes are swapped out. > > > > Is the man page wrong? Or should I tell them to report that output as > > a bug? > > I don't know about the runnable or short sleeper bit. On currently idle > package build box vmstat currently reports 15 processes in the w column. > If I look at the output of ps, there are 15 processes with a state of > either IW or TW, all of which have a RSS of zero. These have probably > all been idle since before the end of the last poudriere run, which is a > very heavy swap user. There are no processes in an RW or SW state. It > looks like vmstat is reporting all swapped processes, so the man page > and implementation appear to be out of sync, at least on recent > 12.0-CURRENT. My other two currently running FreeBSD boxes don't have > any swapped processes reported by either ps or vmstat. Present definition of 'swapped out' is a process for which all threads have their kernel stacks swapped out. Swapper does not perform any efforts to swap out userspace memory of the process. The reasoning is perhaps that normal pagedaemon processing would inactivate/page out the unreferenced pages on busy system, and swapping the kernel stacks never occurs if pagedaemon can keep with the memory demand without such drastic measures. In other words, RSS == 0 is neither necessary nor sufficient to conclude that a process is swapped out.