Received: by 2002:ab2:710b:0:b0:1ef:a325:1205 with SMTP id z11csp435468lql; Mon, 11 Mar 2024 07:11:40 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUfCURZnsxKQrQeTOcHSuH4H6wJFJgc+bMvpAGNQm69zsMF5ZQVas0yKc5d7oMY8JjCGBKLURdpYvJab4Kl9TSJfELkZcdZlqG41X9+lQ== X-Google-Smtp-Source: AGHT+IFSY6SqNOINP1XjjihboqHtLz7p+dgHhOY1dMFZCw3flriKjKTgO2Z5hchYVyBIMo1FYNbv X-Received: by 2002:a05:6a20:3d86:b0:1a0:694c:c467 with SMTP id s6-20020a056a203d8600b001a0694cc467mr8719422pzi.14.1710166300662; Mon, 11 Mar 2024 07:11:40 -0700 (PDT) Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id p4-20020a639504000000b005c5e2c15169si4962408pgd.737.2024.03.11.07.11.40 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Mar 2024 07:11:40 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-98937-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; arc=fail (body hash mismatch); spf=pass (google.com: domain of linux-kernel+bounces-98937-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-98937-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id D275A285D48 for ; Mon, 11 Mar 2024 14:04:32 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E8B993FB87; Mon, 11 Mar 2024 14:04:26 +0000 (UTC) Received: from mail-yw1-f178.google.com (mail-yw1-f178.google.com [209.85.128.178]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5ADCD3FB2E for ; Mon, 11 Mar 2024 14:04:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.178 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710165866; cv=none; b=NQup9S2Xr06shtZK1zLsBTODH4vdGAFxf3TE7hsohOlGOyjmhd3WDTw3bSb2/9HTSbiB0NexLlA4Lq8+QQGiN1r0ScCJbHA+2jnNPa18Dpib1VIxJJT4+7N2Tz2JQB4Wn8PF9Q4woyopxz82BCCPWHm4DGRv+NPkyuJC/i83X8Q= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710165866; c=relaxed/simple; bh=Llu4HnXUgpYVrm6rtIdbKc+cL6h4GteJq9IJb6Oy2+M=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=bOUtvH8G9xJncyXJeFxLNDTyA27jopgV5PHy7p0trxURP78Tnp9UunCHFzWNw6AIiRnmW64ZgqXjDz259IvlVRo600x7hdBFQmDGGAS5XD/TRIzp5Q9JHz5DXuJrWkLGXMNyIc3Dl/mxeSSf2Jh5hrpAj3cagFy/RTqWa2nPLN8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=linux-m68k.org; spf=pass smtp.mailfrom=gmail.com; arc=none smtp.client-ip=209.85.128.178 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=linux-m68k.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-yw1-f178.google.com with SMTP id 00721157ae682-60a0a54869bso20492277b3.1 for ; Mon, 11 Mar 2024 07:04:24 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710165862; x=1710770662; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=OzLXwIVWLQf055SWSXkN052ooqv0U35mFYFMQAsjB/s=; b=bbQjUKVkXomeaALEyFBVNcpVo1oQddxrm9D9rRxXDcWWkPaUTy7lst3yParmOJh04G nBtA79S2lb/WjB+PQQM0HywbazSvukTEtT+S2FWhFImmQOf5B8mjMkx9nckxKTnvmugg 960MfwNfycrvIcOeEMa5j3jSXUPINouw3/qUq1LvcHAuWW8UAuM4pQ4gaX/qqOC2xTKv Da0Mg7NbMH2kQnYTEB+M7BjV4/kbVSD0pSJGgXNa1M5t0klf4D9ukcDvtFQT8ZzQiOfC q8D+HlNdDk9qmG1ii8AhE7T2vwhUfEsI+8YfdhwCGGb7bMqE1MWT0ePTGWaBKtUzUa5m Xf+g== X-Forwarded-Encrypted: i=1; AJvYcCWnXjuS3dz5Ql9zcEEDV17gegwoULT1AtdGbxR7+rYiA4K9Iu3EGOeFWK6N/Cu6QvM2egbtFEE3Hm5O9MKJNoSP+SPPOpExeMmNLZcf X-Gm-Message-State: AOJu0YwBAiMgbpw1TIyhK2OphptjwfdaL0qbtMYI5AaFm3rmXca6K2Pi mwJvKl3Z6ABcbFfNMsAmPrQhTWAX1N6FuCUgRSDP3xM2Ld6Xd7FaRl1p7J4p90k= X-Received: by 2002:a81:8497:0:b0:60a:4cba:ada1 with SMTP id u145-20020a818497000000b0060a4cbaada1mr545911ywf.7.1710165861963; Mon, 11 Mar 2024 07:04:21 -0700 (PDT) Received: from mail-yb1-f175.google.com (mail-yb1-f175.google.com. [209.85.219.175]) by smtp.gmail.com with ESMTPSA id u123-20020a0deb81000000b0060a0662ccc3sm1361832ywe.90.2024.03.11.07.04.21 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 11 Mar 2024 07:04:21 -0700 (PDT) Received: by mail-yb1-f175.google.com with SMTP id 3f1490d57ef6-dc25e12cc63so4998572276.0 for ; Mon, 11 Mar 2024 07:04:21 -0700 (PDT) X-Forwarded-Encrypted: i=1; AJvYcCV9EyTahSv7upt8//O1BqNyzXIOSpG0Ltt67Jq14PF+KIwjPyCH0kv5CORuhUMPoI3nlGWTwubkJcikH6B7Md8ZWylv4Pp5m0Fwa2EM X-Received: by 2002:a25:41c1:0:b0:dc6:daa4:e808 with SMTP id o184-20020a2541c1000000b00dc6daa4e808mr5213321yba.12.1710165861507; Mon, 11 Mar 2024 07:04:21 -0700 (PDT) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <8f27c774-7197-48da-a6f2-6d375bd848f0@app.fastmail.com> In-Reply-To: <8f27c774-7197-48da-a6f2-6d375bd848f0@app.fastmail.com> From: Geert Uytterhoeven Date: Mon, 11 Mar 2024 15:04:09 +0100 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH] fork: Use THREAD_SIZE_ORDER To: Arnd Bergmann Cc: Andrew Morton , linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Hi Arnd, On Mon, Mar 11, 2024 at 2:48=E2=80=AFPM Arnd Bergmann wrote= : > 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 > > --- > > 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_stru= ct *vm) > > int ret; > > int nr_charged =3D 0; > > > > - BUG_ON(vm->nr_pages !=3D THREAD_SIZE / PAGE_SIZE); > > + BUG_ON(vm->nr_pages !=3D 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. Thank you for pointing out my silly mistake. /me hides in a brown paper bag, with a coffee machine. Gr{oetje,eeting}s, Geert --=20 Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k= org In personal conversations with technical people, I call myself a hacker. Bu= t when I'm talking to journalists I just say "programmer" or something like t= hat. -- Linus Torvalds