From: Ammar Faizi <[email protected]>
To: Oscar Salvador <[email protected]>
Cc: Linux Kernel Mailing List <[email protected]>,
Linux MM Mailing List <[email protected]>,
Andrew Morton <[email protected]>,
Michal Hocko <[email protected]>, Vlastimil Babka <[email protected]>,
Eric Dumazet <[email protected]>,
Waiman Long <[email protected]>,
Suren Baghdasaryan <[email protected]>,
Ammar Faizi <[email protected]>
Subject: Re: [PATCH 2/3] mm, page_owner: Add page_owner_stacks file to print out only stacks and their counter
Date: Thu, 1 Sep 2022 15:16:44 +0700 [thread overview]
Message-ID: <[email protected]> (raw)
In-Reply-To: <[email protected]>
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.
> +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;
> + ret += stack_depot_print_stacks_threshold(kbuf, count, pos, &last_stack);
> + if (copy_to_user(buf, kbuf, ret))
> + ret = -EFAULT;
> +
> + if (!ret)
> + last_stack = 0;
> +
> + kfree(kbuf);
> + return ret;
> +}
--
Ammar Faizi
next parent reply other threads:[~2022-09-01 8:16 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <[email protected]>
[not found] ` <[email protected]>
2022-09-01 8:16 ` Ammar Faizi [this message]
[not found] ` <[email protected]>
2022-09-01 8:31 ` [PATCH 3/3] mm,page_owner: Filter out stacks by a threshold counter Ammar Faizi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
[email protected] \
[email protected] \
[email protected] \
[email protected] \
[email protected] \
[email protected] \
[email protected] \
[email protected] \
[email protected] \
[email protected] \
[email protected] \
[email protected] \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox