Commit aa486552 authored by Linus Torvalds's avatar Linus Torvalds
Browse files
Pull memblock updates from Mike Rapoport:

 - new memblock_estimated_nr_free_pages() helper to replace
   totalram_pages() which is less accurate when
   CONFIG_DEFERRED_STRUCT_PAGE_INIT is set

 - fixes for memblock tests

* tag 'memblock-v6.12-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rppt/memblock:
  s390/mm: get estimated free pages by memblock api
  kernel/fork.c: get estimated free pages by memblock api
  mm/memblock: introduce a new helper memblock_estimated_nr_free_pages()
  memblock test: fix implicit declaration of function 'strscpy'
  memblock test: fix implicit declaration of function 'isspace'
  memblock test: fix implicit declaration of function 'memparse'
  memblock test: add the definition of __setup()
  memblock test: fix implicit declaration of function 'virt_to_phys'
  tools/testing: abstract two init.h into common include directory
  memblock tests: include export.h in linkage.h as kernel dose
  memblock tests: include memory_hotplug.h in mmzone.h as kernel dose
parents eb5b0f98 cb088e38
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -62,7 +62,7 @@ EXPORT_SYMBOL(zero_page_mask);

static void __init setup_zero_pages(void)
{
	unsigned long total_pages = PHYS_PFN(memblock_phys_mem_size() - memblock_reserved_size());
	unsigned long total_pages = memblock_estimated_nr_free_pages();
	unsigned int order;
	struct page *page;
	int i;
+1 −0
Original line number Diff line number Diff line
@@ -467,6 +467,7 @@ static inline __init_memblock bool memblock_bottom_up(void)

phys_addr_t memblock_phys_mem_size(void);
phys_addr_t memblock_reserved_size(void);
unsigned long memblock_estimated_nr_free_pages(void);
phys_addr_t memblock_start_of_DRAM(void);
phys_addr_t memblock_end_of_DRAM(void);
void memblock_enforce_memory_limit(phys_addr_t memory_limit);
+1 −1
Original line number Diff line number Diff line
@@ -999,7 +999,7 @@ void __init __weak arch_task_cache_init(void) { }
static void __init set_max_threads(unsigned int max_threads_suggested)
{
	u64 threads;
	unsigned long nr_pages = PHYS_PFN(memblock_phys_mem_size() - memblock_reserved_size());
	unsigned long nr_pages = memblock_estimated_nr_free_pages();

	/*
	 * The number of threads shall be limited such that the thread
+17 −0
Original line number Diff line number Diff line
@@ -1731,6 +1731,23 @@ phys_addr_t __init_memblock memblock_reserved_size(void)
	return memblock.reserved.total_size;
}

/**
 * memblock_estimated_nr_free_pages - return estimated number of free pages
 * from memblock point of view
 *
 * During bootup, subsystems might need a rough estimate of the number of free
 * pages in the whole system, before precise numbers are available from the
 * buddy. Especially with CONFIG_DEFERRED_STRUCT_PAGE_INIT, the numbers
 * obtained from the buddy might be very imprecise during bootup.
 *
 * Return:
 * An estimated number of free pages from memblock point of view.
 */
unsigned long __init memblock_estimated_nr_free_pages(void)
{
	return PHYS_PFN(memblock_phys_mem_size() - memblock_reserved_size());
}

/* lowest address */
phys_addr_t __init_memblock memblock_start_of_DRAM(void)
{
+0 −4
Original line number Diff line number Diff line
@@ -128,10 +128,6 @@
# define unlikely(x)		__builtin_expect(!!(x), 0)
#endif

#ifndef __init
# define __init
#endif

#include <linux/types.h>

/*
Loading