Re: [PATCH v7 2/4] mm,page_owner: Implement the tracking of the stacks count

From: Oscar Salvador
Date: Sun Feb 11 2024 - 15:41:36 EST


On Fri, Feb 09, 2024 at 10:44:23PM +0100, Marco Elver wrote:
> > > * set a refcount of 1 ourselves.
> > > */
> > > if (refcount_read(&stack->count) == REFCOUNT_SATURATED)
> > > refcount_set(&stack->count, 1);
>
> Do you need to inc the first allocation? Should there be an "else"
> here instead of always doing refcount_inc()?

Yes, I need to inc in the first allocation, otherwise on the first free
op, refcount goes to 0, and when the next allocation comes around,
I will get a warning because of going from refcount 0 to 1.


--
Oscar Salvador
SUSE Labs