mm, oom: organize oom context into struct
There are essential elements to an oom context that are passed around to multiple functions. Organize these elements into a new struct, struct oom_control, that specifies the context for an oom condition. This patch introduces no functional change. Signed-off-by: David Rientjes <rientjes@google.com> Acked-by: Michal Hocko <mhocko@suse.cz> Cc: Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:

committed by
Linus Torvalds

parent
2c0b80d463
commit
6e0fc46dc2
@@ -2693,6 +2693,13 @@ static inline struct page *
|
||||
__alloc_pages_may_oom(gfp_t gfp_mask, unsigned int order,
|
||||
const struct alloc_context *ac, unsigned long *did_some_progress)
|
||||
{
|
||||
struct oom_control oc = {
|
||||
.zonelist = ac->zonelist,
|
||||
.nodemask = ac->nodemask,
|
||||
.gfp_mask = gfp_mask,
|
||||
.order = order,
|
||||
.force_kill = false,
|
||||
};
|
||||
struct page *page;
|
||||
|
||||
*did_some_progress = 0;
|
||||
@@ -2744,8 +2751,7 @@ __alloc_pages_may_oom(gfp_t gfp_mask, unsigned int order,
|
||||
goto out;
|
||||
}
|
||||
/* Exhausted what can be done so it's blamo time */
|
||||
if (out_of_memory(ac->zonelist, gfp_mask, order, ac->nodemask, false)
|
||||
|| WARN_ON_ONCE(gfp_mask & __GFP_NOFAIL))
|
||||
if (out_of_memory(&oc) || WARN_ON_ONCE(gfp_mask & __GFP_NOFAIL))
|
||||
*did_some_progress = 1;
|
||||
out:
|
||||
mutex_unlock(&oom_lock);
|
||||
|
Reference in New Issue
Block a user