Received: by 2002:a05:6a10:1a4d:0:0:0:0 with SMTP id nk13csp1551091pxb; Tue, 8 Feb 2022 22:01:02 -0800 (PST) X-Google-Smtp-Source: ABdhPJypspTHzehLRa41mdDIjPdiDPLlFEV4+vVeKkecNFr+JAOGNA45IjniBPWneByvLJ91Zy1T X-Received: by 2002:a17:903:41c1:: with SMTP id u1mr699950ple.49.1644386461786; Tue, 08 Feb 2022 22:01:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1644386461; cv=none; d=google.com; s=arc-20160816; b=eFc1Xalf++wVpzcfe1DFSPPQnx83iaqDhaAJZXS5Tq4SCzkiEv5sUXJ8GobOh5t3Cs MHj+9XzR0HQrBlGyiALNrudy1ifdBeEurDQBfmX6TI0sKVxPfEkAvWAEDKobNIKmz8a5 LVudSgb65mkOmi1RO1btZbS539US/v9eUm5IkzJWuqqq8bV4P2p6n/6g4bDXwcLwHgGb CRxymQhB+0bE3I1HSG97Kw3eWEFXuLgBMYaG5M6zo4PgAU5PYtPgdvDZtvZdnKjIU6A2 ZpbRFPuiRbz7SNkxs6nOv6H+kQemCes4DeWids6R3ICiyyeyAP3eFEd3Pr4GqP9d3Rlq tg8w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature :dkim-signature; bh=tYrORe3vbzcD89PzHSw+5HK7RMII1r7ziVJYHhpEbvY=; b=FjjfmsgT87m8rvylloEXR/7wsJ3QylyzIRWfUf/NS2x0pqxQKtF/7lAq273+r2lS3A JAQOjqF7M3RaudCg6CbheRN2PpyzUJ6RxMtxLKTEY9fK8dn/pbwE4mAsGq52RdPy8lIj ASwQ2EIdpPTVpW2IhyNzRoFpjRW8UwyrxxsfbzuWasAdmTVuMKbolKRw2R6i5FZmND59 NnA00ODVktVF3IrLfYuYhVDIpwIyPRxPMybxgGdHPhGA25dojTtfGYlE10eva9KGEfLg puCTOW25tF/5oBrjVdP1LMNIpOdWMVN9XgId0+Zz72Cr16a2TcDFJAojygPxooru+qLx cO0Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=1G97zkUe; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519 header.b=BLDJBR5k; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id b4si13616205plz.351.2022.02.08.22.01.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 08 Feb 2022 22:01:01 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=1G97zkUe; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519 header.b=BLDJBR5k; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id EA567C050CC0; Tue, 8 Feb 2022 21:51:05 -0800 (PST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1357280AbiBHLZH (ORCPT + 99 others); Tue, 8 Feb 2022 06:25:07 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50512 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349659AbiBHKGO (ORCPT ); Tue, 8 Feb 2022 05:06:14 -0500 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 09968C03FEC0 for ; Tue, 8 Feb 2022 02:06:12 -0800 (PST) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 777D1210F0; Tue, 8 Feb 2022 10:06:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1644314771; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=tYrORe3vbzcD89PzHSw+5HK7RMII1r7ziVJYHhpEbvY=; b=1G97zkUeMoUg2asgGtkKTpcfWDbflaeBjia6xc6toNB3usuLthmDrzmslwlNFDcp3oeajy a/CZ4wv+1Axgc0UL23uKPu9gl3y8o9C6oRPqacVZ1cw7Ek2vQutdsydcbSoANblhvK/Lsc 3UgYFGtuHddoAXHJcsaHpB2nJfDRCvU= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1644314771; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=tYrORe3vbzcD89PzHSw+5HK7RMII1r7ziVJYHhpEbvY=; b=BLDJBR5kBFT2606T2KG/4nXiSiOkRNicBmCdSRXn6G+O0k8joXqf3lxJaYSAI3TgAwYQ6n n0viQfq9FopNdADw== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 1580D13BF9; Tue, 8 Feb 2022 10:06:11 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id C7R6ApNAAmJUbwAAMHmgww (envelope-from ); Tue, 08 Feb 2022 10:06:11 +0000 Date: Tue, 8 Feb 2022 11:06:08 +0100 From: Oscar Salvador To: Miaohe Lin Cc: akpm@linux-foundation.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 2/4] mm/memory_hotplug: avoid calling zone_intersects() for ZONE_NORMAL Message-ID: References: <20220207133643.23427-1-linmiaohe@huawei.com> <20220207133643.23427-3-linmiaohe@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220207133643.23427-3-linmiaohe@huawei.com> X-Spam-Status: No, score=-7.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI,SPF_HELO_PASS,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=unavailable 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 On Mon, Feb 07, 2022 at 09:36:41PM +0800, Miaohe Lin wrote: > 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 Reviewed-by: Oscar Salvador > --- > 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 > > -- Oscar Salvador SUSE Labs