From: Dan Carpenter <dan.carpenter@linaro.org>
To: oe-kbuild@lists.linux.dev,
"Vishal Moola (Oracle)" <vishal.moola@gmail.com>
Cc: lkp@intel.com, oe-kbuild-all@lists.linux.dev,
Andrew Morton <akpm@linux-foundation.org>,
Linux Memory Management List <linux-mm@kvack.org>
Subject: [linux-next:master 4756/5283] kernel/fork.c:457 account_kernel_stack() warn: we never enter this loop
Date: Mon, 1 Sep 2025 13:56:05 +0300 [thread overview]
Message-ID: <202508300929.TrRovUMu-lkp@intel.com> (raw)
tree: https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
head: 3cace99d63192a7250461b058279a42d91075d0c
commit: e0aa7237ef4323a66ed06953225d9b07cf039530 [4756/5283] mm: tag kernel stack pages
config: hexagon-randconfig-r072-20250829 (https://download.01.org/0day-ci/archive/20250830/202508300929.TrRovUMu-lkp@intel.com/config)
compiler: clang version 20.1.8 (https://github.com/llvm/llvm-project 87f0227cb60147a26a1eeb4fb06e3b505e9c7261)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
| Closes: https://lore.kernel.org/r/202508300929.TrRovUMu-lkp@intel.com/
smatch warnings:
kernel/fork.c:457 account_kernel_stack() warn: we never enter this loop
kernel/fork.c:457 account_kernel_stack() warn: unsigned 'i' is never less than zero.
kernel/fork.c:479 exit_task_stack_account() warn: we never enter this loop
kernel/fork.c:479 exit_task_stack_account() warn: unsigned 'i' is never less than zero.
vim +457 kernel/fork.c
ba14a194a434cc Andy Lutomirski 2016-08-11 437 static void account_kernel_stack(struct task_struct *tsk, int account)
c6a7f5728a1db4 KOSAKI Motohiro 2009-09-21 438 {
0ce055f85335e4 Sebastian Andrzej Siewior 2022-02-17 439 if (IS_ENABLED(CONFIG_VMAP_STACK)) {
449e0b4ed5a16c Pasha Tatashin 2025-05-09 440 struct vm_struct *vm_area = task_stack_vm_area(tsk);
27faca83a7e955 Muchun Song 2021-04-29 441 int i;
efdc94907977d2 Andy Lutomirski 2016-07-28 442
e0aa7237ef4323 Vishal Moola (Oracle 2025-08-20 443) for (i = 0; i < THREAD_SIZE / PAGE_SIZE; i++) {
449e0b4ed5a16c Pasha Tatashin 2025-05-09 444 mod_lruvec_page_state(vm_area->pages[i], NR_KERNEL_STACK_KB,
27faca83a7e955 Muchun Song 2021-04-29 445 account * (PAGE_SIZE / 1024));
e0aa7237ef4323 Vishal Moola (Oracle 2025-08-20 446) __SetPageStack(vm_area->pages[i]);
e0aa7237ef4323 Vishal Moola (Oracle 2025-08-20 447) }
27faca83a7e955 Muchun Song 2021-04-29 448 } else {
0ce055f85335e4 Sebastian Andrzej Siewior 2022-02-17 449 void *stack = task_stack_page(tsk);
e0aa7237ef4323 Vishal Moola (Oracle 2025-08-20 450) struct page *page = virt_to_head_page(stack);
e0aa7237ef4323 Vishal Moola (Oracle 2025-08-20 451) int i;
0ce055f85335e4 Sebastian Andrzej Siewior 2022-02-17 452
991e7673859ed4 Shakeel Butt 2020-08-06 453 /* All stack pages are in the same node. */
da3ceeff923e3b Muchun Song 2020-12-14 454 mod_lruvec_kmem_state(stack, NR_KERNEL_STACK_KB,
efdc94907977d2 Andy Lutomirski 2016-07-28 455 account * (THREAD_SIZE / 1024));
e0aa7237ef4323 Vishal Moola (Oracle 2025-08-20 456)
e0aa7237ef4323 Vishal Moola (Oracle 2025-08-20 @457) for (i = 0; i < THREAD_SIZE / PAGE_SIZE; i++, page++)
e0aa7237ef4323 Vishal Moola (Oracle 2025-08-20 458) __SetPageStack(page);
Apparently in the linked config the THREAD_SIZE / PAGE_SIZE is zero.
Is this the expected behavior? I don't know mm enough to say the
answer...
ba14a194a434cc Andy Lutomirski 2016-08-11 459 }
27faca83a7e955 Muchun Song 2021-04-29 460 }
c6a7f5728a1db4 KOSAKI Motohiro 2009-09-21 461
1a03d3f13ffe5d Sebastian Andrzej Siewior 2022-02-17 462 void exit_task_stack_account(struct task_struct *tsk)
9b6f7e163cd0f4 Roman Gushchin 2018-10-26 463 {
1a03d3f13ffe5d Sebastian Andrzej Siewior 2022-02-17 464 account_kernel_stack(tsk, -1);
991e7673859ed4 Shakeel Butt 2020-08-06 465
1a03d3f13ffe5d Sebastian Andrzej Siewior 2022-02-17 466 if (IS_ENABLED(CONFIG_VMAP_STACK)) {
449e0b4ed5a16c Pasha Tatashin 2025-05-09 467 struct vm_struct *vm_area;
9b6f7e163cd0f4 Roman Gushchin 2018-10-26 468 int i;
9b6f7e163cd0f4 Roman Gushchin 2018-10-26 469
449e0b4ed5a16c Pasha Tatashin 2025-05-09 470 vm_area = task_stack_vm_area(tsk);
e0aa7237ef4323 Vishal Moola (Oracle 2025-08-20 471) for (i = 0; i < THREAD_SIZE / PAGE_SIZE; i++) {
449e0b4ed5a16c Pasha Tatashin 2025-05-09 472 memcg_kmem_uncharge_page(vm_area->pages[i], 0);
e0aa7237ef4323 Vishal Moola (Oracle 2025-08-20 473) __ClearPageStack(vm_area->pages[i]);
e0aa7237ef4323 Vishal Moola (Oracle 2025-08-20 474) }
e0aa7237ef4323 Vishal Moola (Oracle 2025-08-20 475) } else {
e0aa7237ef4323 Vishal Moola (Oracle 2025-08-20 476) struct page *page = virt_to_head_page(task_stack_page(tsk));
e0aa7237ef4323 Vishal Moola (Oracle 2025-08-20 477) int i;
e0aa7237ef4323 Vishal Moola (Oracle 2025-08-20 478)
e0aa7237ef4323 Vishal Moola (Oracle 2025-08-20 @479) for (i = 0; i < THREAD_SIZE / PAGE_SIZE; i++, page++)
e0aa7237ef4323 Vishal Moola (Oracle 2025-08-20 480) __ClearPageStack(page);
9b6f7e163cd0f4 Roman Gushchin 2018-10-26 481 }
9b6f7e163cd0f4 Roman Gushchin 2018-10-26 482 }
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
WARNING: multiple messages have this Message-ID (diff)
From: kernel test robot <lkp@intel.com>
To: oe-kbuild@lists.linux.dev
Cc: lkp@intel.com, Dan Carpenter <error27@gmail.com>
Subject: [linux-next:master 4756/5283] kernel/fork.c:457 account_kernel_stack() warn: we never enter this loop
Date: Sat, 30 Aug 2025 09:15:32 +0800 [thread overview]
Message-ID: <202508300929.TrRovUMu-lkp@intel.com> (raw)
BCC: lkp@intel.com
CC: oe-kbuild-all@lists.linux.dev
TO: "Vishal Moola (Oracle)" <vishal.moola@gmail.com>
CC: Andrew Morton <akpm@linux-foundation.org>
CC: Linux Memory Management List <linux-mm@kvack.org>
tree: https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
head: 3cace99d63192a7250461b058279a42d91075d0c
commit: e0aa7237ef4323a66ed06953225d9b07cf039530 [4756/5283] mm: tag kernel stack pages
:::::: branch date: 20 hours ago
:::::: commit date: 2 days ago
config: hexagon-randconfig-r072-20250829 (https://download.01.org/0day-ci/archive/20250830/202508300929.TrRovUMu-lkp@intel.com/config)
compiler: clang version 20.1.8 (https://github.com/llvm/llvm-project 87f0227cb60147a26a1eeb4fb06e3b505e9c7261)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Reported-by: Dan Carpenter <error27@gmail.com>
| Closes: https://lore.kernel.org/r/202508300929.TrRovUMu-lkp@intel.com/
smatch warnings:
kernel/fork.c:457 account_kernel_stack() warn: we never enter this loop
kernel/fork.c:457 account_kernel_stack() warn: unsigned 'i' is never less than zero.
kernel/fork.c:457 account_kernel_stack() warn: unsigned 'i' is never less than zero.
kernel/fork.c:479 exit_task_stack_account() warn: we never enter this loop
kernel/fork.c:479 exit_task_stack_account() warn: unsigned 'i' is never less than zero.
kernel/fork.c:479 exit_task_stack_account() warn: unsigned 'i' is never less than zero.
vim +457 kernel/fork.c
^1da177e4c3f41 Linus Torvalds 2005-04-16 436
ba14a194a434cc Andy Lutomirski 2016-08-11 437 static void account_kernel_stack(struct task_struct *tsk, int account)
c6a7f5728a1db4 KOSAKI Motohiro 2009-09-21 438 {
0ce055f85335e4 Sebastian Andrzej Siewior 2022-02-17 439 if (IS_ENABLED(CONFIG_VMAP_STACK)) {
449e0b4ed5a16c Pasha Tatashin 2025-05-09 440 struct vm_struct *vm_area = task_stack_vm_area(tsk);
27faca83a7e955 Muchun Song 2021-04-29 441 int i;
efdc94907977d2 Andy Lutomirski 2016-07-28 442
e0aa7237ef4323 Vishal Moola (Oracle 2025-08-20 443) for (i = 0; i < THREAD_SIZE / PAGE_SIZE; i++) {
449e0b4ed5a16c Pasha Tatashin 2025-05-09 444 mod_lruvec_page_state(vm_area->pages[i], NR_KERNEL_STACK_KB,
27faca83a7e955 Muchun Song 2021-04-29 445 account * (PAGE_SIZE / 1024));
e0aa7237ef4323 Vishal Moola (Oracle 2025-08-20 446) __SetPageStack(vm_area->pages[i]);
e0aa7237ef4323 Vishal Moola (Oracle 2025-08-20 447) }
27faca83a7e955 Muchun Song 2021-04-29 448 } else {
0ce055f85335e4 Sebastian Andrzej Siewior 2022-02-17 449 void *stack = task_stack_page(tsk);
e0aa7237ef4323 Vishal Moola (Oracle 2025-08-20 450) struct page *page = virt_to_head_page(stack);
e0aa7237ef4323 Vishal Moola (Oracle 2025-08-20 451) int i;
0ce055f85335e4 Sebastian Andrzej Siewior 2022-02-17 452
991e7673859ed4 Shakeel Butt 2020-08-06 453 /* All stack pages are in the same node. */
da3ceeff923e3b Muchun Song 2020-12-14 454 mod_lruvec_kmem_state(stack, NR_KERNEL_STACK_KB,
efdc94907977d2 Andy Lutomirski 2016-07-28 455 account * (THREAD_SIZE / 1024));
e0aa7237ef4323 Vishal Moola (Oracle 2025-08-20 456)
e0aa7237ef4323 Vishal Moola (Oracle 2025-08-20 @457) for (i = 0; i < THREAD_SIZE / PAGE_SIZE; i++, page++)
e0aa7237ef4323 Vishal Moola (Oracle 2025-08-20 458) __SetPageStack(page);
ba14a194a434cc Andy Lutomirski 2016-08-11 459 }
27faca83a7e955 Muchun Song 2021-04-29 460 }
c6a7f5728a1db4 KOSAKI Motohiro 2009-09-21 461
1a03d3f13ffe5d Sebastian Andrzej Siewior 2022-02-17 462 void exit_task_stack_account(struct task_struct *tsk)
9b6f7e163cd0f4 Roman Gushchin 2018-10-26 463 {
1a03d3f13ffe5d Sebastian Andrzej Siewior 2022-02-17 464 account_kernel_stack(tsk, -1);
991e7673859ed4 Shakeel Butt 2020-08-06 465
1a03d3f13ffe5d Sebastian Andrzej Siewior 2022-02-17 466 if (IS_ENABLED(CONFIG_VMAP_STACK)) {
449e0b4ed5a16c Pasha Tatashin 2025-05-09 467 struct vm_struct *vm_area;
9b6f7e163cd0f4 Roman Gushchin 2018-10-26 468 int i;
9b6f7e163cd0f4 Roman Gushchin 2018-10-26 469
449e0b4ed5a16c Pasha Tatashin 2025-05-09 470 vm_area = task_stack_vm_area(tsk);
e0aa7237ef4323 Vishal Moola (Oracle 2025-08-20 471) for (i = 0; i < THREAD_SIZE / PAGE_SIZE; i++) {
449e0b4ed5a16c Pasha Tatashin 2025-05-09 472 memcg_kmem_uncharge_page(vm_area->pages[i], 0);
e0aa7237ef4323 Vishal Moola (Oracle 2025-08-20 473) __ClearPageStack(vm_area->pages[i]);
e0aa7237ef4323 Vishal Moola (Oracle 2025-08-20 474) }
e0aa7237ef4323 Vishal Moola (Oracle 2025-08-20 475) } else {
e0aa7237ef4323 Vishal Moola (Oracle 2025-08-20 476) struct page *page = virt_to_head_page(task_stack_page(tsk));
e0aa7237ef4323 Vishal Moola (Oracle 2025-08-20 477) int i;
e0aa7237ef4323 Vishal Moola (Oracle 2025-08-20 478)
e0aa7237ef4323 Vishal Moola (Oracle 2025-08-20 @479) for (i = 0; i < THREAD_SIZE / PAGE_SIZE; i++, page++)
e0aa7237ef4323 Vishal Moola (Oracle 2025-08-20 480) __ClearPageStack(page);
9b6f7e163cd0f4 Roman Gushchin 2018-10-26 481 }
9b6f7e163cd0f4 Roman Gushchin 2018-10-26 482 }
9b6f7e163cd0f4 Roman Gushchin 2018-10-26 483
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
next reply other threads:[~2025-09-01 10:56 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-30 1:15 kernel test robot [this message]
2025-09-01 10:56 ` [linux-next:master 4756/5283] kernel/fork.c:457 account_kernel_stack() warn: we never enter this loop Dan Carpenter
2025-09-02 17:01 ` Vishal Moola (Oracle)
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=202508300929.TrRovUMu-lkp@intel.com \
--to=dan.carpenter@linaro.org \
--cc=akpm@linux-foundation.org \
--cc=linux-mm@kvack.org \
--cc=lkp@intel.com \
--cc=oe-kbuild-all@lists.linux.dev \
--cc=oe-kbuild@lists.linux.dev \
--cc=vishal.moola@gmail.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.