On 10/5/20 4:05 PM, Michal Hocko wrote: > On Fri 25-09-20 13:10:05, Vlastimil Babka wrote: >> On 9/25/20 12:54 PM, David Hildenbrand wrote: >> >> Hmm that temporary write lock would still block new callers until previous >> finish with the downgraded-to-read lock. >> >> But I guess something like this would work: >> >> retry: >> if (atomic_read(...) == 0) { >> // zone_update... + drain >> atomic_inc(...); >> else if (atomic_inc_return == 1) >> // atomic_cmpxchg from 0 to 1; if that fails, goto retry >> >> Tricky, but races could only read to unnecessary duplicated updates + flushing >> but nothing worse? >> >> Or add another spinlock to cover this part instead of the temp write lock... > > Do you plan to post a new version or should I review this one? I will, hopefully this week, but you could comment on other details and overall approach meanwhile? I don't think it will change significantly.