Re: [PATCH v6 1/4] percpu: Fix wrong chunk hints update
From: Andrew Morton
Date: Mon May 18 2026 - 14:02:04 EST
On Wed, 13 May 2026 08:51:13 +0000 Joonwon Kang <joonwonkang@xxxxxxxxxx> wrote:
> Chunk end offset was set to a block end offset, which could prevent
> chunk hints from being updated correctly. It was observed that the chunk
> free size gets minus or shorter than the actual free size due to this.
> This commit fixes it.
>
> Fixes: 92c14cab4326 ("percpu: convert chunk hints to be based on pcpu_block_md")
> Signed-off-by: Joonwon Kang <joonwonkang@xxxxxxxxxx>
> Reviewed-by: Dennis Zhou <dennis@xxxxxxxxxx>
Thanks, I've updated mm.git to this version. Hopefully we'll be
getting formal review of this soon.
It would be nice to have a formal [0/N] conver letter to introduce this
series.
Below is how v6 altered mm.git, due to alterations in [4/4]:
> v6: Diverge more when the new contig size is the same as the old
> contig_hint size but greater than the old scan_hint, does not become a
> new contig_hint and is before the old contig_hint.
mm/percpu.c | 15 +++++++--------
1 file changed, 7 insertions(+), 8 deletions(-)
--- a/mm/percpu.c~b
+++ a/mm/percpu.c
@@ -728,19 +728,18 @@ static void pcpu_block_update(struct pcp
block->contig_hint.start = free.start;
} else {
if (block->contig_hint.size > block->scan_hint.size) {
- if (free.start < block->contig_hint.start) {
+ if (free.start > block->contig_hint.start) {
+ block->scan_hint = free;
+ } else if (block->scan_hint.size &&
+ free.start < block->scan_hint.start) {
/*
* old scan_hint.size < new contig size
* == old contig_hint.size. But, the new
- * contig is before the old contig_hint
- * so hold the invariant
- * scan_hint.start > contig_hint.start
- * iff scan_hint.size ==
- * contig_hint.size.
+ * contig is before the old scan_hint
+ * so invalidate the scan_hint to
+ * protect the contig_hint.
*/
block->scan_hint.size = 0;
- } else {
- block->scan_hint = free;
}
} else if (free.start > block->scan_hint.start) {
block->scan_hint = free;
_