Skip to contentSkip to conversation

m68k: Calculate THREAD_SIZE from THREAD_SIZE_ORDER

PATCH In review Dawei Li 2 participants 3 messages Mar 4, 2024 – Mar 11, 2024 m68k architecture

lore
Share & tools
lore

Dawei Li

author
#0 lore raw

PATCH 1/1 m68k: Calculate THREAD_SIZE from THREAD_SIZE_ORDER

Current THREAD_SIZE_OERDER implementatin is not generic for common case.

Improve it by:
- Define THREAD_SIZE_ORDER by specific platform configs.
- Calculate THREAD_SIZE by THREAD_SIZE_ORDER.

---

V1 -> V2:
- Remove ilog2().
- Calculate THREAD_SIZE by THREAD_SIZE_ORDER.

V1:
https://lore.kernel.org/lkml/[email protected]/

 arch/m68k/include/asm/thread_info.h | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)
arch/m68k/include/asm/thread_info.h +5 -4
index 31be2ad999ca..3e31adbddc75 100644
@@ -12,14 +12,15 @@
  */
 #if PAGE_SHIFT < 13
 #ifdef CONFIG_4KSTACKS
-#define THREAD_SIZE	4096
+#define THREAD_SIZE_ORDER	0
 #else
-#define THREAD_SIZE	8192
+#define THREAD_SIZE_ORDER	1
 #endif
 #else
-#define THREAD_SIZE	PAGE_SIZE
+#define THREAD_SIZE_ORDER	0
 #endif
-#define THREAD_SIZE_ORDER	((THREAD_SIZE / PAGE_SIZE) - 1)
+
+#define THREAD_SIZE	(PAGE_SIZE << THREAD_SIZE_ORDER)
 
 #ifndef __ASSEMBLY__
 
Signature · 1 line
2.27.0
author
#1 lore raw

Hi Geert,

Quoted 34 lines · Dawei Li

Current THREAD_SIZE_OERDER implementatin is not generic for common case.

Improve it by:
- Define THREAD_SIZE_ORDER by specific platform configs.
- Calculate THREAD_SIZE by THREAD_SIZE_ORDER.

---

V1 -> V2:
- Remove ilog2().
- Calculate THREAD_SIZE by THREAD_SIZE_ORDER.

V1:
https://lore.kernel.org/lkml/[email protected]/

 arch/m68k/include/asm/thread_info.h | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)
arch/m68k/include/asm/thread_info.h +2 -2
index 31be2ad999ca..3e31adbddc75 100644
@@ -12,14 +12,15 @@
  */
 #if PAGE_SHIFT < 13
 #ifdef CONFIG_4KSTACKS
-#define THREAD_SIZE	4096
+#define THREAD_SIZE_ORDER	0
 #else
-#define THREAD_SIZE	8192
+#define THREAD_SIZE_ORDER	1
 #endif

arch/m68k/include/asm/thread_info.h line 26

Quoted 10 lines
arch/m68k/include/asm/thread_info.h +3 -2
 #else
-#define THREAD_SIZE	PAGE_SIZE
+#define THREAD_SIZE_ORDER	0
 #endif
-#define THREAD_SIZE_ORDER	((THREAD_SIZE / PAGE_SIZE) - 1)
+
+#define THREAD_SIZE	(PAGE_SIZE << THREAD_SIZE_ORDER)
 
 #ifndef __ASSEMBLY__
 

Sorry to bother, but any comments on this version?

I know it's awkward cuz it's in middle of merge window, sorry for that.

Thanks,

Dawei

Quoted 3 lines
Signature · 1 line
2.27.0
maintainer Reviewed-by on v1 1/1
#2 lore raw
In reply to Dawei Li
Quoted 6 lines · Dawei Li

Current THREAD_SIZE_OERDER implementatin is not generic for common case.

Improve it by:
- Define THREAD_SIZE_ORDER by specific platform configs.
- Calculate THREAD_SIZE by THREAD_SIZE_ORDER.

Quoted 7 lines

---

V1 -> V2:
- Remove ilog2().
- Calculate THREAD_SIZE by THREAD_SIZE_ORDER.

i.e. will queue in the m68k tree for v6.10.

Gr{oetje,eeting}s,

Geert

Signature · 5 lines
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds