[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20191001113513.GB32306@linux.vnet.ibm.com>
Date: Tue, 1 Oct 2019 17:06:56 +0530
From: Srikar Dronamraju <srikar@...ux.vnet.ibm.com>
To: Peter Zijlstra <peterz@...radead.org>
Cc: Qian Cai <cai@....pw>, akpm@...ux-foundation.org,
bigeasy@...utronix.de, tglx@...utronix.de, thgarnie@...gle.com,
tytso@....edu, cl@...ux.com, penberg@...nel.org,
rientjes@...gle.com, mingo@...hat.com, will@...nel.org,
linux-mm@...ck.org, linux-kernel@...r.kernel.org,
keescook@...omium.org
Subject: Re: [PATCH] sched: Avoid spurious lock dependencies
> Subject: sched: Avoid spurious lock dependencies
>
> While seemingly harmless, __sched_fork() does hrtimer_init(), which,
> when DEBUG_OBJETS, can end up doing allocations.
>
NIT: s/DEBUG_OBJETS/DEBUG_OBJECTS
> diff --git a/kernel/sched/core.c b/kernel/sched/core.c
> index 7880f4f64d0e..1832fc0fbec5 100644
> --- a/kernel/sched/core.c
> +++ b/kernel/sched/core.c
> @@ -6039,10 +6039,11 @@ void init_idle(struct task_struct *idle, int cpu)
> struct rq *rq = cpu_rq(cpu);
> unsigned long flags;
>
> + __sched_fork(0, idle);
> +
> raw_spin_lock_irqsave(&idle->pi_lock, flags);
> raw_spin_lock(&rq->lock);
>
> - __sched_fork(0, idle);
> idle->state = TASK_RUNNING;
> idle->se.exec_start = sched_clock();
> idle->flags |= PF_IDLE;
>
Given that there is a comment just after this which says
"init_task() gets called multiple times on a task",
should we add a check if rq->idle is present and bail out?
if (rq->idle) {
raw_spin_unlock(&rq->lock);
raw_spin_unlock_irqrestore(&idle->pi_lock, flags);
return;
}
Also can we also move the above 3 statements before the lock?
--
Thanks and Regards
Srikar Dronamraju
Powered by blists - more mailing lists