Skip to content

Commit c5e97ed

Browse files
Matthew Wilcox (Oracle)tehcaster
authored andcommitted
bootmem: Use page->index instead of page->freelist
page->freelist is for the use of slab. Using page->index is the same set of bits as page->freelist, and by using an integer instead of a pointer, we can avoid casts. Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org> Signed-off-by: Vlastimil Babka <vbabka@suse.cz> Acked-by: Johannes Weiner <hannes@cmpxchg.org> Cc: Dave Hansen <dave.hansen@linux.intel.com> Cc: Andy Lutomirski <luto@kernel.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: Ingo Molnar <mingo@redhat.com> Cc: Borislav Petkov <bp@alien8.de> Cc: <x86@kernel.org> Cc: "H. Peter Anvin" <hpa@zytor.com>
1 parent ffedd09 commit c5e97ed

File tree

4 files changed

+6
-7
lines changed

4 files changed

+6
-7
lines changed

arch/x86/mm/init_64.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -981,7 +981,7 @@ static void __meminit free_pagetable(struct page *page, int order)
981981
if (PageReserved(page)) {
982982
__ClearPageReserved(page);
983983

984-
magic = (unsigned long)page->freelist;
984+
magic = page->index;
985985
if (magic == SECTION_INFO || magic == MIX_SECTION_INFO) {
986986
while (nr_pages--)
987987
put_page_bootmem(page++);

include/linux/bootmem_info.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ void put_page_bootmem(struct page *page);
3030
*/
3131
static inline void free_bootmem_page(struct page *page)
3232
{
33-
unsigned long magic = (unsigned long)page->freelist;
33+
unsigned long magic = page->index;
3434

3535
/*
3636
* The reserve_bootmem_region sets the reserved flag on bootmem

mm/bootmem_info.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,22 +15,21 @@
1515

1616
void get_page_bootmem(unsigned long info, struct page *page, unsigned long type)
1717
{
18-
page->freelist = (void *)type;
18+
page->index = type;
1919
SetPagePrivate(page);
2020
set_page_private(page, info);
2121
page_ref_inc(page);
2222
}
2323

2424
void put_page_bootmem(struct page *page)
2525
{
26-
unsigned long type;
26+
unsigned long type = page->index;
2727

28-
type = (unsigned long) page->freelist;
2928
BUG_ON(type < MEMORY_HOTPLUG_MIN_BOOTMEM_TYPE ||
3029
type > MEMORY_HOTPLUG_MAX_BOOTMEM_TYPE);
3130

3231
if (page_ref_dec_return(page) == 1) {
33-
page->freelist = NULL;
32+
page->index = 0;
3433
ClearPagePrivate(page);
3534
set_page_private(page, 0);
3635
INIT_LIST_HEAD(&page->lru);

mm/sparse.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -722,7 +722,7 @@ static void free_map_bootmem(struct page *memmap)
722722
>> PAGE_SHIFT;
723723

724724
for (i = 0; i < nr_pages; i++, page++) {
725-
magic = (unsigned long) page->freelist;
725+
magic = page->index;
726726

727727
BUG_ON(magic == NODE_INFO);
728728

0 commit comments

Comments
 (0)