Commit 787fe1d4 authored by Linus Torvalds's avatar Linus Torvalds
Browse files
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
parents 8b3c75a3 f56ccc32
Loading
Loading
Loading
Loading
+1 −2
Original line number Diff line number Diff line
@@ -809,8 +809,7 @@ static inline void clear_zone_contiguous(struct zone *zone)
extern int __isolate_free_page(struct page *page, unsigned int order);
extern void __putback_isolated_page(struct page *page, unsigned int order,
				    int mt);
extern void memblock_free_pages(struct page *page, unsigned long pfn,
					unsigned int order);
extern void memblock_free_pages(unsigned long pfn, unsigned int order);
extern void __free_pages_core(struct page *page, unsigned int order,
		enum meminit_context context);

+2 −2
Original line number Diff line number Diff line
@@ -1772,7 +1772,7 @@ void __init memblock_free_late(phys_addr_t base, phys_addr_t size)
	end = PFN_DOWN(base + size);

	for (; cursor < end; cursor++) {
		memblock_free_pages(pfn_to_page(cursor), cursor, 0);
		memblock_free_pages(cursor, 0);
		totalram_pages_inc();
	}
}
@@ -2217,7 +2217,7 @@ static void __init __free_pages_memory(unsigned long start, unsigned long end)
		while (start + (1UL << order) > end)
			order--;

		memblock_free_pages(pfn_to_page(start), start, order);
		memblock_free_pages(start, order);

		start += (1UL << order);
	}
+2 −0
Original line number Diff line number Diff line
@@ -50,6 +50,8 @@ static void __init memtest(u64 pattern, phys_addr_t start_phys, phys_addr_t size
	start_bad = 0;
	last_bad = 0;

	VM_WARN_ON_ONCE(size < start_phys_aligned - start_phys);

	for (p = start; p < end; p++)
		WRITE_ONCE(*p, pattern);

+3 −2
Original line number Diff line number Diff line
@@ -2474,9 +2474,10 @@ void *__init alloc_large_system_hash(const char *tablename,
	return table;
}

void __init memblock_free_pages(struct page *page, unsigned long pfn,
							unsigned int order)
void __init memblock_free_pages(unsigned long pfn, unsigned int order)
{
	struct page *page = pfn_to_page(pfn);

	if (IS_ENABLED(CONFIG_DEFERRED_STRUCT_PAGE_INIT)) {
		int nid = early_pfn_to_nid(pfn);

+1 −0
Original line number Diff line number Diff line
@@ -4,6 +4,7 @@

#include <linux/align.h>
#include <linux/mmzone.h>
#include <linux/sizes.h>

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