lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20120312164145.5110ed5c@de.ibm.com>
Date:	Mon, 12 Mar 2012 16:41:45 -0400
From:	Martin Schwidefsky <schwidefsky@...ibm.com>
To:	Michal Hocko <mhocko@...e.cz>
Cc:	"Srivatsa S. Bhat" <srivatsa.bhat@...ux.vnet.ibm.com>,
	Thomas Gleixner <tglx@...utronix.de>,
	linux-kernel <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] fix idle ticks in cpu summary line of /proc/stat

On Mon, 12 Mar 2012 16:39:06 +0100
Michal Hocko <mhocko@...e.cz> wrote:

> Hmm, the semantic is that the function either returns the sleeptime or
> -1 if nohz is disabled. Bringing also online/offline into it seems
> rather confusing. 
> Maybe we shouldn't do the test layer up when we call the function
> instead. This should be much cleaner IMO (it also reduced cpu_online
> call from the governors call paths which might be a problem as well):
> 
> diff --git a/fs/proc/stat.c b/fs/proc/stat.c
> index 121f77c..d437258 100644
> --- a/fs/proc/stat.c
> +++ b/fs/proc/stat.c
> @@ -24,7 +24,10 @@
> 
>  static u64 get_idle_time(int cpu)
>  {
> -	u64 idle, idle_time = get_cpu_idle_time_us(cpu, NULL);
> +	u64 idle, idle_time = -1ULL;
> +	
> +	if (cpu_online(cpu))
> +		idle_time = get_cpu_idle_time_us(cpu, NULL);
> 
>  	if (idle_time == -1ULL) {
>  		/* !NO_HZ so we can rely on cpustat.idle */
> @@ -38,7 +41,10 @@ static u64 get_idle_time(int cpu)
> 
>  static u64 get_iowait_time(int cpu)
>  {
> -	u64 iowait, iowait_time = get_cpu_iowait_time_us(cpu, NULL);
> +	u64 iowait, iowait_time = -1ULL;
> +	
> +	if (cpu_online(cpu))
> +		iowait_time = get_cpu_iowait_time_us(cpu, NULL);
> 
>  	if (iowait_time == -1ULL)
>  		/* !NO_HZ so we can rely on cpustat.iowait */
> 

That looks better and should be equivalent.

-- 
blue skies,
   Martin.

"Reality continues to ruin my life." - Calvin.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ