Skip to content

Commit ff20230

Browse files
brenns10akpm00
authored andcommitted
mm: convert page type macros to enum
Changing PG_slab from a page flag to a page type in commit 46df8e7 ("mm: free up PG_slab") in has the unintended consequence of removing the PG_slab constant from kernel debuginfo. The commit does add the value to the vmcoreinfo note, which allows debuggers to find the value without hardcoding it. However it's most flexible to continue representing the constant with an enum. To that end, convert the page type fields into an enum. Debuggers will now be able to detect that PG_slab's type has changed from enum pageflags to enum pagetype. Link: https://lkml.kernel.org/r/20240607202954.1198180-1-stephen.s.brennan@oracle.com Fixes: 46df8e7 ("mm: free up PG_slab") Signed-off-by: Stephen Brennan <stephen.s.brennan@oracle.com> Acked-by: Vlastimil Babka <vbabka@suse.cz> Cc: David Hildenbrand <david@redhat.com> Cc: Hao Ge <gehao@kylinos.cn> Cc: Matthew Wilcox (Oracle) <willy@infradead.org> Cc: Omar Sandoval <osandov@osandov.com> Cc: Vishal Moola (Oracle) <vishal.moola@gmail.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
1 parent be346c1 commit ff20230

1 file changed

Lines changed: 12 additions & 9 deletions

File tree

include/linux/page-flags.h

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -944,15 +944,18 @@ PAGEFLAG_FALSE(HasHWPoisoned, has_hwpoisoned)
944944
* mistaken for a page type value.
945945
*/
946946

947-
#define PAGE_TYPE_BASE 0xf0000000
948-
/* Reserve 0x0000007f to catch underflows of _mapcount */
949-
#define PAGE_MAPCOUNT_RESERVE -128
950-
#define PG_buddy 0x00000080
951-
#define PG_offline 0x00000100
952-
#define PG_table 0x00000200
953-
#define PG_guard 0x00000400
954-
#define PG_hugetlb 0x00000800
955-
#define PG_slab 0x00001000
947+
enum pagetype {
948+
PG_buddy = 0x00000080,
949+
PG_offline = 0x00000100,
950+
PG_table = 0x00000200,
951+
PG_guard = 0x00000400,
952+
PG_hugetlb = 0x00000800,
953+
PG_slab = 0x00001000,
954+
955+
PAGE_TYPE_BASE = 0xf0000000,
956+
/* Reserve 0x0000007f to catch underflows of _mapcount */
957+
PAGE_MAPCOUNT_RESERVE = -128,
958+
};
956959

957960
#define PageType(page, flag) \
958961
((page->page_type & (PAGE_TYPE_BASE | flag)) == PAGE_TYPE_BASE)

0 commit comments

Comments
 (0)