Re: [PATCH v5 14/37] lib: introduce support for page allocation tagging

From: Matthew Wilcox
Date: Fri Mar 15 2024 - 10:25:48 EST


On Wed, Mar 06, 2024 at 10:24:12AM -0800, Suren Baghdasaryan wrote:
> +static inline void pgalloc_tag_add(struct page *page, struct task_struct *task,
> + unsigned int order)

If you make this "unsigned int nr" instead of order, (a) it won't look
completely insane (what does adding an order even mean?) and (b) you
can reuse it from the __free_pages path.

> @@ -1101,6 +1102,7 @@ __always_inline bool free_pages_prepare(struct page *page,
> /* Do not let hwpoison pages hit pcplists/buddy */
> reset_page_owner(page, order);
> page_table_check_free(page, order);
> + pgalloc_tag_sub(page, order);

Obviously you'll need to make sure all the callers now pass in 1 <<
order instead of just order.