#ifndef _LINUX_PAGE_REF_H
#define _LINUX_PAGE_REF_H
#include <linux/atomic.h>
#include <linux/mm_types.h>
#include <linux/page-flags.h>
#include <linux/tracepoint-defs.h>
DECLARE_TRACEPOINT(…);
DECLARE_TRACEPOINT(…);
DECLARE_TRACEPOINT(…);
DECLARE_TRACEPOINT(…);
DECLARE_TRACEPOINT(…);
DECLARE_TRACEPOINT(…);
DECLARE_TRACEPOINT(…);
#ifdef CONFIG_DEBUG_PAGE_REF
#define page_ref_tracepoint_active(t) …
extern void __page_ref_set(struct page *page, int v);
extern void __page_ref_mod(struct page *page, int v);
extern void __page_ref_mod_and_test(struct page *page, int v, int ret);
extern void __page_ref_mod_and_return(struct page *page, int v, int ret);
extern void __page_ref_mod_unless(struct page *page, int v, int u);
extern void __page_ref_freeze(struct page *page, int v, int ret);
extern void __page_ref_unfreeze(struct page *page, int v);
#else
#define page_ref_tracepoint_active …
static inline void __page_ref_set(struct page *page, int v)
{
}
static inline void __page_ref_mod(struct page *page, int v)
{
}
static inline void __page_ref_mod_and_test(struct page *page, int v, int ret)
{
}
static inline void __page_ref_mod_and_return(struct page *page, int v, int ret)
{
}
static inline void __page_ref_mod_unless(struct page *page, int v, int u)
{
}
static inline void __page_ref_freeze(struct page *page, int v, int ret)
{
}
static inline void __page_ref_unfreeze(struct page *page, int v)
{
}
#endif
static inline int page_ref_count(const struct page *page)
{ … }
static inline int folio_ref_count(const struct folio *folio)
{ … }
static inline int page_count(const struct page *page)
{ … }
static inline void set_page_count(struct page *page, int v)
{ … }
static inline void folio_set_count(struct folio *folio, int v)
{ … }
static inline void init_page_count(struct page *page)
{ … }
static inline void page_ref_add(struct page *page, int nr)
{ … }
static inline void folio_ref_add(struct folio *folio, int nr)
{ … }
static inline void page_ref_sub(struct page *page, int nr)
{ … }
static inline void folio_ref_sub(struct folio *folio, int nr)
{ … }
static inline int folio_ref_sub_return(struct folio *folio, int nr)
{ … }
static inline void page_ref_inc(struct page *page)
{ … }
static inline void folio_ref_inc(struct folio *folio)
{ … }
static inline void page_ref_dec(struct page *page)
{ … }
static inline void folio_ref_dec(struct folio *folio)
{ … }
static inline int page_ref_sub_and_test(struct page *page, int nr)
{ … }
static inline int folio_ref_sub_and_test(struct folio *folio, int nr)
{ … }
static inline int page_ref_inc_return(struct page *page)
{ … }
static inline int folio_ref_inc_return(struct folio *folio)
{ … }
static inline int page_ref_dec_and_test(struct page *page)
{ … }
static inline int folio_ref_dec_and_test(struct folio *folio)
{ … }
static inline int page_ref_dec_return(struct page *page)
{ … }
static inline int folio_ref_dec_return(struct folio *folio)
{ … }
static inline bool page_ref_add_unless(struct page *page, int nr, int u)
{ … }
static inline bool folio_ref_add_unless(struct folio *folio, int nr, int u)
{ … }
static inline bool folio_try_get(struct folio *folio)
{ … }
static inline bool folio_ref_try_add(struct folio *folio, int count)
{ … }
static inline int page_ref_freeze(struct page *page, int count)
{ … }
static inline int folio_ref_freeze(struct folio *folio, int count)
{ … }
static inline void page_ref_unfreeze(struct page *page, int count)
{ … }
static inline void folio_ref_unfreeze(struct folio *folio, int count)
{ … }
#endif