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: <20161026154647.GJ3157@twins.programming.kicks-ass.net>
Date:   Wed, 26 Oct 2016 17:46:47 +0200
From:   Peter Zijlstra <peterz@...radead.org>
To:     Dmitry Torokhov <dmitry.torokhov@...il.com>
Cc:     LKML <linux-kernel@...r.kernel.org>, Tejun Heo <tj@...nel.org>,
        computersforpeace@...il.com, Ingo Molnar <mingo@...nel.org>,
        der.herr@...r.at
Subject: Re: complete_all and "forever" completions

On Wed, Oct 26, 2016 at 05:42:13PM +0200, Peter Zijlstra wrote:

> Does something like so work?

try_wait_for_completion() would need a similar change.

> ---
>  kernel/sched/completion.c | 7 +++++--
>  1 file changed, 5 insertions(+), 2 deletions(-)
> 
> diff --git a/kernel/sched/completion.c b/kernel/sched/completion.c
> index 8d0f35debf35..5deab9c789df 100644
> --- a/kernel/sched/completion.c
> +++ b/kernel/sched/completion.c
> @@ -51,7 +51,7 @@ void complete_all(struct completion *x)
>  	unsigned long flags;
>  
>  	spin_lock_irqsave(&x->wait.lock, flags);
> -	x->done += UINT_MAX/2;
> +	x->done = UINT_MAX/2;
>  	__wake_up_locked(&x->wait, TASK_NORMAL, 0);
>  	spin_unlock_irqrestore(&x->wait.lock, flags);
>  }
> @@ -79,7 +79,10 @@ do_wait_for_common(struct completion *x,
>  		if (!x->done)
>  			return timeout;
>  	}
> -	x->done--;
> +
> +	if (x->done != UINT_MAX/2)
> +		x->done--;
> +
>  	return timeout ?: 1;
>  }
>  

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ