Re: [PATCH v3 1/1] mm: report per-page metadata information

Sourav Panda
2023-10-31T22:38:45Z

[-- Attachment #1: Type: text/plain, Size: 2750 bytes --]

On Tue, Oct 31, 2023 at 1:26 PM Matthew Wilcox <willy@infradead.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(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 = 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.

[-- Attachment #2: Type: text/html, Size: 4227 bytes --]