lkml.org 
[lkml]   [2020]   [May]   [29]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 0/3] make vm_committed_as_batch aware of vm overcommit policy
On Fri, May 29, 2020 at 08:50:25AM -0700, Andi Kleen wrote:
> >
> > ret = proc_dointvec_minmax(table, write, buffer, lenp, ppos);
> > - if (ret == 0 && write)
> > + if (ret == 0 && write) {
> > + if (sysctl_overcommit_memory == OVERCOMMIT_NEVER)
> > + schedule_on_each_cpu(sync_overcommit_as);
>
> The schedule is not atomic.
> There's still a race window here over all the CPUs where the WARN_ON could
> happen because you change the global first.

The re-computing of batch number comes after this sync, so at this
point the batch is still the bigger one, and won't trigger the warning.

> Probably you would need another global that says "i'm currently changing
> the mode" and then skip the WARN_ON in that window. Maybe a sequence lock.
>
> Seems all overkill to me. Better to kill the warning.

Yes, the cost is high, schedule_on_each_cpu is labeled as "very slow"
in the code comments.

Thanks,
Feng

>
> -Andi

\
 
 \ /
  Last update: 2020-05-29 18:05    [W:0.061 / U:0.012 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site