Linux-m68k Archive mirror
 help / color / mirror / Atom feed
From: Dawei Li <dawei.li@shingroup.cn>
To: geert@linux-m68k.org
Cc: linux-m68k@lists.linux-m68k.org, linux-kernel@vger.kernel.org,
	Dawei Li <dawei.li@shingroup.cn>
Subject: [PATCH] m68k: Calculate THREAD_SIZE from THREAD_SIZE_ORDER
Date: Mon,  4 Mar 2024 16:54:55 +0800	[thread overview]
Message-ID: <20240304085455.125063-1-dawei.li@shingroup.cn> (raw)

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


             reply	other threads:[~2024-03-04  8:55 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-04  8:54 Dawei Li [this message]
2024-03-11 10:33 ` [PATCH] m68k: Calculate THREAD_SIZE from THREAD_SIZE_ORDER Dawei Li
2024-03-11 13:19 ` Geert Uytterhoeven

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240304085455.125063-1-dawei.li@shingroup.cn \
    --to=dawei.li@shingroup.cn \
    --cc=geert@linux-m68k.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-m68k@lists.linux-m68k.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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 read-only IMAP folder(s) and NNTP newsgroup(s).