linux/include/linux/page_ext.h
<<
>>
Prefs
   1#ifndef __LINUX_PAGE_EXT_H
   2#define __LINUX_PAGE_EXT_H
   3
   4#include <linux/types.h>
   5#include <linux/stacktrace.h>
   6
   7struct pglist_data;
   8struct page_ext_operations {
   9        bool (*need)(void);
  10        void (*init)(void);
  11};
  12
  13#ifdef CONFIG_PAGE_EXTENSION
  14
  15/*
  16 * page_ext->flags bits:
  17 *
  18 * PAGE_EXT_DEBUG_POISON is set for poisoned pages. This is used to
  19 * implement generic debug pagealloc feature. The pages are filled with
  20 * poison patterns and set this flag after free_pages(). The poisoned
  21 * pages are verified whether the patterns are not corrupted and clear
  22 * the flag before alloc_pages().
  23 */
  24
  25enum page_ext_flags {
  26        PAGE_EXT_DEBUG_POISON,          /* Page is poisoned */
  27        PAGE_EXT_DEBUG_GUARD,
  28        PAGE_EXT_OWNER,
  29#if defined(CONFIG_IDLE_PAGE_TRACKING) && !defined(CONFIG_64BIT)
  30        PAGE_EXT_YOUNG,
  31        PAGE_EXT_IDLE,
  32#endif
  33};
  34
  35/*
  36 * Page Extension can be considered as an extended mem_map.
  37 * A page_ext page is associated with every page descriptor. The
  38 * page_ext helps us add more information about the page.
  39 * All page_ext are allocated at boot or memory hotplug event,
  40 * then the page_ext for pfn always exists.
  41 */
  42struct page_ext {
  43        unsigned long flags;
  44#ifdef CONFIG_PAGE_OWNER
  45        unsigned int order;
  46        gfp_t gfp_mask;
  47        unsigned int nr_entries;
  48        int last_migrate_reason;
  49        unsigned long trace_entries[8];
  50#endif
  51};
  52
  53extern void pgdat_page_ext_init(struct pglist_data *pgdat);
  54
  55#ifdef CONFIG_SPARSEMEM
  56static inline void page_ext_init_flatmem(void)
  57{
  58}
  59extern void page_ext_init(void);
  60#else
  61extern void page_ext_init_flatmem(void);
  62static inline void page_ext_init(void)
  63{
  64}
  65#endif
  66
  67struct page_ext *lookup_page_ext(struct page *page);
  68
  69#else /* !CONFIG_PAGE_EXTENSION */
  70struct page_ext;
  71
  72static inline void pgdat_page_ext_init(struct pglist_data *pgdat)
  73{
  74}
  75
  76static inline struct page_ext *lookup_page_ext(struct page *page)
  77{
  78        return NULL;
  79}
  80
  81static inline void page_ext_init(void)
  82{
  83}
  84
  85static inline void page_ext_init_flatmem(void)
  86{
  87}
  88#endif /* CONFIG_PAGE_EXTENSION */
  89#endif /* __LINUX_PAGE_EXT_H */
  90