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 CAECBC4332F for ; Tue, 31 Oct 2023 22:38:45 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 346056B0333; Tue, 31 Oct 2023 18:38:45 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 2F6636B033F; Tue, 31 Oct 2023 18:38:45 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 1BE006B0340; Tue, 31 Oct 2023 18:38:45 -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 0B67C6B0333 for ; Tue, 31 Oct 2023 18:38:45 -0400 (EDT) Received: from smtpin18.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id DA6DDC0619 for ; Tue, 31 Oct 2023 22:38:44 +0000 (UTC) X-FDA: 81407222568.18.E2595F0 Received: from mail-ed1-f51.google.com (mail-ed1-f51.google.com [209.85.208.51]) by imf24.hostedemail.com (Postfix) with ESMTP id E8E5A18001B for ; Tue, 31 Oct 2023 22:38:42 +0000 (UTC) Authentication-Results: imf24.hostedemail.com; dkim=pass header.d=google.com header.s=20230601 header.b=eKmnoamr; dmarc=pass (policy=reject) header.from=google.com; spf=pass (imf24.hostedemail.com: domain of souravpanda@google.com designates 209.85.208.51 as permitted sender) smtp.mailfrom=souravpanda@google.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1698791923; 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=EddofEyenAYCge0a1xbqgEIGrQrLw0hIcuQcuJuHAFA=; b=woxivDTKKgRYPZ7jkjKuf+J+GD8FUxpZ+xOEePpU6WHANPsRblvvrdzLJ0JBN6wNdGbwWX IrREcObAJzRKA8cBMk1DMAwJOz/EL2IlTP9/DH0j6OepOOIJllpnw5JBdwWO9hHSFi53Mu FcZvnbqJFbEVsqPH7daNN2Z71NhjuM8= ARC-Authentication-Results: i=1; imf24.hostedemail.com; dkim=pass header.d=google.com header.s=20230601 header.b=eKmnoamr; dmarc=pass (policy=reject) header.from=google.com; spf=pass (imf24.hostedemail.com: domain of souravpanda@google.com designates 209.85.208.51 as permitted sender) smtp.mailfrom=souravpanda@google.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1698791923; a=rsa-sha256; cv=none; b=yXK5oSFVdqK9ytkKOqc16B4kB/Gwadp0LHi+3bwPGPUx9sGn4WQO/cN5T8NSwVb2hjq8gC CayppAItn0n/BZMg3v5nahArn7srCeefglvqrO9/Er+RRMk8Lm+Krj3NJfjhlsoYqwBA1C EyCpS15DSEtquAyMlJw50/4ctW+hirA= Received: by mail-ed1-f51.google.com with SMTP id 4fb4d7f45d1cf-53de8fc1ad8so10203828a12.0 for ; Tue, 31 Oct 2023 15:38:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1698791921; x=1699396721; darn=kvack.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=EddofEyenAYCge0a1xbqgEIGrQrLw0hIcuQcuJuHAFA=; b=eKmnoamrC2CulcSmWwIwb7QU8mP2tIrTDM99jnL0qC9f0UcDAd5kQyMKJ0wtEhk+Zo uYQ4YVm19prDSOmzdI/m5T4LcLKK1XVilKBrpqW5nSMOfNPHvxzJ7B0SAvX9HlqRxEJD hAIttSTMXC1ZOK/cTy4+iboGVlHNn65oGrs6d/fWFWXAZxAhXizLnTvkPolmOOcn4l9r LhhD5HGZij6MPravEgfDoUDT604WYKKKPRBxW5bdQDv45t9ld8cX4cF3W4ecxyVlsLee yWE3JLWj867sFYYMSV3247ibOjldKrMYpLoH34/heTkAQ/FqK5Ktd2MKuV7M2RxD2Qc5 AxtA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698791921; x=1699396721; h=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=EddofEyenAYCge0a1xbqgEIGrQrLw0hIcuQcuJuHAFA=; b=IsaWJ2DLY0GOxnbh23Q4TTxYo++6Wby0Ao/C3og7tokynQu95DodbxwqTFFR9OCq+G 63MngdMZ8vdab0RC4RwR16UJ2NEKRzyKzYcsridHJD3NGXs/SZBwFezOtOKvZZhixTs3 Uvyyhyt/K5rA6NFZ7+ep6gI14c/umnqXnkTBcdyhWjRxXFN0SfqMqPKOP+DLnf+HvxWV wRxBMrcs3TJZVvCOMbPFLgQ+JQ2N6oc8a+8HmI09w+/lscYVsVlpriJUY9GcHGpAvwZe mEhCslFKfajqRZddmo/lsk2CQP5h255Vu7QG0SHttepCrd5u7+LBs27SqEiVWA+Eeh48 HuNQ== X-Gm-Message-State: AOJu0Yyb1GECU4Mw7/dpz+nk4GUn+9PbrCsevTFUHZzZc16wLw7oYEUz 9H10f8chHHN6Mz6htIg6yj+/+lyJLMUmJlXH/7pj6Q== X-Google-Smtp-Source: AGHT+IFxw5YGHBKw8ZpL//WxpBsnoGkleasZQ6QM89pE0pAdptBgefMrYWgukZDhNjD37TDCUjbCJEYOQo8wB3fau9o= X-Received: by 2002:a17:907:a45:b0:9a6:1446:852c with SMTP id be5-20020a1709070a4500b009a61446852cmr545021ejc.27.1698791921341; Tue, 31 Oct 2023 15:38:41 -0700 (PDT) MIME-Version: 1.0 References: <20231031174459.459480-1-souravpanda@google.com> <20231031174459.459480-2-souravpanda@google.com> In-Reply-To: From: Sourav Panda Date: Tue, 31 Oct 2023 15:38:29 -0700 Message-ID: Subject: Re: [PATCH v3 1/1] mm: report per-page metadata information To: Matthew Wilcox Cc: corbet@lwn.net, gregkh@linuxfoundation.org, rafael@kernel.org, akpm@linux-foundation.org, mike.kravetz@oracle.com, muchun.song@linux.dev, rppt@kernel.org, david@redhat.com, rdunlap@infradead.org, chenlinxuan@uniontech.com, yang.yang29@zte.com.cn, tomas.mudrunka@gmail.com, bhelgaas@google.com, ivan@cloudflare.com, pasha.tatashin@soleen.com, yosryahmed@google.com, hannes@cmpxchg.org, shakeelb@google.com, kirill.shutemov@linux.intel.com, wangkefeng.wang@huawei.com, adobriyan@gmail.com, vbabka@suse.cz, Liam.Howlett@oracle.com, surenb@google.com, linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-doc@vger.kernel.org, linux-mm@kvack.org, weixugc@google.com Content-Type: multipart/alternative; boundary="0000000000000519fe06090ad12a" X-Rspamd-Queue-Id: E8E5A18001B X-Rspam-User: X-Rspamd-Server: rspam04 X-Stat-Signature: 8675hkd78rsuimjptr47qupse9re6qir X-HE-Tag: 1698791922-242013 X-HE-Meta: U2FsdGVkX19xYTdHN8VppkPhHJcO4G6yPvSPmjw+t0OBx0ITDOnWTGC0T4ODPS6xJCLlqCpOhRDF/sjuoxNWdfNmrqphmPgODTwm7u11NayGjgwnTmU/Qu6sZK3bQCq4Sg5Uh4AHENgGVjlL5p4b3NjQd65T1ZqZ3NY76fi0GOBfpf3j9pYgr/5VmsRC8SQTcPR/8EA5vLZJ7YFQ4auLJZ1HnqHdlyKrWMl+J9bRs9gzGnB9y58tTgyQH9nscqtubaBHsBI0WxAwikI1IZjJ4XsyXWljF/sM8FlARJY0XaKl8uLVBR0fVUYyKtNWLOAQ+q4gt1Ci0jUE/SrRPn8rW0XwnXZbeXSkjAxGAO454gKdLV92IDiT5uhswbwPFYKT0McIqn+IoyCQJ5av11ndWkvDHzbpaz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SZO87CvOnCkCyU= X-Bogosity: Ham, tests=bogofilter, spamicity=0.148210, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: --0000000000000519fe06090ad12a Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Tue, Oct 31, 2023 at 1:26=E2=80=AFPM Matthew Wilcox wrote: > On Tue, Oct 31, 2023 at 10:44:59AM -0700, Sourav Panda wrote: > > +++ b/mm/hugetlb.c > > @@ -1790,6 +1790,10 @@ static void > __update_and_free_hugetlb_folio(struct hstate *h, > > destroy_compound_gigantic_folio(folio, huge_page_order(h)= ); > > free_gigantic_folio(folio, huge_page_order(h)); > > } else { > > +#ifndef CONFIG_SPARSEMEM_VMEMMAP > > + __mod_node_page_state(NODE_DATA(page_to_nid(&folio->page)= ), > > + NR_PAGE_METADATA, > -huge_page_order(h)); > > +#endif > > surely, > __node_stat_sub_folio(folio, NR_PAGE_METADATA) > Thank you for pointing out this. I will replace this __mod_node_page_state call with __node_stat_sub_folio in v4. > > > @@ -2175,7 +2179,9 @@ static struct folio > *alloc_buddy_hugetlb_folio(struct hstate *h, > > __count_vm_event(HTLB_BUDDY_PGALLOC_FAIL); > > return NULL; > > } > > - > > +#ifndef CONFIG_SPARSEMEM_VMEMMAP > > + __mod_node_page_state(NODE_DATA(nid), NR_PAGE_METADATA, > huge_page_order(h)); > > __node_stat_add_folio(folio, NR_PAGE_METADATA) > I agree with this! I will replace this __mod_node_page_state call with __node_stat_add_folio in v4. > > (create the folio first ...) > > > + __mod_node_page_state(NODE_DATA(page_to_nid(page)), > > + NR_PAGE_METADATA, 1); > > Are you allergic to page_pgdat()? > Sorry, I misinterpreted your previous comment to only apply for that Line of code. My sincere apologies. In v4, i will apply this change to the entire patch. > > > @@ -1656,6 +1657,8 @@ static void __init alloc_node_mem_map(struct > pglist_data *pgdat) > > panic("Failed to allocate %ld bytes for node %d > memory map\n", > > size, pgdat->node_id); > > pgdat->node_mem_map =3D map + offset; > > + mod_node_early_perpage_metadata(pgdat->node_id, > > + PAGE_ALIGN(size) >> > PAGE_SHIFT); > > I swear I said to use DIV_ROUND_UP(). Yes, I did: > Yep, you are correct. I missed it. Still getting used to this UI; My bad! I will be careful next time. In v4 I will apply this change to the entire patch. > > https://lore.kernel.org/linux-mm/ZS%2Fm1KRwTLkcJY8y@casper.infradead.org/ > > Why have you done something different and claimed I said to do it? > You've annoyed me now; I shan't review the rest of this. > Sorry for the errors. I will make all the requested changes in v4 and send it as soon as possible. --0000000000000519fe06090ad12a Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable


=
On Tue, Oct 31, 2023 at 1:26=E2=80=AF= PM Matthew Wilcox <willy@infradea= d.org> wrote:
On Tue, Oct 31, 2023 at 10:44:59AM -0700, Sourav Panda wrote:
> +++ b/mm/hugetlb.c
> @@ -1790,6 +1790,10 @@ static void __update_and_free_hugetlb_folio(str= uct hstate *h,
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0destroy_compound= _gigantic_folio(folio, huge_page_order(h));
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0free_gigantic_fo= lio(folio, huge_page_order(h));
>=C2=A0 =C2=A0 =C2=A0 =C2=A0} else {
> +#ifndef CONFIG_SPARSEMEM_VMEMMAP
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0__mod_node_page_state= (NODE_DATA(page_to_nid(&folio->page)),
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0NR_PAGE_METADATA, -= huge_page_order(h));
> +#endif

surely,
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 __node_stat_sub_fol= io(folio, NR_PAGE_METADATA)

Thank you f= or pointing out this. I will replace this __mod_node_page_state call=C2=A0 = with __node_stat_sub_folio in v4.

=C2=A0

> @@ -2175,7 +2179,9 @@ static struct folio *alloc_buddy_hugetlb_folio(s= truct hstate *h,
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0__count_vm_event= (HTLB_BUDDY_PGALLOC_FAIL);
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0return NULL;
>=C2=A0 =C2=A0 =C2=A0 =C2=A0}
> -
> +#ifndef CONFIG_SPARSEMEM_VMEMMAP
> +=C2=A0 =C2=A0 =C2=A0__mod_node_page_state(NODE_DATA(nid), NR_PAGE_MET= ADATA, huge_page_order(h));

=C2=A0 =C2=A0 =C2=A0 =C2=A0 __node_stat_add_folio(folio, NR_PAGE_METADATA)<= br>

I agree with this! I will replace this = __mod_node_page_state call=C2=A0 with __node_stat_add_folio=C2=A0in v4.
=

=C2=A0

(create the folio first ...)

> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0__mod_node_page_state= (NODE_DATA(page_to_nid(page)),
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0NR_PAGE_METADATA, 1= );

Are you allergic to page_pgdat()?

Sorry= , I misinterpreted your previous comment to only apply for that Line of cod= e. My sincere apologies. In v4, i will apply this change to the entire patc= h.
=C2=A0

> @@ -1656,6 +1657,8 @@ static void __init alloc_node_mem_map(struct pgl= ist_data *pgdat)
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0panic("Failed to allocate %ld bytes for node %d memory ma= p\n",
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0size, pgdat->node_id);
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0pgdat->node_m= em_map =3D map + offset;
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0mod_node_early_perpag= e_metadata(pgdat->node_id,
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0PAGE_ALIGN(size) >> PAGE_SHIFT);

I swear I said to use DIV_ROUND_UP().=C2=A0 Yes, I did:

Yep, you are correct. I missed it. Still getting used to t= his UI; My bad! I will be careful next time. In v4 I will apply this change= to the entire patch.
=C2=A0

https://lore.kernel.org/lin= ux-mm/ZS%2Fm1KRwTLkcJY8y@casper.infradead.org/

Why have you done something different and claimed I said to do it?
You've annoyed me now; I shan't review the rest of this.

Sorry for the=C2=A0errors. I will make all the re= quested changes in v4 and send it as soon as possible.
--0000000000000519fe06090ad12a--