Re: [PATCH] mm,oom: Bring OOM notifier callbacks to outside of OOM killer.
From: Tetsuo Handa
Date: Tue Jun 26 2018 - 16:11:13 EST
On 2018/06/27 2:03, Paul E. McKenney wrote:
> There are a lot of ways it could be made concurrency safe. If you need
> me to do this, please do let me know.
>
> That said, the way it is now written, if you invoke rcu_oom_notify()
> twice in a row, the second invocation will wait until the memory from
> the first invocation is freed. What do you want me to do if you invoke
> me concurrently?
>
> 1. One invocation "wins", waits for the earlier callbacks to
> complete, then encourages any subsequent callbacks to be
> processed more quickly. The other invocations return
> immediately without doing anything.
>
> 2. The invocations serialize, with each invocation waiting for
> the callbacks from previous invocation (in mutex_lock() order
> or some such), and then starting a new round.
>
> 3. Something else?
>
> Thanx, Paul
As far as I can see,
- atomic_set(&oom_callback_count, 1);
+ atomic_inc(&oom_callback_count);
should be sufficient.