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 68CD6D3C93E for ; Mon, 21 Oct 2024 04:55:06 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 799286B007B; Mon, 21 Oct 2024 00:55:05 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 74A0D6B0082; Mon, 21 Oct 2024 00:55:05 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 610726B0083; Mon, 21 Oct 2024 00:55:05 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id 4426B6B007B for ; Mon, 21 Oct 2024 00:55:05 -0400 (EDT) Received: from smtpin01.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 11CE21C6F8B for ; Mon, 21 Oct 2024 04:54:48 +0000 (UTC) X-FDA: 82696394256.01.770291B Received: from mail-lf1-f44.google.com (mail-lf1-f44.google.com [209.85.167.44]) by imf02.hostedemail.com (Postfix) with ESMTP id A91E88000C for ; Mon, 21 Oct 2024 04:54:35 +0000 (UTC) Authentication-Results: imf02.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b="lnw2or/r"; spf=pass (imf02.hostedemail.com: domain of suhua.tanke@gmail.com designates 209.85.167.44 as permitted sender) smtp.mailfrom=suhua.tanke@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1729486453; 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:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=6U1RWkDpBLtv6ScO5BY3mmJK87haac1ESyN1ito8E4s=; b=h82pIMUuTKzvaJZaoCfQFiTwwxSCbW8gqoA3owKO6JIH6yq1GEPdcIdgaJZoj4q8mUe+cG cmF7KC0lEdgVKyNT6AFL25D16700f/Ayo4qLM8Ob+SodYr0Y/EdH46zJQkpqauy/u9XZB7 AFiywyuFz6ftnB57D3/646qFfedagLo= ARC-Authentication-Results: i=1; imf02.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b="lnw2or/r"; spf=pass (imf02.hostedemail.com: domain of suhua.tanke@gmail.com designates 209.85.167.44 as permitted sender) smtp.mailfrom=suhua.tanke@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1729486453; a=rsa-sha256; cv=none; b=x4wszfQC0hDaAax6WEIz5Py78yqeFJiXNl+z1vVL1Od2KFoJWV/pAEsT5vJvA1B1QhVtPs Tvd0ByWlOdressX+9Noyh9+cUtKJv16MP5WIlwwHc6rUJtjvA4YXSUPbSEI8LYR4zq258f jfwppNHln4UUtdkL0beL7DlU3mLxNcU= Received: by mail-lf1-f44.google.com with SMTP id 2adb3069b0e04-539e3f35268so1924402e87.3 for ; Sun, 20 Oct 2024 21:55:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1729486501; x=1730091301; darn=kvack.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=6U1RWkDpBLtv6ScO5BY3mmJK87haac1ESyN1ito8E4s=; b=lnw2or/rJRI/sxElcjsFOSQKjp8C3f7TLYuvuU4bS1sck3+DJ5ikKIwHEyuHXJ4J9L To0ET0MSbr1oyNqL+gJaZ8+yagI74MpUf+1ukXDAd22/pdRz/vELQ43mP/iAdYifFzCr nNIWtsFeE3trF++vYKXJpsO9KEhnAyhJyNM8FI8si+49D5izNlbdQ5LWLlXSPOZPTV8L 6JA7FHPJ+BOOETP4P96gJhOqwk2m9/Ak95WDpbk7bP6YMPIeW6ZWtVDrRcB6gmUR3rCo B8Sw2mwEY5xoI7vm2DTjxN0UMaO209c69RJFa+jMd0jr5oYCT4FO22d5HAmEFsnz4XaW rzdg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729486501; x=1730091301; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=6U1RWkDpBLtv6ScO5BY3mmJK87haac1ESyN1ito8E4s=; b=gw4u2/wHQroUTsEmcq4V8R3gsyQhGevZ51gwySu0G7hTX1IB3jP8IBBbPHNhubvpvD ezxt8cE7G+1hNMPPugfcEsqaGP8fxwQn5pNEoC4iBLpSx2jmkKXkj8IsQ1CBtXau7CIv t68qLyumplYVLOWwxHAqPim/yLNmhOUFm/pdYtMekkNIFD1I4UTtklo7vGyhLqqgro4O 8r96hBiQC/fcBOv+P+Gpbrka6EnuTXMEPH81pGlB9ZoF4qOcZXhU20e1B7M8BNGKK3+f h8/UP/Z1NrcAk5S9ZTjnll7ac7b98Vnmh0E7ig0B55YYm86OZRUlEINqusCR+oUmFC1U sUOQ== X-Forwarded-Encrypted: i=1; AJvYcCXPwCfk72jWHtI6l2IgQHgwE3sZYqnI1HQftf1qk7J3NkgJxESwShsgE0AdjyI4qTSJzqF3AzboAA==@kvack.org X-Gm-Message-State: AOJu0YxtjuvJ1nJx+3ri6iLRcVmlhld0SwMzkPDaJruXVuEQw1vT3RWw q/CFdOW1LnOstUuCr2LDypu/8aX/gHq6UnwXrhX20C3vpOu2DexaB8l04UkPdukX6Gjv2s0D9KW hP3wLZb2zXxWqW4boC6MIMidwte0= X-Google-Smtp-Source: AGHT+IFGKjEPPKjASZcUAhSNC04pzwZ3RqX0DEVh4g5m3w9MumFRPT4Zo938Qm08ENXRqMBRBcFN8UQi2Nh4ABOg2HI= X-Received: by 2002:a05:6512:12cb:b0:539:9594:b226 with SMTP id 2adb3069b0e04-53a1522dba5mr4307322e87.34.1729486500871; Sun, 20 Oct 2024 21:55:00 -0700 (PDT) MIME-Version: 1.0 References: <20241017064449.5235-1-suhua1@kingsoft.com> In-Reply-To: From: Su Hua Date: Mon, 21 Oct 2024 12:54:23 +0800 Message-ID: Subject: Re: [PATCH] memblock: Uniform initialization all reserved pages to MIGRATE_MOVABLE To: Mike Rapoport Cc: akpm@linux-foundation.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, suhua Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Rspam-User: X-Stat-Signature: bqjskf7ktep8hkguunbgrbufzsgckcet X-Rspamd-Queue-Id: A91E88000C X-Rspamd-Server: rspam11 X-HE-Tag: 1729486475-242912 X-HE-Meta: U2FsdGVkX18M/D8vmPvZ26Ay1w1CoSy+BjcTxVD12t4l2eOvjZMYKqJ9o8xXRgRtUvyQl/igx5xZbpMFbiaUmdrEVu16P2bDd0HXAbancAMqh3bzOXFHDyiyX5bXIprgNZfsMbXBUo0rhBVVmkr9bxMeq/OWLpP6SyaoxghVbAWdRWSf4EoIxoZt2kTzZBmR0VqAC9bGHMaktU6LeOOT21yujgR6UGyKdkI51ga2LO+CTdAOp0YfXrd3Ps/1ViYQHReBbzjkjp7wYssOwZ1ln+x2mHnPibohRDUMbYUMAOwkwKFiBePr1qIdIAOgPLnoPOqkDLFSCpspBOJ6z9eZABLNMU+yOcX/WdiL/loX96f54Hh3Z+8KNiqG9JqpO/Moq0kP56vQUkrVsUxYs5OEN7ZbZjaGEbtlZyH18bD3ONFDjQtqfYRVKH4w1rWqnHsA+NlnVucJLybb8UBTT2dcct/yLqf3/TZ5p72aF6wBGRvDHUuUm3Vk8yHJVej7Q+tJPlpvTRj+tocY8kl/JbCirENcv2g2/n+QgBDrHirrBcGMGte0y/Rl5piDjHOKRRKK8AAUtpjpSpsAf7bz7RpkZPh0K+GAiin8MkNBNrQSh/hXPk8XSkVgtN2jj3ZuKRXP//bdWyS11eXUn16sIAnx9Ytir3YAZxR00i0Z1/Mi54V828t6DhnDpn59J2VjSrsnqOx6VlSkcIFGrVvFIdV0d1wbhQrgAe2YkzcB3+pbgL4M+Hg4qFoMG3NyCPLT3EPqf2ck+nz/Kk4yQE8AKeGhHtGQzZXQyWbbKu2YWwuSPHRAriir6jLZwQDThfNJpGQfwIW8GwDvHXxq7d+4e2o5xgX19H/n79lnmjh9740+ARAYZsivEFue3Yuj19093yBHxOjDvHcMVmugRg8rOGKzSotBDyYk/0Ovns3jGvxjBu1Aehnhqyni8auxPL3/cnu7Hh8EDo3zH3Zt5QybySR Myx8/WWC lEUwYvgPZnxqEMXvJtpG7+/4cRZS7OpRY+GizMmf4Tlkg7it4uNgbb90ZgwOdIMmpOP+NBbrsRxFZK157gLolGdaUv6pgUDOxmBLAeJQyAO6/+b/i15pNbWqvybCpp7QgRvQ9U9S8VqY8OImHg+t43PQsWW1uav0t7rL530gQtOerDgov4sfDzQgmNR/P+hJT4iVMyTDzrU4V4gkLt2gx04HCGr791jFqOTFE4FUJJ7ye+UMmqGFeJIiMIjf8eX+bhQkcXkzj8Svb4eby/pQRMxq/PUtmFEVldPZAOnqY6Pj51eN+vBSY96Gi98dUz0OPrWaruIco+1zrWbY06vmLR7n1Bctm4xkuTIUg8KF2VWBpcj0BpORdyZcMB6+i2Elfbs9qiCE4kYY+bxgnZ3jCZqPt8Idj3Ma7N6iWk6lrjkeNcfaRQjT6Ml+RKkESIYbB+VyGjFJ75ushFCUDNr2OdMkoxBjBcj0QTuLthf2NsZw4RZg+tTHMXoD1gw== 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, Oct 17, 2024 at 02:44:49PM +0800, suhua wrote: > > Subject: memblock: Uniform initialization all reserved pages to MIGRATE= _MOVABLE > > I'd suggest: > > memblock: uniformly initialize all reserved pages to MIGRATE_MOVABLE Thanks for the correction. > > Currently when CONFIG_DEFERRED_STRUCT_PAGE_INIT is not set, the reserve= d > > pages are initialized to MIGRATE_MOVABLE by default in memmap_init. > > > > Reserved memory mainly stores the metadata of struct page. When > > HUGETLB_PAGE_OPTIMIZE_VMEMMAP_DEFAULT_ON=3DY and hugepages are allocate= d, > > the memory occupied by the struct page metadata will be freed. > > The struct page metadata is not freed with HVO, it is rather pages used f= or > vmemmap. Yes, I will update the description. > > Before this patch: > > when CONFIG_DEFERRED_STRUCT_PAGE_INIT is not set, the freed memory was > > placed on the Movable list; > > When CONFIG_DEFERRED_STRUCT_PAGE_INIT=3DY, the freed memory was placed = on > > the Unmovable list. > > > > After this patch, the freed memory is placed on the Movable list > > regardless of whether CONFIG_DEFERRED_STRUCT_PAGE_INIT is set. > > > > Eg: > > Please add back the description of the hardware used for this test and ho= w > much huge pages were allocated at boot. Well, the new patch will add this information. > > echo 500000 > /proc/sys/vm/nr_hugepages > > cat /proc/pagetypeinfo > > > > before=EF=BC=9A > > Free pages count per migrate type at order 0 1 2 3= 4 5 6 7 8 9 10 > > =E2=80=A6 > > Node 0, zone Normal, type Unmovable 51 2 1 28= 53 35 35 43 40 69 3852 > > Node 0, zone Normal, type Movable 6485 4610 666 202= 200 185 208 87 54 2 240 > > Node 0, zone Normal, type Reclaimable 2 2 1 23= 13 1 2 1 0 1 0 > > Node 0, zone Normal, type HighAtomic 0 0 0 0= 0 0 0 0 0 0 0 > > Node 0, zone Normal, type Isolate 0 0 0 0= 0 0 0 0 0 0 0 > > Unmovable =E2=89=88 15GB > > > > after=EF=BC=9A > > Free pages count per migrate type at order 0 1 2 3= 4 5 6 7 8 9 10 > > =E2=80=A6 > > Node 0, zone Normal, type Unmovable 0 1 1 0= 0 0 0 1 1 1 0 > > Node 0, zone Normal, type Movable 1563 4107 1119 189= 256 368 286 132 109 4 3841 > > Node 0, zone Normal, type Reclaimable 2 2 1 23= 13 1 2 1 0 1 0 > > Node 0, zone Normal, type HighAtomic 0 0 0 0= 0 0 0 0 0 0 0 > > Node 0, zone Normal, type Isolate 0 0 0 0= 0 0 0 0 0 0 0 > > > > Signed-off-by: suhua > > checkpatch.pl gives this warning: > > WARNING: From:/Signed-off-by: email address mismatch: 'From: suhua ' !=3D 'Signed-off-by: suhua ' > Please update the commit authorship or signed-off to match. > > Also, Signed-off-by should use a known identity, i.e. Name Lastname. Oh, this is my oversight. > > --- > > mm/mm_init.c | 4 ++++ > > 1 file changed, 4 insertions(+) > > > > diff --git a/mm/mm_init.c b/mm/mm_init.c > > index 4ba5607aaf19..6dbf2df23eee 100644 > > --- a/mm/mm_init.c > > +++ b/mm/mm_init.c > > @@ -722,6 +722,10 @@ static void __meminit init_reserved_page(unsigned = long pfn, int nid) > > if (zone_spans_pfn(zone, pfn)) > > break; > > } > > + > > + if (pageblock_aligned(pfn)) > > + set_pageblock_migratetype(pfn_to_page(pfn), MIGRATE_MOVAB= LE); > > + > > __init_single_page(pfn_to_page(pfn), pfn, zid, nid); > > } > > #else > > -- > > 2.34.1 > > Sincerely yours, Su Mike Rapoport =E4=BA=8E2024=E5=B9=B410=E6=9C=8820=E6=97= =A5=E5=91=A8=E6=97=A5 15:15=E5=86=99=E9=81=93=EF=BC=9A > > On Thu, Oct 17, 2024 at 02:44:49PM +0800, suhua wrote: > > Subject: memblock: Uniform initialization all reserved pages to MIGRATE= _MOVABLE > > I'd suggest: > > memblock: uniformly initialize all reserved pages to MIGRATE_MOVABLE > > > Currently when CONFIG_DEFERRED_STRUCT_PAGE_INIT is not set, the reserve= d > > pages are initialized to MIGRATE_MOVABLE by default in memmap_init. > > > > Reserved memory mainly stores the metadata of struct page. When > > HUGETLB_PAGE_OPTIMIZE_VMEMMAP_DEFAULT_ON=3DY and hugepages are allocate= d, > > the memory occupied by the struct page metadata will be freed. > > The struct page metadata is not freed with HVO, it is rather pages used f= or > vmemmap. > > > Before this patch: > > when CONFIG_DEFERRED_STRUCT_PAGE_INIT is not set, the freed memory was > > placed on the Movable list; > > When CONFIG_DEFERRED_STRUCT_PAGE_INIT=3DY, the freed memory was placed = on > > the Unmovable list. > > > > After this patch, the freed memory is placed on the Movable list > > regardless of whether CONFIG_DEFERRED_STRUCT_PAGE_INIT is set. > > > > Eg: > > Please add back the description of the hardware used for this test and ho= w > much huge pages were allocated at boot. > > > echo 500000 > /proc/sys/vm/nr_hugepages > > cat /proc/pagetypeinfo > > > > before=EF=BC=9A > > Free pages count per migrate type at order 0 1 2 3= 4 5 6 7 8 9 10 > > =E2=80=A6 > > Node 0, zone Normal, type Unmovable 51 2 1 28= 53 35 35 43 40 69 3852 > > Node 0, zone Normal, type Movable 6485 4610 666 202= 200 185 208 87 54 2 240 > > Node 0, zone Normal, type Reclaimable 2 2 1 23= 13 1 2 1 0 1 0 > > Node 0, zone Normal, type HighAtomic 0 0 0 0= 0 0 0 0 0 0 0 > > Node 0, zone Normal, type Isolate 0 0 0 0= 0 0 0 0 0 0 0 > > Unmovable =E2=89=88 15GB > > > > after=EF=BC=9A > > Free pages count per migrate type at order 0 1 2 3= 4 5 6 7 8 9 10 > > =E2=80=A6 > > Node 0, zone Normal, type Unmovable 0 1 1 0= 0 0 0 1 1 1 0 > > Node 0, zone Normal, type Movable 1563 4107 1119 189= 256 368 286 132 109 4 3841 > > Node 0, zone Normal, type Reclaimable 2 2 1 23= 13 1 2 1 0 1 0 > > Node 0, zone Normal, type HighAtomic 0 0 0 0= 0 0 0 0 0 0 0 > > Node 0, zone Normal, type Isolate 0 0 0 0= 0 0 0 0 0 0 0 > > > > Signed-off-by: suhua > > checkpatch.pl gives this warning: > > WARNING: From:/Signed-off-by: email address mismatch: 'From: suhua ' !=3D 'Signed-off-by: suhua ' > Please update the commit authorship or signed-off to match. > > Also, Signed-off-by should use a known identity, i.e. Name Lastname. > > > --- > > mm/mm_init.c | 4 ++++ > > 1 file changed, 4 insertions(+) > > > > diff --git a/mm/mm_init.c b/mm/mm_init.c > > index 4ba5607aaf19..6dbf2df23eee 100644 > > --- a/mm/mm_init.c > > +++ b/mm/mm_init.c > > @@ -722,6 +722,10 @@ static void __meminit init_reserved_page(unsigned = long pfn, int nid) > > if (zone_spans_pfn(zone, pfn)) > > break; > > } > > + > > + if (pageblock_aligned(pfn)) > > + set_pageblock_migratetype(pfn_to_page(pfn), MIGRATE_MOVAB= LE); > > + > > __init_single_page(pfn_to_page(pfn), pfn, zid, nid); > > } > > #else > > -- > > 2.34.1 > > > > -- > Sincerely yours, > Mike.