author | Tao Zeng <tao.zeng@amlogic.com> | 2019-03-20 06:20:08 (GMT) |
---|---|---|
committer | Tao Zeng <tao.zeng@amlogic.com> | 2019-03-20 08:02:39 (GMT) |
commit | c3b0811727efe85939951761389565cf5913c1b6 (patch) | |
tree | 4517d4b93847a46e625b48767696f29caff82c5a | |
parent | a499d97cac84979441d629ac3e76b74a9ad05848 (diff) | |
download | common-c3b0811727efe85939951761389565cf5913c1b6.zip common-c3b0811727efe85939951761389565cf5913c1b6.tar.gz common-c3b0811727efe85939951761389565cf5913c1b6.tar.bz2 |
numa: fix compile error after open NUMA config [2/2]
PD#SWPL-5301
Problem:
When open NUMA config on ARM64, there is compile error
Solution:
fix some compile problems
Verify:
p212
Change-Id: I1ae9ef975c680e3e5545186aac9ca2b57597bfe4
Signed-off-by: Tao Zeng <tao.zeng@amlogic.com>
-rw-r--r-- | drivers/amlogic/memory_ext/Kconfig | 1 | ||||
-rw-r--r-- | drivers/amlogic/memory_ext/page_trace.c | 17 | ||||
-rw-r--r-- | include/linux/amlogic/page_trace.h | 6 | ||||
-rw-r--r-- | include/linux/mm.h | 20 | ||||
-rw-r--r-- | mm/slab_common.c | 4 |
5 files changed, 38 insertions, 10 deletions
diff --git a/drivers/amlogic/memory_ext/Kconfig b/drivers/amlogic/memory_ext/Kconfig index 65fe232..88856a72 100644 --- a/drivers/amlogic/memory_ext/Kconfig +++ b/drivers/amlogic/memory_ext/Kconfig @@ -11,6 +11,7 @@ config AMLOGIC_PAGE_TRACE 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 diff --git a/drivers/amlogic/memory_ext/page_trace.c b/drivers/amlogic/memory_ext/page_trace.c index 1c2f8ba..4350dbc 100644 --- a/drivers/amlogic/memory_ext/page_trace.c +++ b/drivers/amlogic/memory_ext/page_trace.c @@ -38,7 +38,11 @@ #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 @@ -95,6 +99,14 @@ static struct fun_symbol common_func[] __initdata = { {"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}, @@ -1065,8 +1077,9 @@ void __init page_trace_mem_init(void) * 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; diff --git a/include/linux/amlogic/page_trace.h b/include/linux/amlogic/page_trace.h index 7d72430..300e7ef 100644 --- a/include/linux/amlogic/page_trace.h +++ b/include/linux/amlogic/page_trace.h @@ -92,7 +92,11 @@ static inline struct page_trace *find_page_base(struct page *page) { 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; } diff --git a/include/linux/mm.h b/include/linux/mm.h index b36a674..9983415 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -700,13 +700,25 @@ int alloc_set_pte(struct fault_env *fe, struct mem_cgroup *memcg, */ /* 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) /* diff --git a/mm/slab_common.c b/mm/slab_common.c index 45b23eb..f775c43 100644 --- a/mm/slab_common.c +++ b/mm/slab_common.c @@ -1044,9 +1044,7 @@ static inline void *aml_slub_alloc_large(size_t size, gfp_t flags, int order) 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*/ |