Skip to content

Commit

Permalink
numa: fix compile error after open NUMA config [2/2]
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
kongsuozt committed Mar 20, 2019
1 parent a499d97 commit c3b0811
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 10 deletions.
1 change: 1 addition & 0 deletions drivers/amlogic/memory_ext/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
17 changes: 15 additions & 2 deletions drivers/amlogic/memory_ext/page_trace.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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},
Expand Down Expand Up @@ -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;
Expand Down
6 changes: 5 additions & 1 deletion include/linux/amlogic/page_trace.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
20 changes: 16 additions & 4 deletions include/linux/mm.h
Original file line number Diff line number Diff line change
Expand Up @@ -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)

/*
Expand Down
4 changes: 1 addition & 3 deletions mm/slab_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -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*/
Expand Down

0 comments on commit c3b0811

Please sign in to comment.