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: <56BE4D15.4000002@hpe.com>
Date:	Fri, 12 Feb 2016 16:22:29 -0500
From:	Waiman Long <waiman.long@....com>
To:	Peter Zijlstra <peterz@...radead.org>
CC:	Ingo Molnar <mingo@...hat.com>, <linux-kernel@...r.kernel.org>,
	Linus Torvalds <torvalds@...ux-foundation.org>,
	Ding Tianhong <dingtianhong@...wei.com>,
	Jason Low <jason.low2@....com>,
	Davidlohr Bueso <dave@...olabs.net>,
	"Paul E. McKenney" <paulmck@...ibm.com>,
	Thomas Gleixner <tglx@...utronix.de>,
	Will Deacon <Will.Deacon@....com>,
	Tim Chen <tim.c.chen@...ux.intel.com>,
	Waiman Long <Waiman.Long@...com>
Subject: Re: [PATCH v2 4/4] sched/fair: Abort wakeup when task is no longer
 in a sleeping state

On 02/12/2016 03:18 PM, Peter Zijlstra wrote:
> On Fri, Feb 12, 2016 at 12:32:15PM -0500, Waiman Long wrote:
>> When a task prepares to sleep and then aborts it somehow, there is
>> a small chance that a waker may be spinning on the on_cpu flag of
>> that task waiting for the flag to turn off before doing the wakeup
>> operation. It may keep on spinning for a long time until that task
>> actually sleeps leading to spurious wakeup.
>>
>> This patch adds code to detect the change in task state and abort
>> the wakeup operation, when appropriate, to free up the waker's cpu
>> to do other useful works.
>>
>> Signed-off-by: Waiman Long<Waiman.Long@...com>
>> ---
>>   kernel/sched/core.c |    9 ++++++++-
>>   1 files changed, 8 insertions(+), 1 deletions(-)
>>
>> diff --git a/kernel/sched/core.c b/kernel/sched/core.c
>> index 7e548bd..e4b6e84 100644
>> --- a/kernel/sched/core.c
>> +++ b/kernel/sched/core.c
>> @@ -2075,8 +2075,15 @@ try_to_wake_up(struct task_struct *p, unsigned int state, int wake_flags)
>>   	 *
>>   	 * This ensures that tasks getting woken will be fully ordered against
>>   	 * their previous state and preserve Program Order.
>> +	 *
>> +	 * If the owning cpu decides not to sleep after all by changing back
>> +	 * its task state, we can return immediately.
>>   	 */
>> -	smp_cond_acquire(!p->on_cpu);
>> +	smp_cond_acquire(!p->on_cpu || !(p->state&  state));
>> +	if (!(p->state&  state)) {
>> +		success = 0;
>> +		goto out;
>> +	}
> This doesn't make sense, if we managed to get here, p->on_rq must be
> false, which means the other side is already in the middle of
> schedule().
Yes, you are right. It is my bad that I miss the on_rq check earlier. 
Just scrap the last patch.

Sorry for that:-[
Longman

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ