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=-3.8 required=3.0 tests=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 5B17DC43331 for ; Thu, 2 Apr 2020 04:09:56 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 1A7812074D for ; Thu, 2 Apr 2020 04:09:56 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=kernel.org header.i=@kernel.org header.b="KqpXKMP0" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 1A7812074D Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=linux-foundation.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id B90CE8E0075; Thu, 2 Apr 2020 00:09:55 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id B1A398E000D; Thu, 2 Apr 2020 00:09:55 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A09888E0075; Thu, 2 Apr 2020 00:09:55 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0221.hostedemail.com [216.40.44.221]) by kanga.kvack.org (Postfix) with ESMTP id 8486B8E000D for ; Thu, 2 Apr 2020 00:09:55 -0400 (EDT) Received: from smtpin15.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 411873D05 for ; Thu, 2 Apr 2020 04:09:55 +0000 (UTC) X-FDA: 76661586750.15.hate70_56918a0ff3839 X-HE-Tag: hate70_56918a0ff3839 X-Filterd-Recvd-Size: 2661 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by imf22.hostedemail.com (Postfix) with ESMTP for ; Thu, 2 Apr 2020 04:09:54 +0000 (UTC) Received: from localhost.localdomain (c-73-231-172-41.hsd1.ca.comcast.net [73.231.172.41]) (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 C3C09208E0; Thu, 2 Apr 2020 04:09:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1585800594; bh=ejI6j0Ql1Q5vT8JOat3oIIQOmmdye74k5ztBUbu2JsY=; h=Date:From:To:Subject:In-Reply-To:From; b=KqpXKMP0i523ktTrw5RJAlYQ3WYlrZME71kp6Udzz3lPu2+/kVO0MCiEqotITotLp YDZ70v7z5dQIlMAmD1q4BAAjJnh1JEOgEl6R3EZ2A6HvoV41XKzi6JN+U8a0QgA9jm jCF8sjDhbUbZhGy8PXE18bUGq4dGo9z155kVrV2I= Date: Wed, 01 Apr 2020 21:09:53 -0700 From: Andrew Morton To: akpm@linux-foundation.org, linux-mm@kvack.org, mateusznosek0@gmail.com, mm-commits@vger.kernel.org, torvalds@linux-foundation.org, willy@infradead.org Subject: [patch 117/155] mm/page_alloc.c: micro-optimisation Remove unnecessary branch Message-ID: <20200402040953.riSFcn3-G%akpm@linux-foundation.org> In-Reply-To: <20200401210155.09e3b9742e1c6e732f5a7250@linux-foundation.org> User-Agent: s-nail v14.8.16 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: From: Mateusz Nosek Subject: mm/page_alloc.c: micro-optimisation Remove unnecessary branch Previously if branch condition was false, the assignment was not executed. The assignment can be safely executed even when the condition is false and it is not incorrect as it assigns the value of 'nodemask' to 'ac.nodemask' which already has the same value. So as the assignment can be executed unconditionally, the branch can be removed. Link: http://lkml.kernel.org/r/20200307225335.31300-1-mateusznosek0@gmail.com Signed-off-by: Mateusz Nosek Reviewed-by: Matthew Wilcox (Oracle) Signed-off-by: Andrew Morton --- mm/page_alloc.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) --- a/mm/page_alloc.c~mm-page_allocc-micro-optimisation-remove-unnecessary-branch +++ a/mm/page_alloc.c @@ -4751,8 +4751,7 @@ __alloc_pages_nodemask(gfp_t gfp_mask, u * Restore the original nodemask if it was potentially replaced with * &cpuset_current_mems_allowed to optimize the fast-path attempt. */ - if (unlikely(ac.nodemask != nodemask)) - ac.nodemask = nodemask; + ac.nodemask = nodemask; page = __alloc_pages_slowpath(alloc_mask, order, &ac); _