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: <20091001183655.GA9995@atrey.karlin.mff.cuni.cz>
Date:	Thu, 1 Oct 2009 20:36:55 +0200
From:	Pavel Machek <pavel@....cz>
To:	Tejun Heo <tj@...nel.org>
Cc:	jeff@...zik.org, mingo@...e.hu, linux-kernel@...r.kernel.org,
	akpm@...ux-foundation.org, jens.axboe@...cle.com,
	rusty@...tcorp.com.au, cl@...ux-foundation.org,
	dhowells@...hat.com, arjan@...ux.intel.com,
	"Rafael J. Wysocki" <rjw@...k.pl>
Subject: Re: [PATCH 01/19] freezer: don't get over-anxious while waiting


> Freezing isn't exactly the most latency sensitive operation and
> there's no reason to burn cpu cycles and power waiting for it to
> complete.  msleep(10) instead of yield().  This should improve
> reliability of emergency hibernation.

i don't see how it improves reliability, but its probably ok.

Well... for hibernation anyway. I can imagine cgroup users where
freeze is so fast that this matters. rjw cc-ed.		pavel

> Signed-off-by: Tejun Heo <tj@...nel.org>
> ---
>  kernel/power/process.c |   13 +++++++++----
>  1 files changed, 9 insertions(+), 4 deletions(-)
> 
> diff --git a/kernel/power/process.c b/kernel/power/process.c
> index cc2e553..9d26a0a 100644
> --- a/kernel/power/process.c
> +++ b/kernel/power/process.c
> @@ -41,7 +41,7 @@ static int try_to_freeze_tasks(bool sig_only)
>  	do_gettimeofday(&start);
>  
>  	end_time = jiffies + TIMEOUT;
> -	do {
> +	while (true) {
>  		todo = 0;
>  		read_lock(&tasklist_lock);
>  		do_each_thread(g, p) {
> @@ -62,10 +62,15 @@ static int try_to_freeze_tasks(bool sig_only)
>  				todo++;
>  		} while_each_thread(g, p);
>  		read_unlock(&tasklist_lock);
> -		yield();			/* Yield is okay here */
> -		if (time_after(jiffies, end_time))
> +		if (!todo || time_after(jiffies, end_time))
>  			break;
> -	} while (todo);
> +
> +		/*
> +		 * We need to retry.  There's no reason to be
> +		 * over-anxious about it and waste power.
> +		 */
> +		msleep(10);
> +	}
>  
>  	do_gettimeofday(&end);
>  	elapsed_csecs64 = timeval_to_ns(&end) - timeval_to_ns(&start);

-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
--
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