From owner-freebsd-current@FreeBSD.ORG Wed May 28 13:42:08 2014 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id DE729541; Wed, 28 May 2014 13:42:08 +0000 (UTC) Received: from bigwig.baldwin.cx (bigwig.baldwin.cx [IPv6:2001:470:1f11:75::1]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B7872287B; Wed, 28 May 2014 13:42:08 +0000 (UTC) Received: from jhbbsd.localnet (unknown [209.249.190.124]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id A206CB9C1; Wed, 28 May 2014 09:42:07 -0400 (EDT) From: John Baldwin To: freebsd-current@freebsd.org, koobs@freebsd.org Subject: Re: Change top's notion of idle processes / threads Date: Wed, 28 May 2014 09:41:13 -0400 User-Agent: KMail/1.13.5 (FreeBSD/8.4-CBSD-20140415; KDE/4.5.5; amd64; ; ) References: <201405231605.26312.jhb@freebsd.org> <537FBC1F.6030408@freebsd.org> <53819789.8030304@FreeBSD.org> In-Reply-To: <53819789.8030304@FreeBSD.org> MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <201405280941.13886.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7 (bigwig.baldwin.cx); Wed, 28 May 2014 09:42:07 -0400 (EDT) Cc: Allan Jude X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.18 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: Wed, 28 May 2014 13:42:09 -0000 On Sunday, May 25, 2014 3:11:05 am Kubilay Kocak wrote: > On 24/05/2014 7:22 AM, Allan Jude wrote: > > On 2014-05-23 16:05, John Baldwin wrote: > >> Right now, when top is set to not display idle processes or threads, it only > >> displays processes or threads that are currently in a runnable state or have a > >> non-zero %cpu. However, our %cpu is quite imprecise. I have patch to change > >> top to instead compare the thread or processes runtime (ki_runtime in > >> kinfo_proc) against the runtime of the thread or process the last time data > >> was fetched. In essence, top will consider any thread that has run on a CPU > >> since the last update as non-idle. The end result is that mostly-idle threads > >> and processes will now be visible in top's idle display. Personally, I find > >> this more useful (and find the current implementation completely useless). > >> The patch is at http://people.freebsd.org/~jhb/patches/top_idle.patch > >> > >> Comments? > >> > > > > I think this makes good sense. I would definitely prefer it. Would it > > make sense to maybe preserve the old behaviour behind a command line flag? > > > > And an update to top(8) reflecting the algo :) I know these little > esoteric things could always do with more obvious breadcrumbs (like load > average calcs, etc) for our future selves and others. As Ed noted, the manpage is already fairly vague here. Given the responses so far, everyone finds the new behavior more intuitive than the old one. > +1 on the behavior change, not sure about retaining the old under a > flag. Who might benefit from it? How do other OS top implementations > calculate their idle? If there's other examples out there with the same > (current) algo, then retaining compat might be worth it, such as for > newly converted users This isn't really that big of a behavior change in practice. It is just using a more precise measurement for the current 'ki_pctcpu != 0' test that is already there. -- John Baldwin