mirror of
https://github.com/torvalds/linux.git
synced 2024-11-11 06:31:49 +00:00
mm: create FOLIO_FLAG_FALSE and FOLIO_TYPE_OPS macros
Following the separation of FOLIO_FLAGS from PAGEFLAGS, separate
FOLIO_FLAG_FALSE from PAGEFLAG_FALSE and FOLIO_TYPE_OPS from
PAGE_TYPE_OPS.
Link: https://lkml.kernel.org/r/20240321142448.1645400-3-willy@infradead.org
Fixes: 9c5ccf2db0
("mm: remove HUGETLB_PAGE_DTOR")
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Reviewed-by: David Hildenbrand <david@redhat.com>
Acked-by: Vlastimil Babka <vbabka@suse.cz>
Cc: Miaohe Lin <linmiaohe@huawei.com>
Cc: Muchun Song <muchun.song@linux.dev>
Cc: Oscar Salvador <osalvador@suse.de>
Cc: <stable@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
This commit is contained in:
parent
b76b46902c
commit
12bbaae763
@ -458,30 +458,51 @@ static __always_inline int TestClearPage##uname(struct page *page) \
|
||||
TESTSETFLAG(uname, lname, policy) \
|
||||
TESTCLEARFLAG(uname, lname, policy)
|
||||
|
||||
#define FOLIO_TEST_FLAG_FALSE(name) \
|
||||
static inline bool folio_test_##name(const struct folio *folio) \
|
||||
{ return false; }
|
||||
#define FOLIO_SET_FLAG_NOOP(name) \
|
||||
static inline void folio_set_##name(struct folio *folio) { }
|
||||
#define FOLIO_CLEAR_FLAG_NOOP(name) \
|
||||
static inline void folio_clear_##name(struct folio *folio) { }
|
||||
#define __FOLIO_SET_FLAG_NOOP(name) \
|
||||
static inline void __folio_set_##name(struct folio *folio) { }
|
||||
#define __FOLIO_CLEAR_FLAG_NOOP(name) \
|
||||
static inline void __folio_clear_##name(struct folio *folio) { }
|
||||
#define FOLIO_TEST_SET_FLAG_FALSE(name) \
|
||||
static inline bool folio_test_set_##name(struct folio *folio) \
|
||||
{ return false; }
|
||||
#define FOLIO_TEST_CLEAR_FLAG_FALSE(name) \
|
||||
static inline bool folio_test_clear_##name(struct folio *folio) \
|
||||
{ return false; }
|
||||
|
||||
#define FOLIO_FLAG_FALSE(name) \
|
||||
FOLIO_TEST_FLAG_FALSE(name) \
|
||||
FOLIO_SET_FLAG_NOOP(name) \
|
||||
FOLIO_CLEAR_FLAG_NOOP(name)
|
||||
|
||||
#define TESTPAGEFLAG_FALSE(uname, lname) \
|
||||
static inline bool folio_test_##lname(const struct folio *folio) { return false; } \
|
||||
FOLIO_TEST_FLAG_FALSE(lname) \
|
||||
static inline int Page##uname(const struct page *page) { return 0; }
|
||||
|
||||
#define SETPAGEFLAG_NOOP(uname, lname) \
|
||||
static inline void folio_set_##lname(struct folio *folio) { } \
|
||||
FOLIO_SET_FLAG_NOOP(lname) \
|
||||
static inline void SetPage##uname(struct page *page) { }
|
||||
|
||||
#define CLEARPAGEFLAG_NOOP(uname, lname) \
|
||||
static inline void folio_clear_##lname(struct folio *folio) { } \
|
||||
FOLIO_CLEAR_FLAG_NOOP(lname) \
|
||||
static inline void ClearPage##uname(struct page *page) { }
|
||||
|
||||
#define __CLEARPAGEFLAG_NOOP(uname, lname) \
|
||||
static inline void __folio_clear_##lname(struct folio *folio) { } \
|
||||
__FOLIO_CLEAR_FLAG_NOOP(lname) \
|
||||
static inline void __ClearPage##uname(struct page *page) { }
|
||||
|
||||
#define TESTSETFLAG_FALSE(uname, lname) \
|
||||
static inline bool folio_test_set_##lname(struct folio *folio) \
|
||||
{ return 0; } \
|
||||
FOLIO_TEST_SET_FLAG_FALSE(lname) \
|
||||
static inline int TestSetPage##uname(struct page *page) { return 0; }
|
||||
|
||||
#define TESTCLEARFLAG_FALSE(uname, lname) \
|
||||
static inline bool folio_test_clear_##lname(struct folio *folio) \
|
||||
{ return 0; } \
|
||||
FOLIO_TEST_CLEAR_FLAG_FALSE(lname) \
|
||||
static inline int TestClearPage##uname(struct page *page) { return 0; }
|
||||
|
||||
#define PAGEFLAG_FALSE(uname, lname) TESTPAGEFLAG_FALSE(uname, lname) \
|
||||
@ -977,35 +998,38 @@ static inline int page_has_type(const struct page *page)
|
||||
return page_type_has_type(page->page_type);
|
||||
}
|
||||
|
||||
#define PAGE_TYPE_OPS(uname, lname, fname) \
|
||||
static __always_inline int Page##uname(const struct page *page) \
|
||||
{ \
|
||||
return PageType(page, PG_##lname); \
|
||||
} \
|
||||
static __always_inline int folio_test_##fname(const struct folio *folio)\
|
||||
#define FOLIO_TYPE_OPS(lname, fname) \
|
||||
static __always_inline bool folio_test_##fname(const struct folio *folio)\
|
||||
{ \
|
||||
return folio_test_type(folio, PG_##lname); \
|
||||
} \
|
||||
static __always_inline void __SetPage##uname(struct page *page) \
|
||||
{ \
|
||||
VM_BUG_ON_PAGE(!PageType(page, 0), page); \
|
||||
page->page_type &= ~PG_##lname; \
|
||||
} \
|
||||
static __always_inline void __folio_set_##fname(struct folio *folio) \
|
||||
{ \
|
||||
VM_BUG_ON_FOLIO(!folio_test_type(folio, 0), folio); \
|
||||
folio->page.page_type &= ~PG_##lname; \
|
||||
} \
|
||||
static __always_inline void __ClearPage##uname(struct page *page) \
|
||||
{ \
|
||||
VM_BUG_ON_PAGE(!Page##uname(page), page); \
|
||||
page->page_type |= PG_##lname; \
|
||||
} \
|
||||
static __always_inline void __folio_clear_##fname(struct folio *folio) \
|
||||
{ \
|
||||
VM_BUG_ON_FOLIO(!folio_test_##fname(folio), folio); \
|
||||
folio->page.page_type |= PG_##lname; \
|
||||
}
|
||||
|
||||
#define PAGE_TYPE_OPS(uname, lname, fname) \
|
||||
FOLIO_TYPE_OPS(lname, fname) \
|
||||
static __always_inline int Page##uname(const struct page *page) \
|
||||
{ \
|
||||
return PageType(page, PG_##lname); \
|
||||
} \
|
||||
static __always_inline void __SetPage##uname(struct page *page) \
|
||||
{ \
|
||||
VM_BUG_ON_PAGE(!PageType(page, 0), page); \
|
||||
page->page_type &= ~PG_##lname; \
|
||||
} \
|
||||
static __always_inline void __ClearPage##uname(struct page *page) \
|
||||
{ \
|
||||
VM_BUG_ON_PAGE(!Page##uname(page), page); \
|
||||
page->page_type |= PG_##lname; \
|
||||
}
|
||||
|
||||
/*
|
||||
* PageBuddy() indicates that the page is free and in the buddy system
|
||||
|
Loading…
Reference in New Issue
Block a user