Skip to content

Commit

Permalink
mm, oom: do not check 0 mask in out_of_memory()
Browse files Browse the repository at this point in the history
Since commit 60e2793 ("mm, oom: do not trigger out_of_memory from the
#PF"), no user sets gfp_mask to 0.  Remove the 0 mask check and update the
comments.

Link: https://lkml.kernel.org/r/20230508073538.1168-1-haifeng.xu@shopee.com
Signed-off-by: Haifeng Xu <haifeng.xu@shopee.com>
Acked-by: Michal Hocko <mhocko@suse.com>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: Shakeel Butt <shakeelb@google.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
  • Loading branch information
hfxsp authored and akpm00 committed Jun 9, 2023
1 parent 97de10a commit 4822acb
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions mm/oom_kill.c
Original file line number Diff line number Diff line change
Expand Up @@ -1130,12 +1130,10 @@ bool out_of_memory(struct oom_control *oc)

/*
* The OOM killer does not compensate for IO-less reclaim.
* pagefault_out_of_memory lost its gfp context so we have to
* make sure exclude 0 mask - all other users should have at least
* ___GFP_DIRECT_RECLAIM to get here. But mem_cgroup_oom() has to
* invoke the OOM killer even if it is a GFP_NOFS allocation.
* But mem_cgroup_oom() has to invoke the OOM killer even
* if it is a GFP_NOFS allocation.
*/
if (oc->gfp_mask && !(oc->gfp_mask & __GFP_FS) && !is_memcg_oom(oc))
if (!(oc->gfp_mask & __GFP_FS) && !is_memcg_oom(oc))
return true;

/*
Expand Down

0 comments on commit 4822acb

Please sign in to comment.