* [PATCH 0/2] ARC: fix the THREAD_SHIFT definition
@ 2023-05-11 17:01 Min-Hua Chen
2023-05-11 17:01 ` [PATCH 1/2] ARC: fix incorrect " Min-Hua Chen
2023-05-11 17:01 ` [PATCH 2/2] ARC: rename 16KSTACKS to DEBUG_STACKS Min-Hua Chen
0 siblings, 2 replies; 3+ messages in thread
From: Min-Hua Chen @ 2023-05-11 17:01 UTC (permalink / raw)
To: Vineet Gupta; +Cc: Min-Hua Chen, linux-snps-arc, linux-kernel
Hi,
When I read the arch/arc code, I first found that the
definition of THREAD_SHIFT looks incorrect and the
description of 16KSTACKS looks confusing. I submit
these 2 small patches to address the issue I found.
Min-Hua Chen (2):
ARC: fix incorrect THREAD_SHIFT definition
ARC: rename 16KSTACKS to DEBUG_STACKS
arch/arc/Kconfig.debug | 7 ++++---
arch/arc/include/asm/thread_info.h | 4 ++--
2 files changed, 6 insertions(+), 5 deletions(-)
--
2.34.1
_______________________________________________
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH 1/2] ARC: fix incorrect THREAD_SHIFT definition
2023-05-11 17:01 [PATCH 0/2] ARC: fix the THREAD_SHIFT definition Min-Hua Chen
@ 2023-05-11 17:01 ` Min-Hua Chen
2023-05-11 17:01 ` [PATCH 2/2] ARC: rename 16KSTACKS to DEBUG_STACKS Min-Hua Chen
1 sibling, 0 replies; 3+ messages in thread
From: Min-Hua Chen @ 2023-05-11 17:01 UTC (permalink / raw)
To: Vineet Gupta; +Cc: Min-Hua Chen, linux-snps-arc, linux-kernel
Current definition of THREAD_SHIFT is (PAGE_SHIFT << THREAD_SIZE_ORDER)
look incorrect. It should be (PAGE_SHIFT + THREAD_SIZE_ORDER) because
the following equation should hold:
Say PAGE_SHIFT == 13 (as the default value in ARC)
THREAD_SIZE_ORDER == 1 (as CONFIG_16KSTACKS=y)
THREAD_SIZE == (1 << THREAD_SHIFT)
== (1 << (PAGE_SHIFT + THREAD_SIZE_ORDER))
== (1 << 14)
== 16KB
Signed-off-by: Min-Hua Chen <minhuadotchen@gmail.com>
---
arch/arc/include/asm/thread_info.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/arc/include/asm/thread_info.h b/arch/arc/include/asm/thread_info.h
index 6ba7fe417095..9f9dd021501c 100644
--- a/arch/arc/include/asm/thread_info.h
+++ b/arch/arc/include/asm/thread_info.h
@@ -22,7 +22,7 @@
#endif
#define THREAD_SIZE (PAGE_SIZE << THREAD_SIZE_ORDER)
-#define THREAD_SHIFT (PAGE_SHIFT << THREAD_SIZE_ORDER)
+#define THREAD_SHIFT (PAGE_SHIFT + THREAD_SIZE_ORDER)
#ifndef __ASSEMBLY__
--
2.34.1
_______________________________________________
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH 2/2] ARC: rename 16KSTACKS to DEBUG_STACKS
2023-05-11 17:01 [PATCH 0/2] ARC: fix the THREAD_SHIFT definition Min-Hua Chen
2023-05-11 17:01 ` [PATCH 1/2] ARC: fix incorrect " Min-Hua Chen
@ 2023-05-11 17:01 ` Min-Hua Chen
1 sibling, 0 replies; 3+ messages in thread
From: Min-Hua Chen @ 2023-05-11 17:01 UTC (permalink / raw)
To: Vineet Gupta; +Cc: Min-Hua Chen, linux-snps-arc, linux-kernel
Rename 16KSTACKS to DEBUG_STACKS.
arch/arc/Kconfig.debug says that the default stack size is 8KB
and it will become 16KB stack if 16KSTACKS is set.
However, the stack size is based on PAGE_SIZE, and it is
configurable by CONFIG_ARC_PAGE_SIZE_16K or CONFIG_ARC_PAGE_SIZE_4K.
See arch/arc/include/uapi/asm/page.h:
/* PAGE_SHIFT determines the page size */
\#if defined(CONFIG_ARC_PAGE_SIZE_16K)
\#define PAGE_SHIFT 14
\#elif defined(CONFIG_ARC_PAGE_SIZE_4K)
\#define PAGE_SHIFT 12
\#else
\#define PAGE_SHIFT 13
\#endif
See arch/arc/include/asm/thread_info.h:
\#ifdef CONFIG_DEBUG_STACKS
\#define THREAD_SIZE_ORDER 1
\#else
\#define THREAD_SIZE_ORDER 0
\#endif
\#define THREAD_SIZE (PAGE_SIZE << THREAD_SIZE_ORDER)
\#define THREAD_SHIFT (PAGE_SHIFT + THREAD_SIZE_ORDER)
To make CONFIG_16KSTACKS less confusing, rename it to DEBUG_STACKS
(as it is defined in Kconfig.debug) and modify the Kconfig
description. No functional changes intended.
Signed-off-by: Min-Hua Chen <minhuadotchen@gmail.com>
---
arch/arc/Kconfig.debug | 7 ++++---
arch/arc/include/asm/thread_info.h | 2 +-
2 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/arch/arc/Kconfig.debug b/arch/arc/Kconfig.debug
index 45add86decd5..9a1e140605c4 100644
--- a/arch/arc/Kconfig.debug
+++ b/arch/arc/Kconfig.debug
@@ -1,10 +1,11 @@
# SPDX-License-Identifier: GPL-2.0
-config 16KSTACKS
- bool "Use 16Kb for kernel stacks instead of 8Kb"
+config DEBUG_STACKS
+ bool "Use double sized kernel stacks"
help
- If you say Y here the kernel will use a 16Kb stacksize for the
+ If you say Y here the kernel will use a double sized stack for the
kernel stack attached to each process/thread. The default is 8K.
+ (depends on CONFIG_ARC_PAGE_SIZE_16K or CONFIG_ARC_PAGE_SIZE_4K)
This increases the resident kernel footprint and will cause less
threads to run on the system and also increase the pressure
on the VM subsystem for higher order allocations.
diff --git a/arch/arc/include/asm/thread_info.h b/arch/arc/include/asm/thread_info.h
index 9f9dd021501c..a7358d1225a6 100644
--- a/arch/arc/include/asm/thread_info.h
+++ b/arch/arc/include/asm/thread_info.h
@@ -15,7 +15,7 @@
#include <asm/page.h>
-#ifdef CONFIG_16KSTACKS
+#ifdef CONFIG_DEBUG_STACKS
#define THREAD_SIZE_ORDER 1
#else
#define THREAD_SIZE_ORDER 0
--
2.34.1
_______________________________________________
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2023-05-11 17:01 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-05-11 17:01 [PATCH 0/2] ARC: fix the THREAD_SHIFT definition Min-Hua Chen
2023-05-11 17:01 ` [PATCH 1/2] ARC: fix incorrect " Min-Hua Chen
2023-05-11 17:01 ` [PATCH 2/2] ARC: rename 16KSTACKS to DEBUG_STACKS Min-Hua Chen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).