lkml.org 
[lkml]   [2020]   [Sep]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 7/9] sched: Add migrate_disable()
On Thu, Sep 24, 2020 at 12:53:25PM +0100, Valentin Schneider wrote:
> On 21/09/20 17:36, Peter Zijlstra wrote:
>
> [...]
>
> > +void migrate_enable(void)
> > +{
> > + if (--current->migration_disabled)
> > + return;
> > +
> > + barrier();
> > +
> > + if (p->cpus_ptr == &p->cpus_mask)
> > + return;
>
> If we get to here this means we're the migrate_enable() invocation that
> marks the end of the migration_disabled region. How can cpus_ptr already
> point back to current's cpus_mask?

It might never have been changed away.


migrate_disable()
->migration_disabled++;
| |
| |
| v
| migrate_disable_switch()
| if (->cpus_ptr == &->cpus_mask)
| __do_set_cpus_allowed(.new_mask = cpumask_of())
| |
| |
v v
migrate_enable()
->migration_disabled--;


Only if we've passed through a context switch between migrate_disable()
and migrate_enable() will the mask have been changed.

\
 
 \ /
  Last update: 2020-09-24 14:31    [W:0.202 / U:1.600 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site