lkml.org 
[lkml]   [2020]   [Nov]   [11]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [tip: sched/core] sched: Fix balance_callback()
On Wed, Nov 11, 2020 at 09:30:42PM +0100, Paul Bolle wrote:
> tip-bot2 for Peter Zijlstra schreef op wo 11-11-2020 om 08:23 [+0000]:
> > --- a/kernel/sched/core.c
> > +++ b/kernel/sched/core.c
> > [...]
> > +static void do_balance_callbacks(struct rq *rq, struct callback_head *head)
> > +{
> > + void (*func)(struct rq *rq);
> > + struct callback_head *next;
> > +
> > + lockdep_assert_held(&rq->lock);
> > +
> > + while (head) {
> > + func = (void (*)(struct rq *))head->func;
> > + next = head->next;
> > + head->next = NULL;
> > + head = next;
>
> Naive question: is there some subtle C-issue that is evaded here by setting
> head->next to NULL prior to copying over it?
>
> (I know this piece of code only got copied around in this patch and this is
> therefor not something that this patch actually introduced.)

It's like list_del_init(), it zeros the entry before unlinking it.
queue_balance_callback() relies on this.

\
 
 \ /
  Last update: 2020-11-11 21:45    [W:0.103 / U:0.260 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site