From nobody Thu Jun 25 08:29:09 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C3C23C433EF for ; Tue, 22 Feb 2022 21:27:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235790AbiBVV1a (ORCPT ); Tue, 22 Feb 2022 16:27:30 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43668 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231319AbiBVV11 (ORCPT ); Tue, 22 Feb 2022 16:27:27 -0500 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ACD2D710CA; Tue, 22 Feb 2022 13:27:00 -0800 (PST) Date: Tue, 22 Feb 2022 21:26:57 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1645565218; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=6WiCZNydujctLgPnBX854JnldmTGegwlAAABgUfJddY=; b=VskNhBmIrgTc4lx2JETDXkQwhn4L6Xw88l+EyjKfXMyxU14D2l1IuzDD5tjE3XZFUNwlUr oLTzrmbdgMIHfGJ9mKmoht7K+Wx3JpIAs46NF3tV1giWMH78oOK811i+cLiV9287K51s2d ZwbW6n1h5pt4aMDE+bP8krKaW/KHXYjZKjomwgVXBKMpsKgphMgBfOkT+43p0PQqY6uIWh Dr3246h9XCEL/lntvIxwpBoXKnYqLmidlcFETgMsOybf8PYWLVNvaIihHGvae2hQ3S7RNK DX4T/4cb6qCeOzjKOHRKDBkKLGsFlMBTV4iSVGC3eP7yndXl0Rpxf13wgwwpZw== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1645565218; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=6WiCZNydujctLgPnBX854JnldmTGegwlAAABgUfJddY=; b=uF+6FK8wJTGaGK2hMN+yO4rXmmyLaw701/SBhTnmHMIQgkj8WcmVAKEeR8uhC/WSZCC+XL VyeFfCzCRAQaW8DA== From: "tip-bot2 for Sebastian Andrzej Siewior" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: core/core] fork: Use IS_ENABLED() in account_kernel_stack() Cc: Sebastian Andrzej Siewior , Thomas Gleixner , Andy Lutomirski , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20220217102406.3697941-9-bigeasy@linutronix.de> References: <20220217102406.3697941-9-bigeasy@linutronix.de> MIME-Version: 1.0 Message-ID: <164556521749.16921.5599945951709302903.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The following commit has been merged into the core/core branch of tip: Commit-ID: 0ce055f85335e48bc571114d61a70ae217039362 Gitweb: https://git.kernel.org/tip/0ce055f85335e48bc571114d61a70ae21= 7039362 Author: Sebastian Andrzej Siewior AuthorDate: Thu, 17 Feb 2022 11:24:06 +01:00 Committer: Thomas Gleixner CommitterDate: Tue, 22 Feb 2022 22:25:02 +01:00 fork: Use IS_ENABLED() in account_kernel_stack() Not strickly needed but checking CONFIG_VMAP_STACK instead of task_stack_vm_area()' result allows the compiler the remove the else path in the CONFIG_VMAP_STACK case where the pointer can't be NULL. Check for CONFIG_VMAP_STACK in order to use the proper path. Signed-off-by: Sebastian Andrzej Siewior Signed-off-by: Thomas Gleixner Acked-by: Andy Lutomirski Link: https://lore.kernel.org/r/20220217102406.3697941-9-bigeasy@linutronix= .de --- kernel/fork.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/kernel/fork.c b/kernel/fork.c index 177bc64..1279b57 100644 --- a/kernel/fork.c +++ b/kernel/fork.c @@ -485,16 +485,16 @@ void vm_area_free(struct vm_area_struct *vma) =20 static void account_kernel_stack(struct task_struct *tsk, int account) { - void *stack =3D task_stack_page(tsk); - struct vm_struct *vm =3D task_stack_vm_area(tsk); - - if (vm) { + if (IS_ENABLED(CONFIG_VMAP_STACK)) { + struct vm_struct *vm =3D task_stack_vm_area(tsk); int i; =20 for (i =3D 0; i < THREAD_SIZE / PAGE_SIZE; i++) mod_lruvec_page_state(vm->pages[i], NR_KERNEL_STACK_KB, account * (PAGE_SIZE / 1024)); } else { + void *stack =3D task_stack_page(tsk); + /* All stack pages are in the same node. */ mod_lruvec_kmem_state(stack, NR_KERNEL_STACK_KB, account * (THREAD_SIZE / 1024));