linux-m68k.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] m68k: Calculate THREAD_SIZE from THREAD_SIZE_ORDER
@ 2024-03-04  8:54 Dawei Li
  2024-03-11 10:33 ` Dawei Li
  2024-03-11 13:19 ` Geert Uytterhoeven
  0 siblings, 2 replies; 3+ messages in thread
From: Dawei Li @ 2024-03-04  8:54 UTC (permalink / raw)
  To: geert; +Cc: linux-m68k, linux-kernel, 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.

Suggested-by: Geert Uytterhoeven <geert@linux-m68k.org>
Signed-off-by: Dawei Li <dawei.li@shingroup.cn>
---

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

V1:
https://lore.kernel.org/lkml/20240228085824.74639-1-dawei.li@shingroup.cn/

 arch/m68k/include/asm/thread_info.h | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/arch/m68k/include/asm/thread_info.h b/arch/m68k/include/asm/thread_info.h
index 31be2ad999ca..3e31adbddc75 100644
--- a/arch/m68k/include/asm/thread_info.h
+++ b/arch/m68k/include/asm/thread_info.h
@@ -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__
 
-- 
2.27.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] m68k: Calculate THREAD_SIZE from THREAD_SIZE_ORDER
  2024-03-04  8:54 [PATCH] m68k: Calculate THREAD_SIZE from THREAD_SIZE_ORDER Dawei Li
@ 2024-03-11 10:33 ` Dawei Li
  2024-03-11 13:19 ` Geert Uytterhoeven
  1 sibling, 0 replies; 3+ messages in thread
From: Dawei Li @ 2024-03-11 10:33 UTC (permalink / raw)
  To: geert; +Cc: linux-m68k, linux-kernel

Hi Geert,

On Mon, Mar 04, 2024 at 04:54:55PM +0800, Dawei Li wrote:
> 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.
> 
> Suggested-by: Geert Uytterhoeven <geert@linux-m68k.org>
> Signed-off-by: Dawei Li <dawei.li@shingroup.cn>
> ---
> 
> V1 -> V2:
> - Remove ilog2().
> - Calculate THREAD_SIZE by THREAD_SIZE_ORDER.
> 
> V1:
> https://lore.kernel.org/lkml/20240228085824.74639-1-dawei.li@shingroup.cn/
> 
>  arch/m68k/include/asm/thread_info.h | 9 +++++----
>  1 file changed, 5 insertions(+), 4 deletions(-)
> 
> diff --git a/arch/m68k/include/asm/thread_info.h b/arch/m68k/include/asm/thread_info.h
> index 31be2ad999ca..3e31adbddc75 100644
> --- a/arch/m68k/include/asm/thread_info.h
> +++ b/arch/m68k/include/asm/thread_info.h
> @@ -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__
>  

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

> -- 
> 2.27.0
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] m68k: Calculate THREAD_SIZE from THREAD_SIZE_ORDER
  2024-03-04  8:54 [PATCH] m68k: Calculate THREAD_SIZE from THREAD_SIZE_ORDER Dawei Li
  2024-03-11 10:33 ` Dawei Li
@ 2024-03-11 13:19 ` Geert Uytterhoeven
  1 sibling, 0 replies; 3+ messages in thread
From: Geert Uytterhoeven @ 2024-03-11 13:19 UTC (permalink / raw)
  To: Dawei Li; +Cc: linux-m68k, linux-kernel

On Mon, Mar 4, 2024 at 9:55 AM Dawei Li <dawei.li@shingroup.cn> wrote:
> 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.
>
> Suggested-by: Geert Uytterhoeven <geert@linux-m68k.org>
> Signed-off-by: Dawei Li <dawei.li@shingroup.cn>
> ---
>
> V1 -> V2:
> - Remove ilog2().
> - Calculate THREAD_SIZE by THREAD_SIZE_ORDER.

Reviewed-by: Geert Uytterhoeven <geert@linux-m68k.org>
i.e. will queue in the m68k tree for v6.10.

Gr{oetje,eeting}s,

                        Geert

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-03-11 13:19 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-03-04  8:54 [PATCH] m68k: Calculate THREAD_SIZE from THREAD_SIZE_ORDER Dawei Li
2024-03-11 10:33 ` Dawei Li
2024-03-11 13:19 ` Geert Uytterhoeven

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).