From owner-freebsd-current@freebsd.org Thu Apr 5 02:03:56 2018 Return-Path: Delivered-To: freebsd-current@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 18BD3F89EE3 for ; Thu, 5 Apr 2018 02:03:56 +0000 (UTC) (envelope-from marklmi26-fbsd@yahoo.com) Received: from sonic303-2.consmr.mail.bf2.yahoo.com (sonic303-2.consmr.mail.bf2.yahoo.com [74.6.131.41]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B17DF80396 for ; Thu, 5 Apr 2018 02:03:55 +0000 (UTC) (envelope-from marklmi26-fbsd@yahoo.com) X-YMail-OSG: RDah654VM1mG.rSyk_VxuloTp_uki6IzZYbogWMfqrXpyEkDMrhe5cvXfHSE7lf 5qz5y0wJqxW5B8XMJ1leRlMghmSttiZ0Zq7IWMVEOST56ZKaRduLXRtGmcqU0JC6uJ8KbvHP72S7 MW_aEuA4E.R2MK6e8JhnA4kr1iZZ7LpT5eBdG4Oy3wMBy7ykEdAfcYEBEIXfmA8cBoyhgKESQdiM bA3NFOYx5FF_J8up_1zY4Kclh8agZU5vRwq2CSwnTrM34ZAzksEELGwAkFx2tjUdQj79kYOeSLfl lDt1vkv8PYE2OP0EapPxfQs.l5dBFIDX6YNPjIZbSwkUgZUU4P4ZGciiJD6rnhpzOBBePn._Q6IV tuK2sC4erfyXUuNtzETT4PdkRvoy87O2jQX4hPkOcTSMlix_VgzkGVCE7.NH44TMjOpS50c7PU1q 1u5VC5hfainNgK8YK6uinIA3hNd5zNzTIog.TtskUvbuNF6_Il.Y8dMWqnEp4aPcAUHgB6Y0IrsJ g.Ks2WInUSIL6wquPXlNQbUJrY89kjQcQRV3x Received: from sonic.gate.mail.ne1.yahoo.com by sonic303.consmr.mail.bf2.yahoo.com with HTTP; Thu, 5 Apr 2018 02:03:49 +0000 Received: from c-76-115-7-162.hsd1.or.comcast.net (EHLO [192.168.1.25]) ([76.115.7.162]) by smtp426.mail.bf1.yahoo.com (Oath Hermes SMTP Server) with ESMTPA ID 80ef4856253093b6a58029cc12d03959; Thu, 05 Apr 2018 02:03:45 +0000 (UTC) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 11.3 \(3445.6.18\)) Subject: Re: Strange ARC/Swap/CPU on yesterday's -CURRENT From: Mark Millard In-Reply-To: <1b31e36e-e84b-cc63-1422-d1e0ce2f03c8@FreeBSD.org> Date: Wed, 4 Apr 2018 19:03:43 -0700 Cc: freebsd-current@freebsd.org Content-Transfer-Encoding: quoted-printable Message-Id: References: <20180317103915.081ca2dd@thor.intern.walstatt.dynvpn.de> <1b31e36e-e84b-cc63-1422-d1e0ce2f03c8@FreeBSD.org> To: Andriy Gapon X-Mailer: Apple Mail (2.3445.6.18) X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.25 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: Thu, 05 Apr 2018 02:03:56 -0000 On 2018-Apr-4, at 10:16 AM, Andriy Gapon wrote: > On 01/04/2018 05:31, Mark Millard wrote: >> I have a hypothesis for part of what top is >> counting in the process/thread SWAP column >> that might not be what one would expect. >>=20 >> It appears to me that vnode-backed pages are >> being re-classfied sometimes for inactive >> processes, and this classification leads to >> top classifying the pages as not-resident >> but swapped (in that a "VN PAGER in" would >> be required, in systat -vmstat terms). >=20 > Not sure. > To me it seems that top just uses wrong statistics to calculate the = value. >=20 > /* swap usage */ > #define ki_swap(kip) \ > ((kip)->ki_swrss > (kip)->ki_rssize ? (kip)->ki_swrss - = (kip)->ki_rssize : 0) >=20 > ki_rssize is the resident size of a process. > ki_swrss is resident set size before last swap. >=20 > Their difference is... exactly what? > I cannot even meaningfully describe this value. > But it is certainly _not_ the current swap utilization by the process. >=20 > Here is my attempt at obtaining a more reasonable approximation of = the. process > swap use. But it is still wildly inaccurate. >=20 > . . . If I get time this weekend, I'll try the patch. Thanks. I've classically seen things like (picking on java here): (no patch yet, so SWAP 0K shows) PID USERNAME THR PRI NICE SIZE RES SWAP STATE C TIME = CPU COMMAND 78694 root 44 52 0 14779M 92720K 0K uwait 22 0:06 = 9.91% [java] when Swap: . . . 0 Used . . . (or some figure much smaller than SIZE-RES) showed. (SIZE is ki_size and RES is ki_rssize as I remember.) It suggests some form of reserved-but-not-allocated contribution to ki_size (SIZE), space not resident nor swapped out to a swap partition. Possibly vnode-backed (potential "VN PAGER in and out" contributions instead of "SWAP PAGER" ones, in systat -vmstat terms)? Are such cases examples of what you were counting as "wildly inaccurate"? Or do you count vnode-backed but not resident as perfectly good examples of SWAP in use? =3D=3D=3D Mark Millard marklmi at yahoo.com ( dsl-only.net went away in early 2018-Mar)