From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id CB04BC433E2 for ; Sat, 12 Sep 2020 23:52:26 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 75BCB21655 for ; Sat, 12 Sep 2020 23:52:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1599954746; bh=8xnUxL5mALPXaVDKqcxvlYGvmGYv382IrfYgONTKEd8=; h=Date:From:To:Subject:Reply-To:List-ID:From; b=DphuoRLPQwRHLy7uBo4IWC2m8p4p5UVkQxA+Jhg0Eswza7EeKdEX/w5+IMMhq6sPF Soe4Ff3pa+T+bKY1ojvv29id05Ry83tlm8sprHaYJJxVcNgLieNvPtBFlfXGvC+JcX b+GSU4lvzG3qT7n/WxZjP3OPlnRXRfwL7UXi6EP0= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725906AbgILXwY (ORCPT ); Sat, 12 Sep 2020 19:52:24 -0400 Received: from mail.kernel.org ([198.145.29.99]:54114 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725905AbgILXwX (ORCPT ); Sat, 12 Sep 2020 19:52:23 -0400 Received: from X1 (unknown [209.33.215.130]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 1583320855; Sat, 12 Sep 2020 23:52:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1599954743; bh=8xnUxL5mALPXaVDKqcxvlYGvmGYv382IrfYgONTKEd8=; h=Date:From:To:Subject:From; b=vpRjSThMeKU4zhoHUTJusHJWWFF8snQMeRmX3/JFPDe81l/R/GD3tHipKLteM10z/ kkOG8QEUAC4oUXKM4ZaPvyQqgwRkeqRl+MiuzkqFR8eT5mHSCfRVo8YgLPGCoDUuBj 3Pl/WsPhNhHQfNUd5i3YtLLlcgHC2MomgA0AVt64= Date: Sat, 12 Sep 2020 16:52:22 -0700 From: akpm@linux-foundation.org To: mm-commits@vger.kernel.org, akpm@linux-foundation.org, mateusznosek0@gmail.com Subject: + mm-page_allocc-micro-optimization-remove-unnecessary-branch.patch added to -mm tree Message-ID: <20200912235222.TA9Te%akpm@linux-foundation.org> User-Agent: s-nail v14.9.10 Sender: mm-commits-owner@vger.kernel.org Precedence: bulk Reply-To: linux-kernel@vger.kernel.org List-ID: X-Mailing-List: mm-commits@vger.kernel.org The patch titled Subject: mm/page_alloc.c: micro-optimization remove unnecessary branch has been added to the -mm tree. Its filename is mm-page_allocc-micro-optimization-remove-unnecessary-branch.patch This patch should soon appear at https://ozlabs.org/~akpm/mmots/broken-out/mm-page_allocc-micro-optimization-remove-unnecessary-branch.patch and later at https://ozlabs.org/~akpm/mmotm/broken-out/mm-page_allocc-micro-optimization-remove-unnecessary-branch.patch Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/process/submit-checklist.rst when testing your code *** The -mm tree is included into linux-next and is updated there every 3-4 working days ------------------------------------------------------ From: mateusznosek0@gmail.com Subject: 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. Link: https://lkml.kernel.org/r/20200911092310.31136-1-mateusznosek0@gmail.com Signed-off-by: Mateusz Nosek Reviewed-by: Andrew Morton Signed-off-by: Andrew Morton --- mm/page_alloc.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) --- a/mm/page_alloc.c~mm-page_allocc-micro-optimization-remove-unnecessary-branch +++ a/mm/page_alloc.c @@ -3972,8 +3972,10 @@ __alloc_pages_may_oom(gfp_t gfp_mask, un * 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) @@ -3990,10 +3992,6 @@ __alloc_pages_may_oom(gfp_t gfp_mask, un * 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; _ Patches currently in -mm which might be from mateusznosek0@gmail.com are mm-page_allocc-clean-code-by-removing-unnecessary-initialization.patch mm-page_allocc-micro-optimization-remove-unnecessary-branch.patch