[Intel-gfx] [PATCH] kernel.h: Add non_block_start/end()
Michal Hocko
mhocko at suse.com
Tue May 21 10:51:26 UTC 2019
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.
--
Michal Hocko
SUSE Labs
More information about the Intel-gfx
mailing list