Received: by 2002:a05:6a10:1a4d:0:0:0:0 with SMTP id nk13csp379314pxb; Mon, 7 Feb 2022 13:41:22 -0800 (PST) X-Google-Smtp-Source: ABdhPJwyOMvuXW1z1cszFro2PvHxp0s4zX0tI8h+GD/iVxDNyoOylIHA2HeO+Tn6qEG8KF99PCKI X-Received: by 2002:a05:6402:2549:: with SMTP id l9mr1437760edb.129.1644270081895; Mon, 07 Feb 2022 13:41:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1644270081; cv=none; d=google.com; s=arc-20160816; b=W0DbUWgIVuZ6rABpktQjRkwX4WkMHwMQL8ryD5QOm/LixH5Gr+uTZ1QvN85gLNkX24 uttB9bdQWmZYY9GCy7Mdn+gs8lbuuYQ/f7MPJ1ip3eMfuMZiDLUTnTKhSsPeaaLA+S6G 22U1haFzFH+el5Y0YjqzAPv5zUR5BKCUD1OvAnxcCeJsdvlgnDw3SGzygm9c8I1JExeZ TfiwksAv4BYuhkuIRUFW38SS5QB6uUSZ3bjity0/js9PTt16TxyMbGTsAkqvssaojn30 7jlxZ0Uih848E5vHeDmURQhznf0V3pL/J6Oz5rcX4TGoRS3oG+ScywKb/ZloeDM6Al/L Aybw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=GrAOTjiuQ6q/lGOATd6FVkVNhKJXYHy7krc80q6XFjw=; b=CJemX+FWYP6rA8mgVPRUGf23lJJjLzBMemPUxqEMXpcLgawev0JIIxYpU/CR1Eyf9i gNa4N7EaNQsUaB4cjBvWB25jeL25JoJeDhMtqyq5Nx6UnXpRRefdJBgfJO123hWvALFh y6hZY/3foJJlsLb5AWrUy7lpVpiR8o57AaZzsf/lxItTmdmeelbixuo/lkDuap21hCON LFee79XTtsKBYJ84tMi6UoL55L9tvQ0FofO9xg70MgmAij7N1pbhcys5AaX0TioZ3+l7 uZvxLL5273wCjjYIIZ3onQ7hXISVBHBoGT4VsLcWB5HzkKb7I6FmoecHA+Pe9IZ6zTdJ 8wFA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 9si6561544ejj.68.2022.02.07.13.40.56; Mon, 07 Feb 2022 13:41:21 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1389216AbiBGNvX (ORCPT + 99 others); Mon, 7 Feb 2022 08:51:23 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37230 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1387669AbiBGNiC (ORCPT ); Mon, 7 Feb 2022 08:38:02 -0500 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7C562C0401D4 for ; Mon, 7 Feb 2022 05:37:24 -0800 (PST) Received: from canpemm500002.china.huawei.com (unknown [172.30.72.53]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4JsnCD2jbDzZfPd; Mon, 7 Feb 2022 21:33:12 +0800 (CST) Received: from huawei.com (10.175.124.27) by canpemm500002.china.huawei.com (7.192.104.244) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.21; Mon, 7 Feb 2022 21:37:22 +0800 From: Miaohe Lin To: CC: , , Subject: [PATCH 2/4] mm/memory_hotplug: avoid calling zone_intersects() for ZONE_NORMAL Date: Mon, 7 Feb 2022 21:36:41 +0800 Message-ID: <20220207133643.23427-3-linmiaohe@huawei.com> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20220207133643.23427-1-linmiaohe@huawei.com> References: <20220207133643.23427-1-linmiaohe@huawei.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [10.175.124.27] X-ClientProxiedBy: dggems702-chm.china.huawei.com (10.3.19.179) To canpemm500002.china.huawei.com (7.192.104.244) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. Signed-off-by: Miaohe Lin --- mm/memory_hotplug.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c index cbc67c27e0dd..140809e60e9a 100644 --- a/mm/memory_hotplug.c +++ b/mm/memory_hotplug.c @@ -826,7 +826,7 @@ static struct zone *default_kernel_zone_for_pfn(int nid, unsigned long start_pfn 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)) -- 2.23.0