On Wed, 23 Oct 2024 10:07:58 -0700 Suren Baghdasaryan <sur...@google.com> 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.

I think we aleady discussed this, but there's a crazy amount of
inlining here.  pgalloc_tag_split() is huge, and has four callsites.

Reply via email to