Received: by 2002:ab2:710b:0:b0:1ef:a325:1205 with SMTP id z11csp419938lql; Mon, 11 Mar 2024 06:50:45 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCU85tpZBOA0cdV0dhx6uBw7+ZbvBHnVAnp87FkitFb8UDQjiRi7+BD+fQAuThowOVE/DFt2b8JsTc+Phd/0ZsZSbCwub2jCrXEfHcvQLg== X-Google-Smtp-Source: AGHT+IEt7W7nKefjIrdQRcL+2yPgKn/vYmeFCg8DQslmquPPXz1Y0tVNSeTN4TzQLLSBCuYdZdBH X-Received: by 2002:a54:4090:0:b0:3c1:f55c:d873 with SMTP id i16-20020a544090000000b003c1f55cd873mr6847914oii.58.1710165045153; Mon, 11 Mar 2024 06:50:45 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1710165045; cv=pass; d=google.com; s=arc-20160816; b=Gjfne2pxxS+olLvOHRMvaQmKB9Vx/+ACCgpkJ5syvozTM3cNQJjlUYqjqKNjFYsL0g K5pvtzvYKsddPG50DL4oG2/Cog4inPj+KshLy6ZGgmc7VBnCMVWT/pz72WiXk0lEQqjP VN9ldl8GZQZgoMeETIZBQ3444RoAtKvWsBTLu/2wIB20fZ7R/iG/ftiiAE2Z1MF613fo aDbeGi0+Vszltv38uEYeBa7SF4BzyVQ5TE+VsR6UMkswZHNQk08tD748dLszxCXNXaUu ux9Sraxr6F6NFMKs9haRkzfW0xQ87RamdxiJv9YkfcogiZW3zzcYE/qHqOfpYRjOJDwZ 5COw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from; bh=p8vxuHoaxeydpwkLcd1Mw8qp2an674bo6t9q+EcY3zo=; fh=gNzZZb0USHJInTquNUP4VUqQ/C4ukqnxVh/oE+i4T5g=; b=vncvD/5261ezUWDbwSlQP4UhEuFYqbquE93ma9UKObQJNsrFsHKUeAbCR7evoGiSdG PscRVr+q819jzGNv4tvB837y5BcLiYE5pbttR/uuWQFWUytovX5l44wl3EWMsanO9aeA zYHHMfUtIyvN885PJ2fK47fKhqMlqK5PIUzm5oe4nXTBAaJed+cixhjSpsQt5ZDLzy4H QW93Ydl7ofEuPKSy5A4c2U4cr9JIrnVZgEdjQ0Ds8xlm+WbO7bAWKmFGC+4/poYbVG4k Gj3XnzmPGQ1ybKsnSGeRf/s1xPveThpCGAIFdIdD+XgJ8HYj4BPLqDPPqIk3Eho6g33c 5vDg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel+bounces-98904-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-98904-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id p11-20020a63f44b000000b005dc4b7ae767si4659200pgk.459.2024.03.11.06.50.44 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Mar 2024 06:50:45 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-98904-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel+bounces-98904-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-98904-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 3DBA3283AFB for ; Mon, 11 Mar 2024 13:50:44 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C077B3DBB7; Mon, 11 Mar 2024 13:50:39 +0000 (UTC) Received: from weierstrass.telenet-ops.be (weierstrass.telenet-ops.be [195.130.137.81]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E40D83D970 for ; Mon, 11 Mar 2024 13:50:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=195.130.137.81 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710165039; cv=none; b=ia1XGyx7GxkawCxEwEF1nXHVSEMrs1s9O4xlDk1BWuiT+UP/X7+XN6fwZmwkk2unxKW7RPRpjuFcaJpt59eEJLLMZbAIAc13CnehYdtvFXBIopapcKbXweCKUH3CNIvbVxdWymGE7VdlcOiC+hBHzdTQyw3p5p8NKAWv9KQQDjQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710165039; c=relaxed/simple; bh=RwsgmWjB5jQM5rG+Q8V+ThuRJIdkgmR4+Rfw1CoFMJ8=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=duoNYMIXAXU3QeqI+kN7FQtT4lugcpD6xcl+cdnRXf3xubAVrefZF1Ko7WE5NJNMimdfHM3VpS66CkC1EGiMg5K8VKC1+of38XB4Jx3dhemL+TG+hC2jJS2Dv2iVsO8aalNzrAGpkeThLNl87yqKqE9st7mx8PSZoYhvIv9SY+8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=linux-m68k.org; spf=none smtp.mailfrom=linux-m68k.org; arc=none smtp.client-ip=195.130.137.81 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=linux-m68k.org Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux-m68k.org Received: from michel.telenet-ops.be (michel.telenet-ops.be [IPv6:2a02:1800:110:4::f00:18]) by weierstrass.telenet-ops.be (Postfix) with ESMTPS id 4TtdKp2bbJz4x1CT for ; Mon, 11 Mar 2024 14:44:14 +0100 (CET) Received: from ramsan.of.borg ([IPv6:2a02:1810:ac12:ed80:76d0:2bff:fec8:549]) by michel.telenet-ops.be with bizsmtp id xRk62B00T0SSLxL06Rk6bv; Mon, 11 Mar 2024 14:44:06 +0100 Received: from rox.of.borg ([192.168.97.57]) by ramsan.of.borg with esmtp (Exim 4.95) (envelope-from ) id 1rjfwV-003L5c-2T; Mon, 11 Mar 2024 14:44:06 +0100 Received: from geert by rox.of.borg with local (Exim 4.95) (envelope-from ) id 1rjfwk-005i88-Bg; Mon, 11 Mar 2024 14:44:06 +0100 From: Geert Uytterhoeven To: Andrew Morton , Arnd Bergmann Cc: linux-kernel@vger.kernel.org, Geert Uytterhoeven Subject: [PATCH] fork: Use THREAD_SIZE_ORDER Date: Mon, 11 Mar 2024 14:44:04 +0100 Message-Id: X-Mailer: git-send-email 2.34.1 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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_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); - for (i = 0; i < THREAD_SIZE / PAGE_SIZE; i++) { + for (i = 0; i < THREAD_SIZE_ORDER; i++) { ret = memcg_kmem_charge_page(vm->pages[i], GFP_KERNEL, 0); if (ret) goto err; @@ -535,7 +535,7 @@ static void account_kernel_stack(struct task_struct *tsk, int account) struct vm_struct *vm = task_stack_vm_area(tsk); int i; - for (i = 0; i < THREAD_SIZE / PAGE_SIZE; i++) + for (i = 0; i < THREAD_SIZE_ORDER; i++) mod_lruvec_page_state(vm->pages[i], NR_KERNEL_STACK_KB, account * (PAGE_SIZE / 1024)); } else { @@ -556,7 +556,7 @@ void exit_task_stack_account(struct task_struct *tsk) int i; vm = task_stack_vm_area(tsk); - for (i = 0; i < THREAD_SIZE / PAGE_SIZE; i++) + for (i = 0; i < THREAD_SIZE_ORDER; i++) memcg_kmem_uncharge_page(vm->pages[i], 0); } } -- 2.34.1