Re: [PATCH 2/3] mm, page_owner: Add page_owner_stacks file to print out only stacks and their counter

From: Oscar Salvador
Date: Thu Sep 01 2022 - 23:33:38 EST


On Thu, Sep 01, 2022 at 03:16:44PM +0700, Ammar Faizi wrote:
> On 9/1/22 11:42 AM, Oscar Salvador wrote:
> > +static unsigned long last_stack = 0;
>
> This @last_stack can just be a static local variable in the new
> function you wrote, read_page_owner_stacks(), since no other
> functions use it.

We could certainly do that.

>
> > +static ssize_t read_page_owner_stacks(struct file *file, char __user *buf,
> > + size_t count, loff_t *pos)
> > +{
> > + char *kbuf;
> > + int ret = 0;
> > +
> > + count = min_t(size_t, count, PAGE_SIZE);
> > + kbuf = kmalloc(count, GFP_KERNEL);
> > + if (!kbuf)
> > + return ENOMEM;
>
> Missing a negative sign, return -ENOMEM;

Oh yes, I overlooked that.

Thanks!


--
Oscar Salvador
SUSE Labs