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 AF119C6FD1F for ; Tue, 26 Mar 2024 13:49:23 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 1F2FE6B0087; Tue, 26 Mar 2024 09:49:23 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 1A2976B0088; Tue, 26 Mar 2024 09:49:23 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 06B536B0092; Tue, 26 Mar 2024 09:49:23 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id EFA576B0087 for ; Tue, 26 Mar 2024 09:49:22 -0400 (EDT) Received: from smtpin04.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id ABD9DC0B5D for ; Tue, 26 Mar 2024 13:49:22 +0000 (UTC) X-FDA: 81939322164.04.D27169B Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by imf05.hostedemail.com (Postfix) with ESMTP id C023310001E for ; Tue, 26 Mar 2024 13:49:20 +0000 (UTC) Authentication-Results: imf05.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=ccVFyygB; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf05.hostedemail.com: domain of bhe@redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=bhe@redhat.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1711460960; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=fzgh4GVszcwQ5kywfb8L4k+Qo7qZ/xV1p+DuS7SPp54=; b=I1W2sRYjIjNdjC8tE8Mihj4yS+O/536vhfcjA4USgMkhY8uwT8yAjY74npgzBRr5RPUMTO acTcBd/RCvf9PfOoC/2KsrghNIReX8HQJc/8Tj2sI0qF5yPuIgfksKT35a31OUk1RRMXQ7 hewE1FxG9u+dX2EsrmOekxaPCa6fzbQ= ARC-Authentication-Results: i=1; imf05.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=ccVFyygB; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf05.hostedemail.com: domain of bhe@redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=bhe@redhat.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1711460960; a=rsa-sha256; cv=none; b=b0FUH9uXyve86S4d/f1qN7xdOt5MQpREpAzGtmsuDwm4jmBxuW++jvaJ+bcpjVM5QPXTMW DtHPQ7+bPzhD6HCPKE5WiJb+R5QhveYEw9CJf14yfoXZ60fBKAzGr0xkSvpHXkv3CzJYEc Z21rbwsAoQvjq2Pfn/BHA0wIv+5BbiM= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1711460960; h=from:from:reply-to:subject:subject: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=fzgh4GVszcwQ5kywfb8L4k+Qo7qZ/xV1p+DuS7SPp54=; b=ccVFyygBd0dZTPj/gF65Waob/NUU8981ghu/McRhl428Bc8geZEESFIf2UXy3C1EGFe7xV sAvajbJWwvTyglT7iOs/6g2EBYxaDaDTAIX7Eoch2UyFz15y8U45u4siX8XfFUhf6qfJyY dgxnkf+zzC1Gy0qAXUA6khC1XD9Rdtk= Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-661-yNP3kpugPDeb38rdMr3mQQ-1; Tue, 26 Mar 2024 09:49:16 -0400 X-MC-Unique: yNP3kpugPDeb38rdMr3mQQ-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 5195C28EC117; Tue, 26 Mar 2024 13:49:16 +0000 (UTC) Received: from localhost (unknown [10.72.116.12]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 6D083C041F3; Tue, 26 Mar 2024 13:49:15 +0000 (UTC) Date: Tue, 26 Mar 2024 21:49:07 +0800 From: Baoquan He To: Mike Rapoport Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, x86@kernel.org, linuxppc-dev@lists.ozlabs.org, akpm@linux-foundation.org Subject: Re: [PATCH v2 3/6] mm/mm_init.c: add new function calc_nr_all_pages() Message-ID: References: <20240325145646.1044760-1-bhe@redhat.com> <20240325145646.1044760-4-bhe@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.8 X-Rspamd-Server: rspam09 X-Rspamd-Queue-Id: C023310001E X-Stat-Signature: u6ktu6ax5u7rcsm8wppxcgg65f5xo5o1 X-Rspam-User: X-HE-Tag: 1711460960-960427 X-HE-Meta: U2FsdGVkX1/gVKJfytEKdHEVkROh3uyNwmAYYWIlkZsEDTRjSr/hr//YMqU1NcjqMEjoSu50T8q2AsXwd1vGVqS3At22c37E8i2GLOrdXfw8jKVh7R8DUU7nrzNs5OGlzDZ2G5Edkv9pgA13iwZ0LJkvVlfcePtISvpUhE6gIVcX59AIKTVMI7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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: List-Subscribe: List-Unsubscribe: On 03/26/24 at 08:57am, Mike Rapoport wrote: > Hi Baoquan, > > On Mon, Mar 25, 2024 at 10:56:43PM +0800, Baoquan He wrote: > > This is a preparation to calculate nr_kernel_pages and nr_all_pages, > > both of which will be used later in alloc_large_system_hash(). > > > > nr_all_pages counts up all free but not reserved memory in memblock > > allocator, including HIGHMEM memory. While nr_kernel_pages counts up > > all free but not reserved low memory in memblock allocator, excluding > > HIGHMEM memory. > > Sorry I've missed this in the previous review, but I think this patch and > the patch "remove unneeded calc_memmap_size()" can be merged into "remove > meaningless calculation of zone->managed_pages in free_area_init_core()" > with an appropriate update of the commit message. > > With the current patch splitting there will be compilation warning about unused > function for this and the next patch. Thanks for careful checking. We need to make patch bisect-able to not break compiling so that people can spot the cirminal commit, that's for sure. Do we need care about the compiling warning from intermediate patch in one series? Not sure about it. I always suggest people to seperate out this kind of newly added function to a standalone patch for better reviewing and later checking, and I saw a lot of commits like this by searching with 'git log --oneline | grep helper' > > > Signed-off-by: Baoquan He > > --- > > mm/mm_init.c | 24 ++++++++++++++++++++++++ > > 1 file changed, 24 insertions(+) > > > > diff --git a/mm/mm_init.c b/mm/mm_init.c > > index 153fb2dc666f..c57a7fc97a16 100644 > > --- a/mm/mm_init.c > > +++ b/mm/mm_init.c > > @@ -1264,6 +1264,30 @@ static void __init reset_memoryless_node_totalpages(struct pglist_data *pgdat) > > pr_debug("On node %d totalpages: 0\n", pgdat->node_id); > > } > > > > +static void __init calc_nr_kernel_pages(void) > > +{ > > + unsigned long start_pfn, end_pfn; > > + phys_addr_t start_addr, end_addr; > > + u64 u; > > +#ifdef CONFIG_HIGHMEM > > + unsigned long high_zone_low = arch_zone_lowest_possible_pfn[ZONE_HIGHMEM]; > > +#endif > > + > > + for_each_free_mem_range(u, NUMA_NO_NODE, MEMBLOCK_NONE, &start_addr, &end_addr, NULL) { > > + start_pfn = PFN_UP(start_addr); > > + end_pfn = PFN_DOWN(end_addr); > > + > > + if (start_pfn < end_pfn) { > > + nr_all_pages += end_pfn - start_pfn; > > +#ifdef CONFIG_HIGHMEM > > + start_pfn = clamp(start_pfn, 0, high_zone_low); > > + end_pfn = clamp(end_pfn, 0, high_zone_low); > > +#endif > > + nr_kernel_pages += end_pfn - start_pfn; > > + } > > + } > > +} > > + > > static void __init calculate_node_totalpages(struct pglist_data *pgdat, > > unsigned long node_start_pfn, > > unsigned long node_end_pfn) > > -- > > 2.41.0 > > > > -- > Sincerely yours, > Mike. >