Skip to content

Commit

Permalink
alloc_tag: outline and export free_reserved_page()
Browse files Browse the repository at this point in the history
Outline and export free_reserved_page() because modules use it and it in
turn uses page_ext_{get|put} which should not be exported.  The same
result could be obtained by outlining {get|put}_page_tag_ref() but that
would have higher performance impact as these functions are used in more
performance critical paths.

Link: https://lkml.kernel.org/r/[email protected]
Fixes: dcfe378 ("lib: introduce support for page allocation tagging")
Signed-off-by: Suren Baghdasaryan <[email protected]>
Reported-by: kernel test robot <[email protected]>
Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/
Suggested-by: Christoph Hellwig <[email protected]>
Suggested-by: Vlastimil Babka <[email protected]>
Acked-by: Vlastimil Babka <[email protected]>
Cc: Kees Cook <[email protected]>
Cc: Kent Overstreet <[email protected]>
Cc: Pasha Tatashin <[email protected]>
Cc: Sourav Panda <[email protected]>
Cc: <[email protected]>	[6.10]
Signed-off-by: Andrew Morton <[email protected]>
  • Loading branch information
surenbaghdasaryan authored and akpm00 committed Jul 26, 2024
1 parent bf6acd5 commit b3bebe4
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 15 deletions.
16 changes: 1 addition & 15 deletions include/linux/mm.h
Original file line number Diff line number Diff line change
Expand Up @@ -3137,21 +3137,7 @@ extern void reserve_bootmem_region(phys_addr_t start,
phys_addr_t end, int nid);

/* Free the reserved page into the buddy system, so it gets managed. */
static inline void free_reserved_page(struct page *page)
{
if (mem_alloc_profiling_enabled()) {
union codetag_ref *ref = get_page_tag_ref(page);

if (ref) {
set_codetag_empty(ref);
put_page_tag_ref(ref);
}
}
ClearPageReserved(page);
init_page_count(page);
__free_page(page);
adjust_managed_page_count(page, 1);
}
void free_reserved_page(struct page *page);
#define free_highmem_page(page) free_reserved_page(page)

static inline void mark_page_reserved(struct page *page)
Expand Down
17 changes: 17 additions & 0 deletions mm/page_alloc.c
Original file line number Diff line number Diff line change
Expand Up @@ -5815,6 +5815,23 @@ unsigned long free_reserved_area(void *start, void *end, int poison, const char
return pages;
}

void free_reserved_page(struct page *page)
{
if (mem_alloc_profiling_enabled()) {
union codetag_ref *ref = get_page_tag_ref(page);

if (ref) {
set_codetag_empty(ref);
put_page_tag_ref(ref);
}
}
ClearPageReserved(page);
init_page_count(page);
__free_page(page);
adjust_managed_page_count(page, 1);
}
EXPORT_SYMBOL(free_reserved_page);

static int page_alloc_cpu_dead(unsigned int cpu)
{
struct zone *zone;
Expand Down

0 comments on commit b3bebe4

Please sign in to comment.