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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Tue, 04 Jan 2011 14:01:33 +0100
From:	Peter Zijlstra <a.p.zijlstra@...llo.nl>
To:	Oleg Nesterov <oleg@...hat.com>
Cc:	Chris Mason <chris.mason@...cle.com>,
	Frank Rowand <frank.rowand@...sony.com>,
	Ingo Molnar <mingo@...e.hu>,
	Thomas Gleixner <tglx@...utronix.de>,
	Mike Galbraith <efault@....de>, Paul Turner <pjt@...gle.com>,
	Jens Axboe <axboe@...nel.dk>,
	Yong Zhang <yong.zhang0@...il.com>,
	Steven Rostedt <rostedt@...dmis.org>,
	linux-kernel@...r.kernel.org
Subject: Re: [RFC][PATCH 08/17] sched: Drop the rq argument to
 sched_class::select_task_rq()

On Mon, 2011-01-03 at 19:05 +0100, Oleg Nesterov wrote:
> On 12/24, Peter Zijlstra wrote:
> >
> > @@ -2680,24 +2681,17 @@ void wake_up_new_task(struct task_struct
> >  {
> >  	unsigned long flags;
> >  	struct rq *rq;
> > -	int cpu __maybe_unused = get_cpu();
> 
> Wait, I think this not right.
> 
> >  #ifdef CONFIG_SMP
> >  	rq = task_rq_lock(p, &flags);
> > -	p->state = TASK_WAKING;
> >
> >  	/*
> >  	 * Fork balancing, do it here and not earlier because:
> >  	 *  - cpus_allowed can change in the fork path
> >  	 *  - any previously selected cpu might disappear through hotplug
> > -	 *
> > -	 * We set TASK_WAKING so that select_task_rq() can drop rq->lock
> > -	 * without people poking at ->cpus_allowed.
> >  	 */
> > -	cpu = select_task_rq(rq, p, SD_BALANCE_FORK, 0);
> > -	set_task_cpu(p, cpu);
> > +	set_task_cpu(p, select_task_rq(p, SD_BALANCE_FORK, 0));
> >
> > -	p->state = TASK_RUNNING;
> >  	task_rq_unlock(rq, &flags);
> 
> We need preempt_disable() to protect us against CPU hotplug. This task
> was never activated, it won't be found/migrated if that CPU goes away
> before we take task_rq_lock().

Ah, indeed. I've replaced it by keeping IRQs disabled over the whole
function, no need to restore and save them in the middle.
--
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