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 0A29CC54E64 for ; Thu, 28 Mar 2024 09:53:51 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 980F36B008C; Thu, 28 Mar 2024 05:53:50 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 9319E6B0092; Thu, 28 Mar 2024 05:53:50 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 820A16B0095; Thu, 28 Mar 2024 05:53:50 -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 646976B008C for ; Thu, 28 Mar 2024 05:53:50 -0400 (EDT) Received: from smtpin11.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 1EB6480C0E for ; Thu, 28 Mar 2024 09:53:50 +0000 (UTC) X-FDA: 81945986220.11.FDC6131 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf12.hostedemail.com (Postfix) with ESMTP id 9D5924000E for ; Thu, 28 Mar 2024 09:53:48 +0000 (UTC) Authentication-Results: imf12.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=U8iqTLUC; spf=pass (imf12.hostedemail.com: domain of rppt@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=rppt@kernel.org; dmarc=pass (policy=none) header.from=kernel.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1711619628; 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=NdLn4W4T3nc9dyqWIz75KCypP+lZah8F19B8Nd8mjUg=; b=P7Cv3b+EF+IxdgLvxKooVTQez/4YcKLj6KsexmBRPPBCfDAsbyrWcrBF0rfJWf9fLq05pP GnfYrTk6SkfeHq8mV5g8ARZmXz+uVUZPHSJ8i4LDanqDdJkjowEo5e/1vzr+yISi3Cw77Y 2KUOcnawhVMT7OZh7YexooNkfeg8mgg= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1711619628; a=rsa-sha256; cv=none; b=DAck2DIqrhPlxUrKcSutWD+Dc3YgaLEaVI6nEXL9YsUbrxW5JJ9KjDnhUDhRuR9sIuOypH 2m/036vhlBwfExlowJ9MveskUgt7sE9A21CRqXheYEr/WEMjDFuyjNx82LTUVsP0rWf2XG f0bCLff8O9ROt2mfdnyaPa6L8cB+tas= ARC-Authentication-Results: i=1; imf12.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=U8iqTLUC; spf=pass (imf12.hostedemail.com: domain of rppt@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=rppt@kernel.org; dmarc=pass (policy=none) header.from=kernel.org Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id 8D48761773; Thu, 28 Mar 2024 09:53:47 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EB673C433F1; Thu, 28 Mar 2024 09:53:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711619627; bh=Wm6m/5NnyZXHRXMhf1wtzYJHCSsEEotxxLtlnt6uvfA=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=U8iqTLUC1Z26MKdfJFwiRCqyZ18YCrF2/CkvVqkztwWhlapXzOnK8juK0WNjLR9iW HXOGboOQdgVSPZXdvbkhoq+lPLuwkOIHMdoKUwjQa4SEpGeppm7+4A/tlFYKA16FrZ sXBSBnlfAWKvrEz12xKLtOd06KdMUKIN7XUImcuBCySQQiUKQx4Dj9YgG9RN7pbUf9 QojdrgaTUPDnRwZxkQ2dkXCTfUq30Iz4R9ZcF+P9QIpdq6Ao4G9EM6TPWC4kZlZXcY QRX8PzVwyBv3YFaWCmk4d/KiMNzCOMYaGEMNmqXYiEJZ8fRQEA0npvcQ7ezBAo/DG2 EnoyUzrQaXCzw== Date: Thu, 28 Mar 2024 11:53:03 +0200 From: Mike Rapoport To: Baoquan He 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 4/6] mm/mm_init.c: remove meaningless calculation of zone->managed_pages in free_area_init_core() Message-ID: References: <20240325145646.1044760-1-bhe@redhat.com> <20240325145646.1044760-5-bhe@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Stat-Signature: n8xs4hoojonp14g3pdkxa44p8e9iypxq X-Rspamd-Server: rspam10 X-Rspamd-Queue-Id: 9D5924000E X-Rspam-User: X-HE-Tag: 1711619628-225531 X-HE-Meta: U2FsdGVkX1/FlaJaNfyCzEcx8gknFr/bI/JNBct1MVH7Bv/uBh1ayn+01qHMWTGipp4CvD2aW05IZ63cH5BLLBnZ76s2lyrPlho83m/+JdVb4CZgmb7X/VWUdNDrUcAQEHrp0cVIRySm3y1b2GOAdSQ6US8MTGDS1isCgH3khU+LPun7pfxx/PEVIfHYCOycQQhPAkQz1/QxlSo+urf2qIxq2EnY6Q4Cjbq2prvUKuYK+Aq9NOHTrRK94MVguEo9F59Y0Uw+3tQfLeWMsq2jT1j3E3SHSieLvOgL1uaM4OEDHkGGgGduH+TPIta4q7UFn5RufK0WH9BBB3edvxoWPbBli/o5t/aaZg7dqYuk849Zx3Sqg/9coKdmRqK/jT/80SB29S5OME2vvEZ/rO6LhZsCMxa8kFZZz2v8tnVaKo+TfBHYVf5dATwOnwHWVCKCWW89rXaBln7OhIyl/AUs3JhlFO0fucT89KndABNwTrOdsRxKtY9XBu7WheKH8QORQp9cCDKZLSIS5CC6nAvX2Kl7EljKuxW8toQrpG6bdo0iN62x3tKkS/rCHVZUdLLGLu4cIJ0Fd5IK/26gqn7pMtNkZeAOPLcwSRr6CArF9048EWkZcrRc52Vp6WgjUMTA0AzYng88QKeA7QJgRrjq/4R76Qlc8Yd8BmgwQ+jV5fZScUtMQVt2r1dWQoGR/LrfwNyaDjK6NRHU3+cG/mFXkpEbvJZbHHra0wHgzaz7fCAxgzMJue1JJ1KaVqXFSLlZr89jYJ5MuaMyFVytn1ymwGXg0Q5+kMUjQ9RjOpzHwi7cmykRjdeoeb58dHgbtiZTaZMLFIWif7tBE8gswcdPXRSACnaDyW41cbIUa9EZrZeu5loUQCUKnrctKou13XRPCuOXajl2kwMjTX0gDev3yWke6WaxFZLvZRjtk5cxItm3ZF5brFf54A== 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 Thu, Mar 28, 2024 at 04:32:38PM +0800, Baoquan He wrote: > On 03/25/24 at 10:56pm, Baoquan He wrote: > > > > /* > > - * Set an approximate value for lowmem here, it will be adjusted > > - * when the bootmem allocator frees pages into the buddy system. > > - * And all highmem pages will be managed by the buddy system. > > + * Initialize zone->managed_pages as 0 , it will be reset > > + * when memblock allocator frees pages into buddy system. > > */ > > - zone_init_internals(zone, j, nid, freesize); > > + zone_init_internals(zone, j, nid, 0); > > Here, we should initialize zone->managed_pages as zone->present_pages > because later page_group_by_mobility_disabled need be set according to > zone->managed_pages. Otherwise page_group_by_mobility_disabled will be > set to 1 always. I will sent out v3. With zone->managed_pages set to zone->present_pages we won't account for the reserved memory for initialization of page_group_by_mobility_disabled. As watermarks are still not initialized at the time build_all_zonelists() is called, we may use nr_all_pages - nr_kernel_pages instead of nr_free_zone_pages(), IMO. > From a17b0921b4bd00596330f61ee9ea4b82386a9fed Mon Sep 17 00:00:00 2001 > From: Baoquan He > Date: Thu, 28 Mar 2024 16:20:15 +0800 > Subject: [PATCH] mm/mm_init.c: set zone's ->managed_pages as ->present_pages > for now > Content-type: text/plain > > Because page_group_by_mobility_disabled need be set according to zone's > managed_pages later. > > Signed-off-by: Baoquan He > --- > mm/mm_init.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/mm/mm_init.c b/mm/mm_init.c > index cc24e7958c0c..dd875f943cbb 100644 > --- a/mm/mm_init.c > +++ b/mm/mm_init.c > @@ -1561,7 +1561,7 @@ static void __init free_area_init_core(struct pglist_data *pgdat) > * Initialize zone->managed_pages as 0 , it will be reset > * when memblock allocator frees pages into buddy system. > */ > - zone_init_internals(zone, j, nid, 0); > + zone_init_internals(zone, j, nid, zone->present_pages); > > if (!size) > continue; > -- > 2.41.0 > > > > > > if (!size) > > continue; > > @@ -1915,6 +1878,7 @@ void __init free_area_init(unsigned long *max_zone_pfn) > > check_for_memory(pgdat); > > } > > > > + calc_nr_kernel_pages(); > > memmap_init(); > > > > /* disable hash distribution for systems with a single node */ > > -- > > 2.41.0 > > > -- Sincerely yours, Mike.