Skip to content

Commit 787fe1d

Browse files
committed
Merge tag 'memblock-v7.0-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rppt/memblock
Pull memblock updates from Mike Rapoport: - update tools/include/linux/mm.h to fix memblock tests compilation - drop redundant struct page* parameter from memblock_free_pages() and get struct page from the pfn - add underflow detection for size calculation in memtest and warn about underflow when VM_DEBUG is enabled * tag 'memblock-v7.0-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rppt/memblock: mm/memtest: add underflow detection for size calculation memblock: drop redundant 'struct page *' argument from memblock_free_pages() memblock test: include <linux/sizes.h> from tools mm.h stub
2 parents 8b3c75a + f56ccc3 commit 787fe1d

6 files changed

Lines changed: 10 additions & 8 deletions

File tree

mm/internal.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -809,8 +809,7 @@ static inline void clear_zone_contiguous(struct zone *zone)
809809
extern int __isolate_free_page(struct page *page, unsigned int order);
810810
extern void __putback_isolated_page(struct page *page, unsigned int order,
811811
int mt);
812-
extern void memblock_free_pages(struct page *page, unsigned long pfn,
813-
unsigned int order);
812+
extern void memblock_free_pages(unsigned long pfn, unsigned int order);
814813
extern void __free_pages_core(struct page *page, unsigned int order,
815814
enum meminit_context context);
816815

mm/memblock.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1772,7 +1772,7 @@ void __init memblock_free_late(phys_addr_t base, phys_addr_t size)
17721772
end = PFN_DOWN(base + size);
17731773

17741774
for (; cursor < end; cursor++) {
1775-
memblock_free_pages(pfn_to_page(cursor), cursor, 0);
1775+
memblock_free_pages(cursor, 0);
17761776
totalram_pages_inc();
17771777
}
17781778
}
@@ -2217,7 +2217,7 @@ static void __init __free_pages_memory(unsigned long start, unsigned long end)
22172217
while (start + (1UL << order) > end)
22182218
order--;
22192219

2220-
memblock_free_pages(pfn_to_page(start), start, order);
2220+
memblock_free_pages(start, order);
22212221

22222222
start += (1UL << order);
22232223
}

mm/memtest.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,8 @@ static void __init memtest(u64 pattern, phys_addr_t start_phys, phys_addr_t size
5050
start_bad = 0;
5151
last_bad = 0;
5252

53+
VM_WARN_ON_ONCE(size < start_phys_aligned - start_phys);
54+
5355
for (p = start; p < end; p++)
5456
WRITE_ONCE(*p, pattern);
5557

mm/mm_init.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2474,9 +2474,10 @@ void *__init alloc_large_system_hash(const char *tablename,
24742474
return table;
24752475
}
24762476

2477-
void __init memblock_free_pages(struct page *page, unsigned long pfn,
2478-
unsigned int order)
2477+
void __init memblock_free_pages(unsigned long pfn, unsigned int order)
24792478
{
2479+
struct page *page = pfn_to_page(pfn);
2480+
24802481
if (IS_ENABLED(CONFIG_DEFERRED_STRUCT_PAGE_INIT)) {
24812482
int nid = early_pfn_to_nid(pfn);
24822483

tools/include/linux/mm.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
#include <linux/align.h>
66
#include <linux/mmzone.h>
7+
#include <linux/sizes.h>
78

89
#define PAGE_SHIFT 12
910
#define PAGE_SIZE (_AC(1, UL) << PAGE_SHIFT)

tools/testing/memblock/internal.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,7 @@ bool mirrored_kernelcore = false;
1515

1616
struct page {};
1717

18-
void memblock_free_pages(struct page *page, unsigned long pfn,
19-
unsigned int order)
18+
void memblock_free_pages(unsigned long pfn, unsigned int order)
2019
{
2120
}
2221

0 commit comments

Comments
 (0)