On 2020/07/14 4:05, Michal Hocko wrote: > Another alternative would be to check mem_cgroup_margin after the lock > is taken but it would be better to keep in sync with the global case as > much as possible unless there is a good reason to differ. > If mem_cgroup_margin() is something what zone_watermark_ok() from get_page_from_freelist() will do, checking mem_cgroup_margin() with oom_lock held will make more keep in sync with the global case (i.e. calling __alloc_pages_may_oom() with oom_lock held).