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 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8D008C433F5 for ; Thu, 5 May 2022 09:09:23 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id B50C46B0071; Thu, 5 May 2022 05:09:22 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id B00B26B0073; Thu, 5 May 2022 05:09:22 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 9EED66B0074; Thu, 5 May 2022 05:09:22 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 8F7C06B0071 for ; Thu, 5 May 2022 05:09:22 -0400 (EDT) Received: from smtpin02.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 651D42CA9D for ; Thu, 5 May 2022 09:09:22 +0000 (UTC) X-FDA: 79431115764.02.D5BF89D Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by imf06.hostedemail.com (Postfix) with ESMTP id 05B6E180098 for ; Thu, 5 May 2022 09:09:19 +0000 (UTC) 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: Authentication-Results: imf06.hostedemail.com; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=TgnWAJYx; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=K8dLxaTY; spf=pass (imf06.hostedemail.com: domain of osalvador@suse.de designates 195.135.220.28 as permitted sender) smtp.mailfrom=osalvador@suse.de; dmarc=pass (policy=none) header.from=suse.de X-Rspam-User: X-Rspamd-Server: rspam05 X-Rspamd-Queue-Id: 05B6E180098 X-Stat-Signature: etqeext48wcigtfmzd8dbqn6tewm1oq3 X-HE-Tag: 1651741759-977438 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: 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