mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Arnd Bergmann" <arnd@arndb.de>
To: "Geert Uytterhoeven" <geert@linux-m68k.org>,
	"Andrew Morton" <akpm@linux-foundation.org>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH] fork: Use THREAD_SIZE_ORDER
Date: Mon, 11 Mar 2024 14:47:31 +0100	[thread overview]
Message-ID: <8f27c774-7197-48da-a6f2-6d375bd848f0@app.fastmail.com> (raw)
In-Reply-To: <f713d82fe6526288f51fc138cd16681cec6b43a6.1710164592.git.geert@linux-m68k.org>

On Mon, Mar 11, 2024, at 14:44, Geert Uytterhoeven wrote:
> Use the existing THREAD_SIZE_ORDER definition instead of calculating it
> from THREAD_SIZE and PAGE_SIZE.
>
> Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
> ---
>  kernel/fork.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/kernel/fork.c b/kernel/fork.c
> index 0d944e92a43ffa13..e79fdfe1f0bf4953 100644
> --- a/kernel/fork.c
> +++ b/kernel/fork.c
> @@ -252,9 +252,9 @@ static int memcg_charge_kernel_stack(struct vm_struct *vm)
>  	int ret;
>  	int nr_charged = 0;
> 
> -	BUG_ON(vm->nr_pages != THREAD_SIZE / PAGE_SIZE);
> +	BUG_ON(vm->nr_pages != THREAD_SIZE_ORDER);
> 

That doesn't look right, THREAD_SIZE_ORDER not the number of
pages but the the log2 of it, right?

I think you want '(1 << THREAD_SIZE_ORDER)', but at that point
it doesn't actually look simpler than the existing code.

    Arnd

  reply	other threads:[~2024-03-11 13:48 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-11 13:44 Geert Uytterhoeven
2024-03-11 13:47 ` Arnd Bergmann [this message]
2024-03-11 14:04   ` 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=8f27c774-7197-48da-a6f2-6d375bd848f0@app.fastmail.com \
    --to=arnd@arndb.de \
    --cc=akpm@linux-foundation.org \
    --cc=geert@linux-m68k.org \
    --cc=linux-kernel@vger.kernel.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

all inboxes | Powered by JetHome®