162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */
262306a36Sopenharmony_ci#ifndef __LINUX_PAGE_OWNER_H
362306a36Sopenharmony_ci#define __LINUX_PAGE_OWNER_H
462306a36Sopenharmony_ci
562306a36Sopenharmony_ci#include <linux/jump_label.h>
662306a36Sopenharmony_ci
762306a36Sopenharmony_ci#ifdef CONFIG_PAGE_OWNER
862306a36Sopenharmony_ciextern struct static_key_false page_owner_inited;
962306a36Sopenharmony_ciextern struct page_ext_operations page_owner_ops;
1062306a36Sopenharmony_ci
1162306a36Sopenharmony_ciextern void __reset_page_owner(struct page *page, unsigned short order);
1262306a36Sopenharmony_ciextern void __set_page_owner(struct page *page,
1362306a36Sopenharmony_ci			unsigned short order, gfp_t gfp_mask);
1462306a36Sopenharmony_ciextern void __split_page_owner(struct page *page, unsigned int nr);
1562306a36Sopenharmony_ciextern void __folio_copy_owner(struct folio *newfolio, struct folio *old);
1662306a36Sopenharmony_ciextern void __set_page_owner_migrate_reason(struct page *page, int reason);
1762306a36Sopenharmony_ciextern void __dump_page_owner(const struct page *page);
1862306a36Sopenharmony_ciextern void pagetypeinfo_showmixedcount_print(struct seq_file *m,
1962306a36Sopenharmony_ci					pg_data_t *pgdat, struct zone *zone);
2062306a36Sopenharmony_ci
2162306a36Sopenharmony_cistatic inline void reset_page_owner(struct page *page, unsigned short order)
2262306a36Sopenharmony_ci{
2362306a36Sopenharmony_ci	if (static_branch_unlikely(&page_owner_inited))
2462306a36Sopenharmony_ci		__reset_page_owner(page, order);
2562306a36Sopenharmony_ci}
2662306a36Sopenharmony_ci
2762306a36Sopenharmony_cistatic inline void set_page_owner(struct page *page,
2862306a36Sopenharmony_ci			unsigned short order, gfp_t gfp_mask)
2962306a36Sopenharmony_ci{
3062306a36Sopenharmony_ci	if (static_branch_unlikely(&page_owner_inited))
3162306a36Sopenharmony_ci		__set_page_owner(page, order, gfp_mask);
3262306a36Sopenharmony_ci}
3362306a36Sopenharmony_ci
3462306a36Sopenharmony_cistatic inline void split_page_owner(struct page *page, unsigned int nr)
3562306a36Sopenharmony_ci{
3662306a36Sopenharmony_ci	if (static_branch_unlikely(&page_owner_inited))
3762306a36Sopenharmony_ci		__split_page_owner(page, nr);
3862306a36Sopenharmony_ci}
3962306a36Sopenharmony_cistatic inline void folio_copy_owner(struct folio *newfolio, struct folio *old)
4062306a36Sopenharmony_ci{
4162306a36Sopenharmony_ci	if (static_branch_unlikely(&page_owner_inited))
4262306a36Sopenharmony_ci		__folio_copy_owner(newfolio, old);
4362306a36Sopenharmony_ci}
4462306a36Sopenharmony_cistatic inline void set_page_owner_migrate_reason(struct page *page, int reason)
4562306a36Sopenharmony_ci{
4662306a36Sopenharmony_ci	if (static_branch_unlikely(&page_owner_inited))
4762306a36Sopenharmony_ci		__set_page_owner_migrate_reason(page, reason);
4862306a36Sopenharmony_ci}
4962306a36Sopenharmony_cistatic inline void dump_page_owner(const struct page *page)
5062306a36Sopenharmony_ci{
5162306a36Sopenharmony_ci	if (static_branch_unlikely(&page_owner_inited))
5262306a36Sopenharmony_ci		__dump_page_owner(page);
5362306a36Sopenharmony_ci}
5462306a36Sopenharmony_ci#else
5562306a36Sopenharmony_cistatic inline void reset_page_owner(struct page *page, unsigned short order)
5662306a36Sopenharmony_ci{
5762306a36Sopenharmony_ci}
5862306a36Sopenharmony_cistatic inline void set_page_owner(struct page *page,
5962306a36Sopenharmony_ci			unsigned int order, gfp_t gfp_mask)
6062306a36Sopenharmony_ci{
6162306a36Sopenharmony_ci}
6262306a36Sopenharmony_cistatic inline void split_page_owner(struct page *page,
6362306a36Sopenharmony_ci			unsigned short order)
6462306a36Sopenharmony_ci{
6562306a36Sopenharmony_ci}
6662306a36Sopenharmony_cistatic inline void folio_copy_owner(struct folio *newfolio, struct folio *folio)
6762306a36Sopenharmony_ci{
6862306a36Sopenharmony_ci}
6962306a36Sopenharmony_cistatic inline void set_page_owner_migrate_reason(struct page *page, int reason)
7062306a36Sopenharmony_ci{
7162306a36Sopenharmony_ci}
7262306a36Sopenharmony_cistatic inline void dump_page_owner(const struct page *page)
7362306a36Sopenharmony_ci{
7462306a36Sopenharmony_ci}
7562306a36Sopenharmony_ci#endif /* CONFIG_PAGE_OWNER */
7662306a36Sopenharmony_ci#endif /* __LINUX_PAGE_OWNER_H */
77