From patchwork Tue Mar 22 21:47:19 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Morton X-Patchwork-Id: 12789257 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6FA0AC433EF for ; Tue, 22 Mar 2022 21:47:23 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 0F04C6B017E; Tue, 22 Mar 2022 17:47:23 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 0A0496B017F; Tue, 22 Mar 2022 17:47:23 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id E832F6B0180; Tue, 22 Mar 2022 17:47:22 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (relay.hostedemail.com [64.99.140.25]) by kanga.kvack.org (Postfix) with ESMTP id DA0766B017E for ; Tue, 22 Mar 2022 17:47:22 -0400 (EDT) Received: from smtpin09.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id A9C8361E46 for ; Tue, 22 Mar 2022 21:47:22 +0000 (UTC) X-FDA: 79273358724.09.F04C448 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by imf16.hostedemail.com (Postfix) with ESMTP id 3432A180018 for ; Tue, 22 Mar 2022 21:47:22 +0000 (UTC) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 198BDB81DB7; Tue, 22 Mar 2022 21:47:21 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A67DCC340F2; Tue, 22 Mar 2022 21:47:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1647985639; bh=CM1n9mzzhlL7za/LeGoqlxU72kT0yRPY/3c8VjkAdpw=; h=Date:To:From:In-Reply-To:Subject:From; b=NcQ7n2NFi96gYLMps5hb3/IiVGnhOXfQgX77FnwXfR4FrBaS0KWepr+YRsiIW14fo kZAd9Qzqc/CzXiQtRte5j9yuXADOLjQQ4FLncXLqTbYpWSpG0/tGTYWAPLmz28hsMD RdUlZIBUc4z8SiV6CIWZuLr/pqjvTLLEmHzE+Tjk= Date: Tue, 22 Mar 2022 14:47:19 -0700 To: osalvador@suse.de,david@redhat.com,linmiaohe@huawei.com,akpm@linux-foundation.org,patches@lists.linux.dev,linux-mm@kvack.org,mm-commits@vger.kernel.org,torvalds@linux-foundation.org,akpm@linux-foundation.org From: Andrew Morton In-Reply-To: <20220322143803.04a5e59a07e48284f196a2f9@linux-foundation.org> Subject: [patch 173/227] mm/memory_hotplug: avoid calling zone_intersects() for ZONE_NORMAL Message-Id: <20220322214719.A67DCC340F2@smtp.kernel.org> X-Stat-Signature: jhc6mq3cssb9a4391j4hgbeknzgyg9bo X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: 3432A180018 Authentication-Results: imf16.hostedemail.com; dkim=pass header.d=linux-foundation.org header.s=korg header.b=NcQ7n2NF; dmarc=none; spf=pass (imf16.hostedemail.com: domain of akpm@linux-foundation.org designates 145.40.68.75 as permitted sender) smtp.mailfrom=akpm@linux-foundation.org X-Rspam-User: X-HE-Tag: 1647985642-160583 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: Miaohe Lin Subject: mm/memory_hotplug: avoid calling zone_intersects() for ZONE_NORMAL If zid reaches ZONE_NORMAL, the caller will always get the NORMAL zone no matter what zone_intersects() returns. So we can save some possible cpu cycles by avoid calling zone_intersects() for ZONE_NORMAL. Link: https://lkml.kernel.org/r/20220207133643.23427-3-linmiaohe@huawei.com Signed-off-by: Miaohe Lin Reviewed-by: David Hildenbrand Reviewed-by: Oscar Salvador Signed-off-by: Andrew Morton --- mm/memory_hotplug.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/mm/memory_hotplug.c~mm-memory_hotplug-avoid-calling-zone_intersects-for-zone_normal +++ a/mm/memory_hotplug.c @@ -823,7 +823,7 @@ static struct zone *default_kernel_zone_ struct pglist_data *pgdat = NODE_DATA(nid); int zid; - for (zid = 0; zid <= ZONE_NORMAL; zid++) { + for (zid = 0; zid < ZONE_NORMAL; zid++) { struct zone *zone = &pgdat->node_zones[zid]; if (zone_intersects(zone, start_pfn, nr_pages))