mm: optimize thread stack usage on ARMv7 [1/1]

PD#SWPL-2681

Problem:
Kernel stack usage is large when running many tasks.

Solution:
Map kernel stack to module space and handle page-fault
for stack fault. This can save about 50% memory of stack
usage

Verify:
p212

Change-Id: Ie894bc8f00cb525ddf8ac63c6d99d9c6e937fdc0
Signed-off-by: tao zeng <tao.zeng@amlogic.com>

Conflicts:
	arch/arm/include/asm/memory.h
	arch/arm/include/asm/thread_info.h
	arch/arm/kernel/entry-armv.S
	arch/arm/kernel/unwind.c
	drivers/amlogic/memory_ext/Kconfig
	drivers/amlogic/memory_ext/vmap_stack.c
This commit is contained in:
tao zeng
2018-11-30 18:01:31 +08:00
committed by Dongjin Kim
parent bb892368ee
commit 3cb9b59d7a
2 changed files with 7 additions and 8 deletions

View File

@@ -30,7 +30,6 @@ CONFIG_EMBEDDED=y
# CONFIG_COMPAT_BRK is not set
CONFIG_PROFILING=y
CONFIG_JUMP_LABEL=y
CONFIG_CC_STACKPROTECTOR_STRONG=y
CONFIG_MODULES=y
CONFIG_MODULE_UNLOAD=y
CONFIG_MODVERSIONS=y

View File

@@ -97,7 +97,7 @@ extern const struct unwind_idx __start_unwind_idx[];
static const struct unwind_idx *__origin_unwind_idx;
extern const struct unwind_idx __stop_unwind_idx[];
static DEFINE_RAW_SPINLOCK(unwind_lock);
static DEFINE_SPINLOCK(unwind_lock);
static LIST_HEAD(unwind_tables);
/* Convert a prel31 symbol to an absolute address */
@@ -205,7 +205,7 @@ static const struct unwind_idx *unwind_find_idx(unsigned long addr)
/* module unwind tables */
struct unwind_table *table;
raw_spin_lock_irqsave(&unwind_lock, flags);
spin_lock_irqsave(&unwind_lock, flags);
list_for_each_entry(table, &unwind_tables, list) {
if (addr >= table->begin_addr &&
addr < table->end_addr) {
@@ -217,7 +217,7 @@ static const struct unwind_idx *unwind_find_idx(unsigned long addr)
break;
}
}
raw_spin_unlock_irqrestore(&unwind_lock, flags);
spin_unlock_irqrestore(&unwind_lock, flags);
}
pr_debug("%s: idx = %p\n", __func__, idx);
@@ -601,9 +601,9 @@ struct unwind_table *unwind_table_add(unsigned long start, unsigned long size,
tab->begin_addr = text_addr;
tab->end_addr = text_addr + text_size;
raw_spin_lock_irqsave(&unwind_lock, flags);
spin_lock_irqsave(&unwind_lock, flags);
list_add_tail(&tab->list, &unwind_tables);
raw_spin_unlock_irqrestore(&unwind_lock, flags);
spin_unlock_irqrestore(&unwind_lock, flags);
return tab;
}
@@ -615,9 +615,9 @@ void unwind_table_del(struct unwind_table *tab)
if (!tab)
return;
raw_spin_lock_irqsave(&unwind_lock, flags);
spin_lock_irqsave(&unwind_lock, flags);
list_del(&tab->list);
raw_spin_unlock_irqrestore(&unwind_lock, flags);
spin_unlock_irqrestore(&unwind_lock, flags);
kfree(tab);
}