Re: [PATCH v4 5/6] alloc_tag: introduce pgtag_ref_handle to abstract page tag references
From: Suren Baghdasaryan
Date: Thu Oct 24 2024 - 12:26:18 EST
On Wed, Oct 23, 2024 at 2:09 PM Suren Baghdasaryan <surenb@xxxxxxxxxx> wrote:
>
> On Wed, Oct 23, 2024 at 2:00 PM Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> wrote:
> >
> > On Wed, 23 Oct 2024 10:07:58 -0700 Suren Baghdasaryan <surenb@xxxxxxxxxx> wrote:
> >
> > > To simplify later changes to page tag references, introduce new
> > > pgtag_ref_handle type. This allows easy replacement of page_ext
> > > as a storage of page allocation tags.
> > >
> > > ...
> > >
> > > static inline void pgalloc_tag_copy(struct folio *new, struct folio *old)
> > > {
> > > + union pgtag_ref_handle handle;
> > > + union codetag_ref ref;
> > > struct alloc_tag *tag;
> > > - union codetag_ref *ref;
> > >
> > > tag = pgalloc_tag_get(&old->page);
> > > if (!tag)
> > > return;
> > >
> > > - ref = get_page_tag_ref(&new->page);
> > > - if (!ref)
> > > + if (!get_page_tag_ref(&new->page, &ref, &handle))
> > > return;
> > >
> > > /* Clear the old ref to the original allocation tag. */
> > > clear_page_tag_ref(&old->page);
> > > /* Decrement the counters of the tag on get_new_folio. */
> > > - alloc_tag_sub(ref, folio_nr_pages(new));
> > > -
> > > - __alloc_tag_ref_set(ref, tag);
> > > -
> > > - put_page_tag_ref(ref);
> > > + alloc_tag_sub(&ref, folio_nr_pages(new));
> >
> > mm-stable has folio_size(new) here, fixed up.
>
> Oh, right. You merged that patch tonight and I formatted my patchset
> yesterday :)
> Thanks for the fixup.
>
> >
> > I think we aleady discussed this, but there's a crazy amount of
> > inlining here. pgalloc_tag_split() is huge, and has four callsites.
>
> I must have missed that discussion but I am happy to unline this
> function. I think splitting is heavy enough operation that this
> uninlining would not have be noticeable.
Posted requested uninlining at
https://lore.kernel.org/all/20241024162318.1640781-1-surenb@xxxxxxxxxx/
> Thanks!