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]
Date:	Tue, 28 Jan 2014 17:43:20 +0100
From:	Oleg Nesterov <oleg@...hat.com>
To:	Rakib Mullick <rakib.mullick@...il.com>
Cc:	linux-kernel@...r.kernel.org, mingo@...nel.org,
	Andrew Morton <akpm@...ux-foundation.org>
Subject: Re: Do we really need curr_target in signal_struct ?

On 01/28, Rakib Mullick wrote:
>
> As an alternative of using curr_target we can use get_nr_thread() count

We do not even need get_nr_thread() if we want to kill curr_target,

> @@ -961,21 +962,16 @@ static void complete_signal(int sig, struct task_struct *p, int group)
>  		 */
>  		return;
>  	else {
> -		/*
> -		 * Otherwise try to find a suitable thread.
> -		 */
> -		t = signal->curr_target;
> -		while (!wants_signal(sig, t)) {
> +		i = get_nr_threads(p);
> +		t = p;
> +		do {
> +			--i;
>  			t = next_thread(t);
> -			if (t == signal->curr_target)
> -				/*
> -				 * No thread needs to be woken.
> -				 * Any eligible threads will see
> -				 * the signal in the queue soon.
> -				 */
> +			if (!i)
>  				return;
> -		}
> -		signal->curr_target = t;
> +		} while (!wants_signal(sig, t));

You could simply do while_each_thread(p, t) to find a thread which
wants_signal(..).

But I guess ->curr_target was added exactly to avoid this loop if
possible, assuming that wants_signal(->current_targer) should be
likely true. Although perhaps this optimization is too simple.

Oleg.

--
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