Skip to content

Commit

Permalink
mm,page_owner: fix printing of stack records
Browse files Browse the repository at this point in the history
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/[email protected]
Fixes: 765973a ("mm,page_owner: display all stacks and their count")
Signed-off-by: Oscar Salvador <[email protected]>
Reviewed-by: Vlastimil Babka <[email protected]>
Cc: Alexander Potapenko <[email protected]>
Cc: Alexandre Ghiti <[email protected]>
Cc: Andrey Konovalov <[email protected]>
Cc: Marco Elver <[email protected]>
Cc: Michal Hocko <[email protected]>
Cc: Palmer Dabbelt <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
  • Loading branch information
osalvadorvilardaga authored and akpm00 committed Apr 16, 2024
1 parent 718b1f3 commit 7401745
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions mm/page_owner.c
Original file line number Diff line number Diff line change
Expand Up @@ -872,13 +872,11 @@ static void *stack_start(struct seq_file *m, loff_t *ppos)
* value of stack_list.
*/
stack = smp_load_acquire(&stack_list);
m->private = stack;
} else {
stack = m->private;
stack = stack->next;
}

m->private = stack;

return stack;
}

Expand Down

0 comments on commit 7401745

Please sign in to comment.