[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <07d30588-22e6-e098-b591-29c7cd3c8054@arm.com>
Date: Fri, 8 Nov 2019 11:47:44 +0000
From: Valentin Schneider <valentin.schneider@....com>
To: Quentin Perret <qperret@...gle.com>,
Peter Zijlstra <peterz@...radead.org>
Cc: Kirill Tkhai <ktkhai@...tuozzo.com>, linux-kernel@...r.kernel.org,
aaron.lwe@...il.com, mingo@...nel.org, pauld@...hat.com,
jdesfossez@...italocean.com, naravamudan@...italocean.com,
vincent.guittot@...aro.org, dietmar.eggemann@....com,
juri.lelli@...hat.com, rostedt@...dmis.org, bsegall@...gle.com,
mgorman@...e.de, kernel-team@...roid.com, john.stultz@...aro.org
Subject: Re: NULL pointer dereference in pick_next_task_fair
On 08/11/2019 11:02, Quentin Perret wrote:
>> diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
>> index a14487462b6c..6b983214e00f 100644
>> --- a/kernel/sched/fair.c
>> +++ b/kernel/sched/fair.c
>> @@ -6746,10 +6746,18 @@ done: __maybe_unused;
>> return NULL;
>> }
>>
>> +static int balance_fair(struct rq *rq, struct task_struct *prev, struct rq_flags *rf)
>> +{
>> + if (rq->cfs.nr_running)
>> + return 1;
>> +
>> + return newidle_balance(rq, rf) != 0;
>
> And you can ignore the RETRY_TASK case here under the assumption that
> we must have tried to pull from RT/DL before ending up here ?
>
I think we can ignore RETRY_TASK because this happens before the picking loop,
so we'll observe any new DL/RT task that got enqueued while newidle released
the lock. This also means we can safely break the balance loop in
pick_next_task() when we get RETRY_TASK, because we've got something to pick
(some new RT/DL task). This wants a comment though, methinks.
Other than that I agree with Quentin, it's a much cleaner approach and I quite
like it.
> Thanks,
> Quentin
>
Powered by blists - more mailing lists