2023-05-25 16:28:44

by Min-Hua Chen

[permalink] [raw]
Subject: [RESEND PATCH 0/2] ARC: fix THREAD_SHIFT and rename 16KSTACKS

Hi,

When I read the arch/arc code, I first noticed that the
definition of THREAD_SHIFT looks incorrect and the
description of 16KSTACKS looks confusing because there are
multiple definitions of PAGE_SHIFT. So I submit
these patches to address the issues 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



2023-05-25 16:30:20

by Min-Hua Chen

[permalink] [raw]
Subject: [RESEND PATCH 1/2] ARC: fix incorrect THREAD_SHIFT definition

Current definition of THREAD_SHIFT is (PAGE_SHIFT << THREAD_SIZE_ORDER)
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 <[email protected]>
---
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