Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp2791808iob; Fri, 6 May 2022 10:26:10 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzZbRbzw9lMwp665UUXO3EpU5jo0fkh3WrH/6Dei3hFAOlQn7ufmKqZhYv2L+CfF+QzNzB0 X-Received: by 2002:a17:907:d0c:b0:6f4:a5b9:3799 with SMTP id gn12-20020a1709070d0c00b006f4a5b93799mr3898440ejc.732.1651857970249; Fri, 06 May 2022 10:26:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1651857970; cv=none; d=google.com; s=arc-20160816; b=vZhTqV/QrXn82e2Yy/kQ2WtOZLPAWc8PmyKHPiLtN0VMSFsp1lAFdsj5Om8nQAA6W0 4Wju3m1hK6xiNaHUd6mcO2aG6Ub8dhxonr016cusivvpT5pjXfN3Z7Lhm/b+PUCdtGfY qv5Bp2wcU6kl9oYNFWcdCxJGfnahddh1yQK0yV/pbX4jUjkFNTgkIMCcnF/jVnDYB15k /82MQSKbk3LGQIfthCn3wEQfg4vxwZjoLdeDfKfyqKHop2kVLoUJP8X1LoMe4yML1OTs mCf6P4LqqDzXptCOIXmWOl3pGFsNlev4Fyy4F36bg2QwKNccBnFWA5WK+e5rEZXv0QNA mZ/w== 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=++cBF1w5i8CcTqxB+SUMAt0ENhwHRHhp+tJ4a9UnQn4=; b=PqoQhI9osYxj+v2KatumQr+QshfFwf9xMRsmOrE5X/vZdCPiT4XVF+jdiNI/qORKhb CMuqkohca8U/Xv14opWmY6IJ9aA/ncINv0Z/HmR2Tvtsldo31QaXHhdLkLHMPE3nbL+p yEYHJ8aRNQqqZ09aTrR33/cr/2El8wpuoDX0EGqBWPnBQk944lyWgiGCaLAupFLS1NrS yeRlD7SW72A6VcEO4EbCzwxCInoivjZeBzE8/G6GmrLo/QtQYJP1u/QHklKjr0A5reCZ H66Tsbz6IGAcXgwBa6BmED03Mx46VF06am122N1d+jX/kK2+I1Df3fd89YqyZ8F2oNS6 TOIg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=TgnWAJYx; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519 header.b=K8dLxaTY; 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=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id nc11-20020a1709071c0b00b006e7f255f245si6869507ejc.36.2022.05.06.10.25.45; Fri, 06 May 2022 10:26:10 -0700 (PDT) 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; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=TgnWAJYx; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519 header.b=K8dLxaTY; 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=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346156AbiEEJND (ORCPT + 99 others); Thu, 5 May 2022 05:13:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51582 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245698AbiEEJNB (ORCPT ); Thu, 5 May 2022 05:13:01 -0400 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C0E554BB89 for ; Thu, 5 May 2022 02:09:21 -0700 (PDT) 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 6B0D1218EE; Thu, 5 May 2022 09:09:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1651741760; 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=++cBF1w5i8CcTqxB+SUMAt0ENhwHRHhp+tJ4a9UnQn4=; b=TgnWAJYxoxaY7sYCMSsIU5UM+Yu3t1fxyCjL2KkKixmrMIDS3p5TbrcJ049UFYCuZxcMtb 29YcJIBJvGc+BxC9V/OH6PVVCKQJwv+Og2EsW1DkgIVUz7Nz9IxlmSS5QBxmJV/TqJRxYT 3MQhh+U8tJeHhBNZx8G4RGsNclRKx38= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1651741760; 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=++cBF1w5i8CcTqxB+SUMAt0ENhwHRHhp+tJ4a9UnQn4=; b=K8dLxaTYW1jxnZ81S553YNn7UARlGAu0Hbp9m2Yv95HTzOKujosI7XFNltOCffpi28xRI0 mcbDlFAH9ZPIjxDg== 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 D49F513B11; Thu, 5 May 2022 09:09:19 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id Ya+PMD+Uc2KvIgAAMHmgww (envelope-from ); Thu, 05 May 2022 09:09:19 +0000 Date: Thu, 5 May 2022 11:09:18 +0200 From: Oscar Salvador To: David Hildenbrand Cc: Andrew Morton , Michal Hocko , Wei Yang , Miaohe Lin , linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 1/3] mm/page_alloc: Do not calculate node's total pages and memmap pages when empty Message-ID: References: <20220307150725.6810-1-osalvador@suse.de> <20220307150725.6810-2-osalvador@suse.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,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 On Thu, Apr 28, 2022 at 02:13:46PM +0200, David Hildenbrand wrote: > Sorry, I'm late with review. My mailbox got flooded. Hi David :) > > + /* Skip calculation for memoryless nodes */ > > + if (node_start_pfn == node_end_pfn) > > + goto no_pages; > > + > > Just a NIT: > > E.g., in zone_spanned_pages_in_node() we test for > !node_start_pfn && !node_end_pfn > > In update_pgdat_span(), we set > node_start_pfn = node_end_pfn = 0; > when we find an empty node during memory unplug. > > Therefore, I wonder if a helper "is_memoryless_node()" or "node_empty()" > might be reasonable, that just checks for either > !node_start_pfn && !node_end_pfn > or > node_start_pfn == node_end_pfn Yeah, I thoguth about that as well, but given the few places we check for it I was hesitant to add it. But it might make the situation more clear, so I will go with a helper. > > +no_pages: > > zone_init_internals(zone, j, nid, freesize); > > > > if (!size) > > We have another size check below. We essentially have right now: > > " > if (!size) > goto no_pages; > > [code] > no_pages: > zone_init_internals(zone, j, nid, freesize); > > if (!size) > continue > [more code] > " > > IMHO, it would be nicer to avoid the label/goto by just doing a: > > " > if (!size) { > zone_init_internals(zone, j, nid, 0); > continue; > } > > [code] > zone_init_internals(zone, j, nid, freesize); > [more code] > " > > Or factoring out [code] into a separate function. I did not think about how a refactor would look, so for now I will go with your first proposal. If I see that a refactor is due, I will think more about it. thanks! -- Oscar Salvador SUSE Labs