linux/tools/testing/memblock/internal.h
Shengming Hu 58e3e52654 memblock: drop redundant 'struct page *' argument from memblock_free_pages()
memblock_free_pages() currently takes both a struct page * and the
corresponding PFN. The page pointer is always derived from the PFN at
call sites (pfn_to_page(pfn)), making the parameter redundant and also
allowing accidental mismatches between the two arguments.

Simplify the interface by removing the struct page * argument and
deriving the page locally from the PFN, after the deferred struct page
initialization check. This keeps the behavior unchanged while making
the helper harder to misuse.

Signed-off-by: Shengming Hu <hu.shengming@zte.com.cn>
Reviewed-by: David Hildenbrand (Red Hat) <david@kernel.org>
Link: https://patch.msgid.link/tencent_F741CE6ECC49EE099736685E60C0DBD4A209@qq.com
Signed-off-by: Mike Rapoport (Microsoft) <rppt@kernel.org>
2026-01-09 11:53:51 +02:00

32 lines
597 B
C

/* SPDX-License-Identifier: GPL-2.0-or-later */
#ifndef _MM_INTERNAL_H
#define _MM_INTERNAL_H
/*
* Enable memblock_dbg() messages
*/
#ifdef MEMBLOCK_DEBUG
static int memblock_debug = 1;
#endif
#define pr_warn_ratelimited(fmt, ...) printf(fmt, ##__VA_ARGS__)
bool mirrored_kernelcore = false;
struct page {};
void memblock_free_pages(unsigned long pfn, unsigned int order)
{
}
static inline void accept_memory(phys_addr_t start, unsigned long size)
{
}
static inline unsigned long free_reserved_area(void *start, void *end,
int poison, const char *s)
{
return 0;
}
#endif