mirror of
https://github.com/torvalds/linux.git
synced 2026-09-14 16:10:02 +02:00
mm: move some stuff to mm/page_alloc.h
Some of this stuff in the public header is only used internally so shrink the scope to avoid silently growing new users. drain_local_pages() is still used from kernel/power/snapshot.c so that needs to stay behind. Link: https://lore.kernel.org/20260703-alloc-trylock-v5-7-c87b714e19d3@google.com Signed-off-by: Brendan Jackman <jackmanb@google.com> Reviewed-by: Vlastimil Babka (SUSE) <vbabka@kernel.org> Reviewed-by: Zi Yan <ziy@nvidia.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
This commit is contained in:
parent
ba26999e7c
commit
6f414dbf21
|
|
@ -17,28 +17,6 @@ struct mempolicy;
|
|||
#define __default_gfp(a,b,...) b
|
||||
#define default_gfp(...) __default_gfp(,##__VA_ARGS__,GFP_KERNEL)
|
||||
|
||||
/* Convert GFP flags to their corresponding migrate type */
|
||||
#define GFP_MOVABLE_MASK (__GFP_RECLAIMABLE|__GFP_MOVABLE)
|
||||
#define GFP_MOVABLE_SHIFT 3
|
||||
|
||||
static inline int gfp_migratetype(const gfp_t gfp_flags)
|
||||
{
|
||||
VM_WARN_ON((gfp_flags & GFP_MOVABLE_MASK) == GFP_MOVABLE_MASK);
|
||||
BUILD_BUG_ON((1UL << GFP_MOVABLE_SHIFT) != ___GFP_MOVABLE);
|
||||
BUILD_BUG_ON((___GFP_MOVABLE >> GFP_MOVABLE_SHIFT) != MIGRATE_MOVABLE);
|
||||
BUILD_BUG_ON((___GFP_RECLAIMABLE >> GFP_MOVABLE_SHIFT) != MIGRATE_RECLAIMABLE);
|
||||
BUILD_BUG_ON(((___GFP_MOVABLE | ___GFP_RECLAIMABLE) >>
|
||||
GFP_MOVABLE_SHIFT) != MIGRATE_HIGHATOMIC);
|
||||
|
||||
if (unlikely(page_group_by_mobility_disabled))
|
||||
return MIGRATE_UNMOVABLE;
|
||||
|
||||
/* Group based on mobility */
|
||||
return (__force unsigned long)(gfp_flags & GFP_MOVABLE_MASK) >> GFP_MOVABLE_SHIFT;
|
||||
}
|
||||
#undef GFP_MOVABLE_MASK
|
||||
#undef GFP_MOVABLE_SHIFT
|
||||
|
||||
static inline bool gfpflags_allow_blocking(const gfp_t gfp_flags)
|
||||
{
|
||||
return !!(gfp_flags & __GFP_DIRECT_RECLAIM);
|
||||
|
|
@ -395,10 +373,6 @@ extern void free_pages(unsigned long addr, unsigned int order);
|
|||
#define __free_page(page) __free_pages((page), 0)
|
||||
#define free_page(addr) free_pages((addr), 0)
|
||||
|
||||
void page_alloc_init_cpuhp(void);
|
||||
bool decay_pcp_high(struct zone *zone, struct per_cpu_pages *pcp);
|
||||
void drain_zone_pages(struct zone *zone, struct per_cpu_pages *pcp);
|
||||
void drain_all_pages(struct zone *zone);
|
||||
void drain_local_pages(struct zone *zone);
|
||||
|
||||
void page_alloc_init_late(void);
|
||||
|
|
|
|||
|
|
@ -266,6 +266,33 @@ static inline bool free_area_empty(struct free_area *area, int migratetype)
|
|||
return list_empty(&area->free_list[migratetype]);
|
||||
}
|
||||
|
||||
/* Convert GFP flags to their corresponding migrate type */
|
||||
#define GFP_MOVABLE_MASK (__GFP_RECLAIMABLE|__GFP_MOVABLE)
|
||||
#define GFP_MOVABLE_SHIFT 3
|
||||
|
||||
static inline int gfp_migratetype(const gfp_t gfp_flags)
|
||||
{
|
||||
VM_WARN_ON((gfp_flags & GFP_MOVABLE_MASK) == GFP_MOVABLE_MASK);
|
||||
BUILD_BUG_ON((1UL << GFP_MOVABLE_SHIFT) != ___GFP_MOVABLE);
|
||||
BUILD_BUG_ON((___GFP_MOVABLE >> GFP_MOVABLE_SHIFT) != MIGRATE_MOVABLE);
|
||||
BUILD_BUG_ON((___GFP_RECLAIMABLE >> GFP_MOVABLE_SHIFT) != MIGRATE_RECLAIMABLE);
|
||||
BUILD_BUG_ON(((___GFP_MOVABLE | ___GFP_RECLAIMABLE) >>
|
||||
GFP_MOVABLE_SHIFT) != MIGRATE_HIGHATOMIC);
|
||||
|
||||
if (unlikely(page_group_by_mobility_disabled))
|
||||
return MIGRATE_UNMOVABLE;
|
||||
|
||||
/* Group based on mobility */
|
||||
return (__force unsigned long)(gfp_flags & GFP_MOVABLE_MASK) >> GFP_MOVABLE_SHIFT;
|
||||
}
|
||||
#undef GFP_MOVABLE_MASK
|
||||
#undef GFP_MOVABLE_SHIFT
|
||||
|
||||
bool decay_pcp_high(struct zone *zone, struct per_cpu_pages *pcp);
|
||||
void drain_zone_pages(struct zone *zone, struct per_cpu_pages *pcp);
|
||||
void drain_all_pages(struct zone *zone);
|
||||
|
||||
void page_alloc_init_cpuhp(void);
|
||||
void page_alloc_sysctl_init(void);
|
||||
|
||||
#endif /* __MM_PAGE_ALLOC_H */
|
||||
|
|
|
|||
|
|
@ -30,6 +30,7 @@
|
|||
#include <linux/sched/isolation.h>
|
||||
|
||||
#include "internal.h"
|
||||
#include "page_alloc.h"
|
||||
|
||||
#ifdef CONFIG_PROC_FS
|
||||
#ifdef CONFIG_NUMA
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user