m68k: Calculate THREAD_SIZE from THREAD_SIZE_ORDER
authorDawei Li <dawei.li@shingroup.cn>
Mon, 4 Mar 2024 08:54:55 +0000 (16:54 +0800)
committerGeert Uytterhoeven <geert@linux-m68k.org>
Tue, 2 Apr 2024 07:33:21 +0000 (09:33 +0200)
Current THREAD_SIZE_ORDER implementation is not generic.

Improve it by:
  - Defining THREAD_SIZE_ORDER based on the specific platform config,
  - Calculating THREAD_SIZE from THREAD_SIZE_ORDER.

Suggested-by: Geert Uytterhoeven <geert@linux-m68k.org>
Signed-off-by: Dawei Li <dawei.li@shingroup.cn>
Reviewed-by: Geert Uytterhoeven <geert@linux-m68k.org>
Link: https://lore.kernel.org/r/20240304085455.125063-1-dawei.li@shingroup.cn
Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
arch/m68k/include/asm/thread_info.h

index 31be2ad999cac46a9a4dc22cf66c6cfca053fddb..3e31adbddc75f67f8256ef9a52dc3af08b810ccc 100644 (file)
  */
 #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__