From: Sebastian Andrzej Siewior Subject: kernel/fork: Use IS_ENABLED() in account_kernel_stack(). Date: Thu, 18 Nov 2021 15:34:52 +0100 Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/5.16/older/patches-5.16-rc2-rt4.tar.xz 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 Link: https://lore.kernel.org/r/20211118143452.136421-9-bigeasy@linutronix.de --- kernel/fork.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) --- a/kernel/fork.c +++ b/kernel/fork.c @@ -465,16 +465,16 @@ void vm_area_free(struct vm_area_struct static void account_kernel_stack(struct task_struct *tsk, int account) { - void *stack = task_stack_page(tsk); - struct vm_struct *vm = task_stack_vm_area(tsk); - - if (vm) { + if (IS_ENABLED(CONFIG_VMAP_STACK)) { + struct vm_struct *vm = task_stack_vm_area(tsk); int i; for (i = 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 = 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));