All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Lorenzo Stoakes (ARM)" <ljs@kernel.org>
Cc: linux-s390@vger.kernel.org, "Heiko Carstens" <hca@linux.ibm.com>,
	"Christian Borntraeger" <borntraeger@linux.ibm.com>,
	"Alexander Gordeev" <agordeev@linux.ibm.com>,
	"Vasily Gorbik" <gor@linux.ibm.com>
Subject: Re: [PATCH v4 01/12] mm/khugepaged: deposit a newly allocated page table on collapse
Date: Tue, 22 Sep 2026 15:54:13 +0000	[thread overview]
Message-ID: <20260922155414.61A4F1F000FF@smtp.kernel.org> (raw)
In-Reply-To: <20260922-rcu-pagetable-freeing-v4-1-fe1ad1f1e303@kernel.org>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] mm: missing error code assignment on alloc_deposit_pte() failure
--

commit 554c24d600473369b27779719cc9b7a86d682229
Author: Lorenzo Stoakes (ARM) <ljs@kernel.org>
Subject: mm/khugepaged: deposit a newly allocated page table on collapse

This commit updates collapse_huge_page() to allocate and deposit a fresh,
zeroed PTE page table on PMD collapse instead of reusing the currently
mapped one. This resolves issues with RCU-safe page table traversal by
ensuring standard page table walkers can traverse safely during the grace
period.

> diff --git a/mm/khugepaged.c b/mm/khugepaged.c
> --- a/mm/khugepaged.c
> +++ b/mm/khugepaged.c
[ ... ]
> @@ -1310,6 +1327,12 @@ static enum scan_result collapse_huge_page(struct mm_struct *mm, unsigned long s
>  		goto out_nolock;
>  	}
>  
> +	if (is_pmd_order(order)) {
> +		pgtable = alloc_deposit_pte(mm);
> +		if (!pgtable)
> +			goto out_nolock;

[Severity: Medium]
Should the result variable be updated to an error code before jumping to
out_nolock here?

If alloc_deposit_pte() fails, result retains its SCAN_SUCCEED value from
the successful alloc_charge_folio() call above. Returning success when the
collapse actually failed could cause MADV_COLLAPSE to incorrectly return
success to userspace, corrupt khugepaged statistics, and cause mTHP
fallback logic to incorrectly assume the collapse succeeded.

> +	}
> +
>  	mmap_read_lock(mm);
>  	result = hugepage_vma_revalidate(mm, pmd_addr, /*expect_anon=*/ true,
[ ... ]

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260922-rcu-pagetable-freeing-v4-0-fe1ad1f1e303@kernel.org?part=1

  reply	other threads:[~2026-09-22 15:54 UTC|newest]

Thread overview: 188+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-22 15:35 [PATCH v4 00/12] mm: make userland page table freeing RCU-safe Lorenzo Stoakes (ARM)
2026-09-22 15:35 ` Lorenzo Stoakes (ARM)
2026-09-22 15:35 ` Lorenzo Stoakes (ARM)
2026-09-22 15:35 ` [PATCH v4 01/12] mm/khugepaged: deposit a newly allocated page table on collapse Lorenzo Stoakes (ARM)
2026-09-22 15:35   ` Lorenzo Stoakes (ARM)
2026-09-22 15:35   ` Lorenzo Stoakes (ARM)
2026-09-22 15:54   ` sashiko-bot [this message]
2026-09-23  2:24   ` Lance Yang
2026-09-23  2:24     ` Lance Yang
2026-09-23  2:24     ` Lance Yang
2026-09-23  7:09     ` Lorenzo Stoakes (ARM)
2026-09-23  7:09       ` Lorenzo Stoakes (ARM)
2026-09-23  7:09       ` Lorenzo Stoakes (ARM)
2026-09-23  7:14   ` Lorenzo Stoakes (ARM)
2026-09-23  7:14     ` Lorenzo Stoakes (ARM)
2026-09-23  7:14     ` Lorenzo Stoakes (ARM)
2026-09-23  7:24     ` Lance Yang
2026-09-23  7:24       ` Lance Yang
2026-09-23  7:24       ` Lance Yang
2026-09-23 19:53     ` Andrew Morton
2026-09-23 19:53       ` Andrew Morton
2026-09-23 19:53       ` Andrew Morton
2026-09-24  3:28     ` Baolin Wang
2026-09-24  3:28       ` Baolin Wang
2026-09-24  3:28       ` Baolin Wang
2026-09-23  8:54   ` David Hildenbrand (Arm)
2026-09-23  8:54     ` David Hildenbrand (Arm)
2026-09-23  8:54     ` David Hildenbrand (Arm)
2026-09-23  9:00     ` Lorenzo Stoakes (ARM)
2026-09-23  9:00       ` Lorenzo Stoakes (ARM)
2026-09-23  9:00       ` Lorenzo Stoakes (ARM)
2026-09-22 15:35 ` [PATCH v4 02/12] mm: enable MMU_GATHER_RCU_TABLE_FREE for most 2-level architectures Lorenzo Stoakes (ARM)
2026-09-22 15:35   ` Lorenzo Stoakes (ARM)
2026-09-22 15:35   ` Lorenzo Stoakes (ARM)
2026-09-22 15:56   ` sashiko-bot
2026-09-23  4:39   ` Lance Yang
2026-09-23  4:39     ` Lance Yang
2026-09-22 15:35 ` [PATCH v4 03/12] mm: enable MMU_GATHER_RCU_TABLE_FREE for MMU riscv Lorenzo Stoakes (ARM)
2026-09-22 15:35   ` Lorenzo Stoakes (ARM)
2026-09-22 15:35   ` Lorenzo Stoakes (ARM)
2026-09-22 15:45   ` sashiko-bot
2026-09-23  6:15   ` Lance Yang
2026-09-23  6:15     ` Lance Yang
2026-09-23  6:15     ` Lance Yang
2026-09-23  7:05     ` Lorenzo Stoakes (ARM)
2026-09-23  7:05       ` Lorenzo Stoakes (ARM)
2026-09-23  7:05       ` Lorenzo Stoakes (ARM)
2026-09-23  7:17       ` Lance Yang
2026-09-23  7:17         ` Lance Yang
2026-09-23  7:17         ` Lance Yang
2026-09-22 15:35 ` [PATCH v4 04/12] mm: enable MMU_GATHER_RCU_TABLE_FREE for MMU arm Lorenzo Stoakes (ARM)
2026-09-22 15:35   ` Lorenzo Stoakes (ARM)
2026-09-22 15:35   ` Lorenzo Stoakes (ARM)
2026-09-22 15:50   ` sashiko-bot
2026-09-23  8:05   ` Lance Yang
2026-09-23  8:05     ` Lance Yang
2026-09-23  8:05     ` Lance Yang
2026-09-23  8:15     ` Lorenzo Stoakes (ARM)
2026-09-23  8:15       ` Lorenzo Stoakes (ARM)
2026-09-23  8:15       ` Lorenzo Stoakes (ARM)
2026-09-22 15:35 ` [PATCH v4 05/12] mm: enable MMU_GATHER_RCU_TABLE_FREE for arc, microblaze, xtensa Lorenzo Stoakes (ARM)
2026-09-22 15:35   ` Lorenzo Stoakes (ARM)
2026-09-22 15:35   ` Lorenzo Stoakes (ARM)
2026-09-22 15:48   ` sashiko-bot
2026-09-23  8:43   ` Lance Yang
2026-09-23  8:43     ` Lance Yang
2026-09-23  8:43     ` Lance Yang
2026-09-22 15:35 ` [PATCH v4 06/12] mm: enable MMU_GATHER_RCU_TABLE_FREE for sparc64 Lorenzo Stoakes (ARM)
2026-09-22 15:35   ` Lorenzo Stoakes (ARM)
2026-09-22 15:35   ` Lorenzo Stoakes (ARM)
2026-09-22 15:47   ` sashiko-bot
2026-09-23  8:54   ` Lance Yang
2026-09-23  8:54     ` Lance Yang
2026-09-23  8:54     ` Lance Yang
2026-09-22 15:35 ` [PATCH v4 07/12] mm: enable MMU_GATHER_RCU_TABLE_FREE for m68k-coldfire Lorenzo Stoakes (ARM)
2026-09-22 15:35   ` Lorenzo Stoakes (ARM)
2026-09-22 15:35   ` Lorenzo Stoakes (ARM)
2026-09-22 15:48   ` sashiko-bot
2026-09-23  9:13   ` Lance Yang
2026-09-23  9:13     ` Lance Yang
2026-09-23  9:13     ` Lance Yang
2026-09-23 11:31   ` Greg Ungerer
2026-09-23 11:31     ` Greg Ungerer
2026-09-23 11:31     ` Greg Ungerer
2026-09-23 11:36     ` Lorenzo Stoakes (ARM)
2026-09-23 11:36       ` Lorenzo Stoakes (ARM)
2026-09-23 11:36       ` Lorenzo Stoakes (ARM)
2026-09-22 15:35 ` [PATCH v4 08/12] mm: enable MMU_GATHER_RCU_TABLE_FREE for sh-X2 Lorenzo Stoakes (ARM)
2026-09-22 15:35   ` Lorenzo Stoakes (ARM)
2026-09-22 15:35   ` Lorenzo Stoakes (ARM)
2026-09-22 15:49   ` sashiko-bot
2026-09-23 11:54   ` Lance Yang
2026-09-23 11:54     ` Lance Yang
2026-09-23 11:54     ` Lance Yang
2026-09-23 11:56     ` Lorenzo Stoakes (ARM)
2026-09-23 11:56       ` Lorenzo Stoakes (ARM)
2026-09-23 11:56       ` Lorenzo Stoakes (ARM)
2026-09-22 15:35 ` [PATCH v4 09/12] mm: enable MMU_GATHER_RCU_TABLE_FREE for m68k-motorola Lorenzo Stoakes (ARM)
2026-09-22 15:35   ` Lorenzo Stoakes (ARM)
2026-09-22 15:35   ` Lorenzo Stoakes (ARM)
2026-09-22 15:52   ` sashiko-bot
2026-09-23 13:16   ` Lance Yang
2026-09-23 13:16     ` Lance Yang
2026-09-23 13:16     ` Lance Yang
2026-09-23 13:21     ` Lorenzo Stoakes (ARM)
2026-09-23 13:21       ` Lorenzo Stoakes (ARM)
2026-09-23 13:21       ` Lorenzo Stoakes (ARM)
2026-09-22 15:35 ` [PATCH v4 10/12] mm: enable MMU_GATHER_RCU_TABLE_FREE for sparc32 Lorenzo Stoakes (ARM)
2026-09-22 15:35   ` Lorenzo Stoakes (ARM)
2026-09-22 15:35   ` Lorenzo Stoakes (ARM)
2026-09-22 15:55   ` sashiko-bot
2026-09-24  2:41   ` Lance Yang
2026-09-24  2:41     ` Lance Yang
2026-09-24  2:41     ` Lance Yang
2026-09-22 15:35 ` [PATCH v4 11/12] mm: make userland page table freeing RCU-safe Lorenzo Stoakes (ARM)
2026-09-22 15:35   ` Lorenzo Stoakes (ARM)
2026-09-22 15:35   ` Lorenzo Stoakes (ARM)
2026-09-22 16:01   ` sashiko-bot
2026-09-23  9:04   ` David Hildenbrand (Arm)
2026-09-23  9:04     ` David Hildenbrand (Arm)
2026-09-23  9:04     ` David Hildenbrand (Arm)
2026-09-23  9:06     ` Lorenzo Stoakes (ARM)
2026-09-23  9:06       ` Lorenzo Stoakes (ARM)
2026-09-23  9:06       ` Lorenzo Stoakes (ARM)
2026-09-23  9:13       ` David Hildenbrand (Arm)
2026-09-23  9:13         ` David Hildenbrand (Arm)
2026-09-23  9:13         ` David Hildenbrand (Arm)
2026-09-23 11:48         ` Lorenzo Stoakes (ARM)
2026-09-23 11:48           ` Lorenzo Stoakes (ARM)
2026-09-23 11:48           ` Lorenzo Stoakes (ARM)
2026-09-23 13:38           ` David Hildenbrand (Arm)
2026-09-23 13:38             ` David Hildenbrand (Arm)
2026-09-23 13:38             ` David Hildenbrand (Arm)
2026-09-23 13:43             ` Lorenzo Stoakes (ARM)
2026-09-23 13:43               ` Lorenzo Stoakes (ARM)
2026-09-23 13:43               ` Lorenzo Stoakes (ARM)
2026-09-24  2:55   ` Lance Yang
2026-09-24  2:55     ` Lance Yang
2026-09-24  2:55     ` Lance Yang
2026-09-22 15:35 ` [PATCH v4 12/12] mm: change the contract for free_pgtables(), update docs Lorenzo Stoakes (ARM)
2026-09-22 15:35   ` Lorenzo Stoakes (ARM)
2026-09-22 15:35   ` Lorenzo Stoakes (ARM)
2026-09-22 15:49   ` sashiko-bot
2026-09-23  9:08   ` David Hildenbrand (Arm)
2026-09-23  9:08     ` David Hildenbrand (Arm)
2026-09-23  9:08     ` David Hildenbrand (Arm)
2026-09-23 11:55     ` Lorenzo Stoakes (ARM)
2026-09-23 11:55       ` Lorenzo Stoakes (ARM)
2026-09-23 11:55       ` Lorenzo Stoakes (ARM)
2026-09-24  3:26   ` Lance Yang
2026-09-24  3:26     ` Lance Yang
2026-09-24  3:26     ` Lance Yang
2026-09-24  7:54     ` Lorenzo Stoakes (ARM)
2026-09-24  7:54       ` Lorenzo Stoakes (ARM)
2026-09-24  7:54       ` Lorenzo Stoakes (ARM)
2026-09-22 16:42 ` [PATCH v4 00/12] mm: make userland page table freeing RCU-safe Matthew Wilcox
2026-09-22 16:42   ` Matthew Wilcox
2026-09-22 16:42   ` Matthew Wilcox
2026-09-22 17:22   ` Lorenzo Stoakes (ARM)
2026-09-22 17:22     ` Lorenzo Stoakes (ARM)
2026-09-22 17:22     ` Lorenzo Stoakes (ARM)
2026-09-22 23:00 ` Andrew Morton
2026-09-22 23:00   ` Andrew Morton
2026-09-22 23:00   ` Andrew Morton
2026-09-23  7:04   ` Lorenzo Stoakes (ARM)
2026-09-23  7:04     ` Lorenzo Stoakes (ARM)
2026-09-23  7:04     ` Lorenzo Stoakes (ARM)
2026-09-23 20:01     ` Andrew Morton
2026-09-23 20:01       ` Andrew Morton
2026-09-23 20:01       ` Andrew Morton
2026-09-23  8:45   ` David Hildenbrand (Arm)
2026-09-23  8:45     ` David Hildenbrand (Arm)
2026-09-23  8:45     ` David Hildenbrand (Arm)
2026-09-23  9:04     ` Lorenzo Stoakes (ARM)
2026-09-23  9:04       ` Lorenzo Stoakes (ARM)
2026-09-23  9:04       ` Lorenzo Stoakes (ARM)
2026-09-23  9:15       ` David Hildenbrand (Arm)
2026-09-23  9:15         ` David Hildenbrand (Arm)
2026-09-23  9:15         ` David Hildenbrand (Arm)
2026-09-23  9:39         ` Vlastimil Babka (SUSE)
2026-09-23  9:39           ` Vlastimil Babka (SUSE)
2026-09-23  9:39           ` Vlastimil Babka (SUSE)
2026-09-23 11:39           ` Lorenzo Stoakes (ARM)
2026-09-23 11:39             ` Lorenzo Stoakes (ARM)
2026-09-23 11:39             ` Lorenzo Stoakes (ARM)
2026-09-23 19:59 ` Andrew Morton
2026-09-23 19:59   ` Andrew Morton
2026-09-23 19:59   ` Andrew Morton

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=20260922155414.61A4F1F000FF@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=agordeev@linux.ibm.com \
    --cc=borntraeger@linux.ibm.com \
    --cc=gor@linux.ibm.com \
    --cc=hca@linux.ibm.com \
    --cc=linux-s390@vger.kernel.org \
    --cc=ljs@kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /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.