Skip to content

Commit 7401745

Browse files
osalvadorvilardagaakpm00
authored andcommitted
mm,page_owner: fix printing of stack records
When seq_* code sees that its buffer overflowed, it re-allocates a bigger onecand calls seq_operations->start() callback again. stack_start() naively though that if it got called again, it meant that the old record got already printed so it returned the next object, but that is not true. The consequence of that is that every time stack_stop() -> stack_start() get called because we needed a bigger buffer, stack_start() will skip entries, and those will not be printed. Fix it by not advancing to the next object in stack_start(). Link: https://lkml.kernel.org/r/20240404070702.2744-5-osalvador@suse.de Fixes: 765973a ("mm,page_owner: display all stacks and their count") Signed-off-by: Oscar Salvador <osalvador@suse.de> Reviewed-by: Vlastimil Babka <vbabka@suse.cz> Cc: Alexander Potapenko <glider@google.com> Cc: Alexandre Ghiti <alexghiti@rivosinc.com> Cc: Andrey Konovalov <andreyknvl@gmail.com> Cc: Marco Elver <elver@google.com> Cc: Michal Hocko <mhocko@suse.com> Cc: Palmer Dabbelt <palmer@dabbelt.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
1 parent 718b1f3 commit 7401745

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

mm/page_owner.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -872,13 +872,11 @@ static void *stack_start(struct seq_file *m, loff_t *ppos)
872872
* value of stack_list.
873873
*/
874874
stack = smp_load_acquire(&stack_list);
875+
m->private = stack;
875876
} else {
876877
stack = m->private;
877-
stack = stack->next;
878878
}
879879

880-
m->private = stack;
881-
882880
return stack;
883881
}
884882

0 commit comments

Comments
 (0)