Re: [PATCH v6 2/2] lib: stackdepot: Add support to disable stack depot

Andrew Morton
2021-01-28T01:02:09Z

On Wed, 27 Jan 2021 17:36:38 +0530 vjitta@codeaurora.org wrote:

> Add a kernel parameter stack_depot_disable to disable
> stack depot. So that stack hash table doesn't consume
> any memory when stack depot is disabled.
>
> The usecase is CONFIG_PAGE_OWNER without page_owner=on.
> Without this patch, stackdepot will consume the memory
> for the hashtable. By default, it's 8M which is never trivial.
>
> With this option, in CONFIG_PAGE_OWNER configured system,
> page_owner=off, stack_depot_disable in kernel command line,
> we could save the wasted memory for the hashtable.

CONFIG_STACKDEPOT=n:

main.c:(.init.text+0x4c1): undefined reference to `stack_depot_init'

--- a/include/linux/stackdepot.h~lib-stackdepot-add-support-to-disable-stack-depot-fix
+++ a/include/linux/stackdepot.h
@@ -21,5 +21,13 @@ unsigned int stack_depot_fetch(depot_sta

unsigned int filter_irq_stacks(unsigned long *entries, unsigned int nr_entries);

+#ifdef CONFIG_STACKDEPOT
int stack_depot_init(void);
+#else
+static inline int stack_depot_init(void)
+{
+ return 0;
+}
+#endif /* CONFIG_STACKDEPOT */
+
#endif
_