bool "Amlogic trace for page allocate"
depends on AMLOGIC_MEMORY_EXTEND
depends on KALLSYMS
+ depends on !NUMA_BALANCING
default y
help
Amlogic page trace will record function address of caller for page
#define DEBUG_PAGE_TRACE 0
#endif
+#ifdef CONFIG_NUMA
+#define COMMON_CALLER_SIZE 64 /* more function names if NUMA */
+#else
#define COMMON_CALLER_SIZE 32
+#endif
/*
* this is a driver which will hook during page alloc/free and
{"vmalloc", 1},
{"__alloc_page_frag", 1},
{"kmalloc_order", 0},
+#ifdef CONFIG_NUMA
+ {"alloc_pages_current", 1},
+ {"alloc_page_interleave", 1},
+ {"kmalloc_large_node", 1},
+ {"kmem_cache_alloc_node", 1},
+ {"__kmalloc_node", 1},
+ {"alloc_pages_vma", 1},
+#endif
#ifdef CONFIG_SLUB /* for some static symbols not exported in headfile */
{"new_slab", 0},
{"slab_alloc", 0},
* flags, you should disable AMLOGIC_PAGE_TRACE or reduce some page
* flags.
*/
- BUILD_BUG_ON((__NR_PAGEFLAGS + ZONES_WIDTH) > 32);
- BUILD_BUG_ON(NODES_WIDTH > 0);
+ BUILD_BUG_ON((__NR_PAGEFLAGS + ZONES_WIDTH +
+ NODES_WIDTH + SECTIONS_WIDTH +
+ LAST_CPUPID_SHIFT) > 32);
#else
if (page_trace_disable)
return;
{
return NULL;
}
-static unsigned long find_back_trace(void)
+static inline unsigned long find_back_trace(void)
+{
+ return 0;
+}
+static inline unsigned long get_page_trace(struct page *page)
{
return 0;
}
*/
/* Page flags: | [SECTION] | [NODE] | ZONE | [LAST_CPUPID] | ... | FLAGS | */
-#define SECTIONS_PGOFF ((sizeof(unsigned long)*8) - SECTIONS_WIDTH)
-#define NODES_PGOFF (SECTIONS_PGOFF - NODES_WIDTH)
#if defined(CONFIG_AMLOGIC_PAGE_TRACE) && defined(CONFIG_64BIT)
-#define ZONES_PGOFF ((sizeof(unsigned int) * 8) - ZONES_WIDTH)
+/*
+ * We use high 32bit of page->flags for page trace, Make sure:
+ * __NR_PAGEFLAGS : about 21 bits
+ * ZONES_WIDTH : about 2 bits, MAX 4 zone types
+ * NODES_WIDTH : about 2 bits if open CONFIG_NUMA, else 0 bit
+ * SECTIONS_WIDTH : 0 bit if defined CONFIG_SPARSEMEM_VMEMMAP otherwise 18
+ * bits on ARM64
+ * LAST_CPUPID_SHIFT : 0 bit if not define CONFIG_NUMA_BALANCING, otherwise
+ * 8 + NR_CPUS_BITS
+ * All of these macros should be using less than 32bits in total, otherwise
+ * compile will fail
+ */
+#define SECTIONS_PGOFF ((sizeof(unsigned int)*8) - SECTIONS_WIDTH)
#else
-#define ZONES_PGOFF (NODES_PGOFF - ZONES_WIDTH)
+#define SECTIONS_PGOFF ((sizeof(unsigned long)*8) - SECTIONS_WIDTH)
#endif /* CONFIG_AMLOGIC_PAGE_TRACE */
+#define NODES_PGOFF (SECTIONS_PGOFF - NODES_WIDTH)
+#define ZONES_PGOFF (NODES_PGOFF - ZONES_WIDTH)
#define LAST_CPUPID_PGOFF (ZONES_PGOFF - LAST_CPUPID_WIDTH)
/*
unsigned long used_pages = PAGE_ALIGN(size) / PAGE_SIZE;
unsigned long total_pages = 1 << order;
unsigned long saved = 0;
- #ifdef CONFIG_AMLOGIC_PAGE_TRACE
- unsigned long fun;
- #endif
+ unsigned long fun = 0;
int i;
/* record how many pages in first page*/