Re: [PATCH v7 3/4] mm,page_owner: Display all stacks and their count

From: Oscar Salvador
Date: Fri Feb 09 2024 - 18:13:20 EST


On Fri, Feb 09, 2024 at 10:52:48PM +0100, Oscar Salvador wrote:
> Thinking about it some more, I think I made a mistake:
>
> I am walking all buckets, and within those buckets there are not only
> page_owner stack_records, which means that I could return a stack_record
> from e.g: KASAN (which I think can evict stack_records) and then
> everything goes off the rails.
> Which means I cannot walk the buckets like that.
>
> Actually, I think that having something like the following
>
> struct list_stack_records {
> struct stack_record *stack;
> struct list_stack_records *next;
> }

Or, I could use the extra_bits field from handle_parts to flag that
when a depot_stack_handle_t is used by page_owner.

Then __stack_depot_get_next_stack_record() would check whether
a stack_record->handle.extra_bits has the page_owner bit, and only
return those stacks that have such bit.
This would solve the problem of returning a potentially evictable stack
, only by returning page_owner's stack_records, and I would not have
to maintain my own list.

I yet have to see how that would look like, but sounds promising.
Do you think that is feasible Marco?

Thanks

--
Oscar Salvador
SUSE Labs