Re: [PATCH v8 2/5] mm,page_owner: Implement the tracking of the stacks count
From: Oscar Salvador
Date: Tue Feb 13 2024 - 04:15:44 EST
On Tue, Feb 13, 2024 at 09:30:25AM +0100, Marco Elver wrote:
> On Mon, 12 Feb 2024 at 23:29, Oscar Salvador <osalvador@xxxxxxx> wrote:
> > Signed-off-by: Oscar Salvador <osalvador@xxxxxxx>
>
> For the code:
>
> Reviewed-by: Marco Elver <elver@xxxxxxxxxx>
Thanks!
> But see minor comments below.
> > +/**
> > + * __stack_depot_get_stack_record - Get a pointer to a stack_record struct
> > + * This function is only for internal purposes.
>
> I think the body of the kernel doc needs to go after argument declarations.
I see. I will amend that.
> > +static void add_stack_record_to_list(struct stack_record *stack_record)
> > +{
> > + unsigned long flags;
> > + struct stack *stack;
> > +
> > + stack = kmalloc(sizeof(*stack), GFP_KERNEL);
> > + if (stack) {
>
> It's usually more elegant to write
>
> if (!stack)
> return;
>
> If the rest of the function is conditional.
Yeah, probably better to save some identation.
> > + if (stack_record) {
> > + /*
> > + * New stack_record's that do not use STACK_DEPOT_FLAG_GET start
> > + * with REFCOUNT_SATURATED to catch spurious increments of their
> > + * refcount.
> > + * Since we do not use STACK_DEPOT_FLAG_{GET,PUT} API, let us
>
> I think I mentioned this in the other email, there is no
> STACK_DEPOT_FLAG_PUT, only stack_depot_put().
Yes, you did. This was an oversight.
I will fix that.
Thanks for the feedback Marco!
--
Oscar Salvador
SUSE Labs