summaryrefslogtreecommitdiff
path: root/mm
diff options
context:
space:
mode:
authorMateusz Nosek <mateusznosek0@gmail.com>2020-10-13 16:55:45 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2020-10-13 18:38:33 -0700
commitcfb4a541918498016ea9fcd7c44fd87b99fb5701 (patch)
treecd19987c1737cdc65ac43e258dfed386fad8a6b2 /mm
parentb630749f018c39f68e6ba0db95ac1cbd66cf0cbb (diff)
downloadlwn-cfb4a541918498016ea9fcd7c44fd87b99fb5701.tar.gz
lwn-cfb4a541918498016ea9fcd7c44fd87b99fb5701.zip
mm/page_alloc.c: micro-optimization remove unnecessary branch
Previously flags check was separated into two separated checks with two separated branches. In case of presence of any of two mentioned flags, the same effect on flow occurs. Therefore checks can be merged and one branch can be avoided. Signed-off-by: Mateusz Nosek <mateusznosek0@gmail.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Reviewed-by: Andrew Morton <akpm@linux-foundation.org> Link: https://lkml.kernel.org/r/20200911092310.31136-1-mateusznosek0@gmail.com Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm')
-rw-r--r--mm/page_alloc.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index 316fff2780c0..cd43e8bdf156 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -3986,8 +3986,10 @@ __alloc_pages_may_oom(gfp_t gfp_mask, unsigned int order,
* success so it is time to admit defeat. We will skip the OOM killer
* because it is very likely that the caller has a more reasonable
* fallback than shooting a random task.
+ *
+ * The OOM killer may not free memory on a specific node.
*/
- if (gfp_mask & __GFP_RETRY_MAYFAIL)
+ if (gfp_mask & (__GFP_RETRY_MAYFAIL | __GFP_THISNODE))
goto out;
/* The OOM killer does not needlessly kill tasks for lowmem */
if (ac->highest_zoneidx < ZONE_NORMAL)
@@ -4004,10 +4006,6 @@ __alloc_pages_may_oom(gfp_t gfp_mask, unsigned int order,
* failures more gracefully we should just bail out here.
*/
- /* The OOM killer may not free memory on a specific node */
- if (gfp_mask & __GFP_THISNODE)
- goto out;
-
/* Exhausted what can be done so it's blame time */
if (out_of_memory(&oc) || WARN_ON_ONCE(gfp_mask & __GFP_NOFAIL)) {
*did_some_progress = 1;