From: Andrew Morton <akpm@linux-foundation.org>
To: Christian Hansen <chansen3@cisco.com>
Cc: xe-linux-external@cisco.com, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] tools: adding support for idle page tracking to tool
Date: Tue, 19 Jun 2018 15:39:11 -0700 [thread overview]
Message-ID: <20180619153911.bd835e2a7f0a4d2d3cddf348@linux-foundation.org> (raw)
In-Reply-To: <20180612153223.13174-1-chansen3@cisco.com>
On Tue, 12 Jun 2018 11:32:23 -0400 Christian Hansen <chansen3@cisco.com> wrote:
> Adding a flag which will use the kernels's idle
> page tracking to mark pages idle. As the tool already
> prints the idle flag if set, subsequent runs will show
> which pages have been accessed since last run.
That sounds useful.
This patch seems to have been prepared against the mainline kernel, so
it conflicts with your "tools: modifying page-types to include shared
map counts" patch. Awkward, but I seem to have got it fixed up.
> ...
>
> @@ -566,6 +570,30 @@ static int unpoison_page(unsigned long offset)
> return 0;
> }
>
> +static int mark_page_idle(unsigned long offset)
> +{
> + static unsigned long off;
> + static uint64_t buf;
> + int len;
> +
> + if ((offset / 64 == off / 64) || buf == 0) {
> + buf |= 1UL << (offset % 64);
> + off = offset;
> + return 0;
> + }
> +
> + len = pwrite(page_idle_fd, &buf, 8, 8 * (off / 64));
> + if (len < 0) {
> + perror("mark page idle");
> + return len;
> + }
> +
> + buf = 1UL << (offset % 64);
> + off = offset;
> +
> + return 0;
> +}
This is a bit cumbersome. Why not this way:
static int mark_page_idle(unsigned long offset)
{
static unsigned long off;
static uint64_t buf;
int len;
if ((offset / 64 != off / 64) && buf != 0) {
len = pwrite(page_idle_fd, &buf, 8, 8 * (off / 64));
if (len < 0) {
perror("mark page idle");
return len;
}
}
buf = 1UL << (offset % 64);
off = offset;
return 0;
}
Also, it's not very clear what's going on here - the handling of
offset, off and buf. Some well-crafted comments would help.
>
> ...
>
next prev parent reply other threads:[~2018-06-19 22:39 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-06-12 15:32 Christian Hansen
2018-06-19 22:39 ` Andrew Morton [this message]
2018-07-05 18:14 ` Christian Hansen (chansen3)
2018-06-19 22:41 ` Andrew Morton
-- strict thread matches above, loose matches on Subject: below --
2018-07-06 17:22 Christian Hansen
2018-06-01 15:18 Christian Hansen
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 \
--in-reply-to=20180619153911.bd835e2a7f0a4d2d3cddf348@linux-foundation.org \
--to=akpm@linux-foundation.org \
--cc=chansen3@cisco.com \
--cc=linux-kernel@vger.kernel.org \
--cc=xe-linux-external@cisco.com \
/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
all inboxes | Powered by JetHome®