On Tue 21-05-19 20:04:34, Tetsuo Handa wrote: > On 2019/05/21 19:51, Michal Hocko wrote: > > On Tue 21-05-19 19:44:01, Tetsuo Handa wrote: > >> On 2019/05/21 19:06, Daniel Vetter wrote: > >>> In some special cases we must not block, but there's not a > >>> spinlock, preempt-off, irqs-off or similar critical section already > >>> that arms the might_sleep() debug checks. Add a non_block_start/end() > >>> pair to annotate these. > >>> > >>> This will be used in the oom paths of mmu-notifiers, where blocking is > >>> not allowed to make sure there's forward progress. Quoting Michal: > >>> > >>> "The notifier is called from quite a restricted context - oom_reaper - > >>> which shouldn't depend on any locks or sleepable conditionals. The code > >>> should be swift as well but we mostly do care about it to make a forward > >>> progress. Checking for sleepable context is the best thing we could come > >>> up with that would describe these demands at least partially." > >>> > >> > >> Can this be checked for OOM notifier as well? > >> > >> if (!is_memcg_oom(oc)) { > >> + non_block_start(); > >> blocking_notifier_call_chain(&oom_notify_list, 0, &freed); > >> + non_block_end(); > >> if (freed > 0) > >> /* Got some memory back in the last second. */ > >> return true; > >> } > >> > >> It is not clear whether i915's oom_notifier function has such dependency. > > > > It is not but then we should be using the non-blocking API if this is > > a real problem. The above code just doesn't make any sense. We have a > > blocking API called and wrapped by non-blocking one. > > OOM notifiers should not depend on any locks or sleepable conditionals. > If some lock directly or indirectly depended on __GFP_DIRECT_RECLAIM, > it will deadlock. Thus, despite blocking API, this should effectively be > non-blocking. All OOM notifier users except i915 seems to be atomic, but > I can't evaluate i915 part... Read again what I've written, please -- Michal Hocko SUSE Labs _______________________________________________ Intel-gfx mailing list Intel-gfx@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/intel-gfx