mm, oom: rename zonelist locking functions
try_set_zonelist_oom() and clear_zonelist_oom() are not named properly to imply that they require locking semantics to avoid out_of_memory() being reordered. zone_scan_lock is required for both functions to ensure that there is proper locking synchronization. Rename try_set_zonelist_oom() to oom_zonelist_trylock() and rename clear_zonelist_oom() to oom_zonelist_unlock() to imply there is proper locking semantics. At the same time, convert oom_zonelist_trylock() to return bool instead of int since only success and failure are tested. Signed-off-by: David Rientjes <rientjes@google.com> Cc: "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com> Cc: Johannes Weiner <hannes@cmpxchg.org> Cc: Rik van Riel <riel@redhat.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
8d060bf490
commit
e972a070e2
@ -2246,8 +2246,8 @@ __alloc_pages_may_oom(gfp_t gfp_mask, unsigned int order,
|
||||
{
|
||||
struct page *page;
|
||||
|
||||
/* Acquire the OOM killer lock for the zones in zonelist */
|
||||
if (!try_set_zonelist_oom(zonelist, gfp_mask)) {
|
||||
/* Acquire the per-zone oom lock for each zone */
|
||||
if (!oom_zonelist_trylock(zonelist, gfp_mask)) {
|
||||
schedule_timeout_uninterruptible(1);
|
||||
return NULL;
|
||||
}
|
||||
@ -2285,7 +2285,7 @@ __alloc_pages_may_oom(gfp_t gfp_mask, unsigned int order,
|
||||
out_of_memory(zonelist, gfp_mask, order, nodemask, false);
|
||||
|
||||
out:
|
||||
clear_zonelist_oom(zonelist, gfp_mask);
|
||||
oom_zonelist_unlock(zonelist, gfp_mask);
|
||||
return page;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user