From: Andres Lagar-Cavilla <andreslc@google.com>
To: Vladimir Davydov <vdavydov@parallels.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
Minchan Kim <minchan@kernel.org>,
Raghavendra K T <raghavendra.kt@linux.vnet.ibm.com>,
Johannes Weiner <hannes@cmpxchg.org>,
Michal Hocko <mhocko@suse.cz>, Greg Thelen <gthelen@google.com>,
Michel Lespinasse <walken@google.com>,
David Rientjes <rientjes@google.com>,
Pavel Emelyanov <xemul@parallels.com>,
Cyrill Gorcunov <gorcunov@openvz.org>,
Jonathan Corbet <corbet@lwn.net>,
linux-api@vger.kernel.org, linux-doc@vger.kernel.org,
linux-mm@kvack.org, cgroups@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH -mm v8 7/7] proc: export idle flag via kpageflags
Date: Wed, 15 Jul 2015 12:17:02 -0700 [thread overview]
Message-ID: <CAJu=L58+L9nQDeW0VeaX3fmKy0EWG7js_rg3eWSVTg1D3WWHkg@mail.gmail.com> (raw)
In-Reply-To: <024b60a19e5ef246c9af3c5ff7652e71576e0bcc.1436967694.git.vdavydov@parallels.com>
On Wed, Jul 15, 2015 at 6:54 AM, Vladimir Davydov
<vdavydov@parallels.com> wrote:
> As noted by Minchan, a benefit of reading idle flag from
> /proc/kpageflags is that one can easily filter dirty and/or unevictable
> pages while estimating the size of unused memory.
>
> Note that idle flag read from /proc/kpageflags may be stale in case the
> page was accessed via a PTE, because it would be too costly to iterate
> over all page mappings on each /proc/kpageflags read to provide an
> up-to-date value. To make sure the flag is up-to-date one has to read
> /proc/kpageidle first.
>
> Signed-off-by: Vladimir Davydov <vdavydov@parallels.com>
Reviewed-by: Andres Lagar-Cavilla <andreslc@google.com>
> ---
> Documentation/vm/pagemap.txt | 6 ++++++
> fs/proc/page.c | 3 +++
> include/uapi/linux/kernel-page-flags.h | 1 +
> 3 files changed, 10 insertions(+)
>
> diff --git a/Documentation/vm/pagemap.txt b/Documentation/vm/pagemap.txt
> index c9266340852c..5896b7d7fd74 100644
> --- a/Documentation/vm/pagemap.txt
> +++ b/Documentation/vm/pagemap.txt
> @@ -64,6 +64,7 @@ There are five components to pagemap:
> 22. THP
> 23. BALLOON
> 24. ZERO_PAGE
> + 25. IDLE
>
> * /proc/kpagecgroup. This file contains a 64-bit inode number of the
> memory cgroup each page is charged to, indexed by PFN. Only available when
> @@ -124,6 +125,11 @@ Short descriptions to the page flags:
> 24. ZERO_PAGE
> zero page for pfn_zero or huge_zero page
>
> +25. IDLE
> + page has not been accessed since it was marked idle (see /proc/kpageidle)
> + Note that this flag may be stale in case the page was accessed via a PTE.
> + To make sure the flag is up-to-date one has to read /proc/kpageidle first.
> +
> [IO related page flags]
> 1. ERROR IO error occurred
> 3. UPTODATE page has up-to-date data
> diff --git a/fs/proc/page.c b/fs/proc/page.c
> index 273537885ab4..13dcb823fe4e 100644
> --- a/fs/proc/page.c
> +++ b/fs/proc/page.c
> @@ -150,6 +150,9 @@ u64 stable_page_flags(struct page *page)
> if (PageBalloon(page))
> u |= 1 << KPF_BALLOON;
>
> + if (page_is_idle(page))
> + u |= 1 << KPF_IDLE;
> +
> u |= kpf_copy_bit(k, KPF_LOCKED, PG_locked);
>
> u |= kpf_copy_bit(k, KPF_SLAB, PG_slab);
> diff --git a/include/uapi/linux/kernel-page-flags.h b/include/uapi/linux/kernel-page-flags.h
> index a6c4962e5d46..5da5f8751ce7 100644
> --- a/include/uapi/linux/kernel-page-flags.h
> +++ b/include/uapi/linux/kernel-page-flags.h
> @@ -33,6 +33,7 @@
> #define KPF_THP 22
> #define KPF_BALLOON 23
> #define KPF_ZERO_PAGE 24
> +#define KPF_IDLE 25
>
>
> #endif /* _UAPILINUX_KERNEL_PAGE_FLAGS_H */
> --
> 2.1.4
>
--
Andres Lagar-Cavilla | Google Kernel Team | andreslc@google.com
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
next prev parent reply other threads:[~2015-07-15 19:17 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-07-15 13:54 [PATCH -mm v8 0/7] idle memory tracking Vladimir Davydov
2015-07-15 13:54 ` [PATCH -mm v8 1/7] memcg: add page_cgroup_ino helper Vladimir Davydov
2015-07-15 18:59 ` Andres Lagar-Cavilla
2015-07-15 13:54 ` [PATCH -mm v8 2/7] hwpoison: use page_cgroup_ino for filtering by memcg Vladimir Davydov
2015-07-15 19:00 ` Andres Lagar-Cavilla
2015-07-15 13:54 ` [PATCH -mm v8 3/7] memcg: zap try_get_mem_cgroup_from_page Vladimir Davydov
2015-07-15 13:54 ` [PATCH -mm v8 4/7] proc: add kpagecgroup file Vladimir Davydov
2015-07-15 19:03 ` Andres Lagar-Cavilla
2015-07-16 9:28 ` Vladimir Davydov
2015-07-16 19:04 ` Andres Lagar-Cavilla
2015-07-17 9:27 ` Vladimir Davydov
2015-07-15 13:54 ` [PATCH -mm v8 5/7] mmu-notifier: add clear_young callback Vladimir Davydov
2015-07-15 19:16 ` Andres Lagar-Cavilla
2015-07-16 11:35 ` Paolo Bonzini
2015-07-15 13:54 ` [PATCH -mm v8 6/7] proc: add kpageidle file Vladimir Davydov
2015-07-15 19:42 ` Andres Lagar-Cavilla
2015-07-16 9:53 ` Vladimir Davydov
2015-07-15 13:54 ` [PATCH -mm v8 7/7] proc: export idle flag via kpageflags Vladimir Davydov
2015-07-15 19:17 ` Andres Lagar-Cavilla [this message]
2015-07-15 20:47 ` [PATCH -mm v8 0/7] idle memory tracking Andres Lagar-Cavilla
2015-07-16 10:02 ` Vladimir Davydov
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='CAJu=L58+L9nQDeW0VeaX3fmKy0EWG7js_rg3eWSVTg1D3WWHkg@mail.gmail.com' \
--to=andreslc@google.com \
--cc=akpm@linux-foundation.org \
--cc=cgroups@vger.kernel.org \
--cc=corbet@lwn.net \
--cc=gorcunov@openvz.org \
--cc=gthelen@google.com \
--cc=hannes@cmpxchg.org \
--cc=linux-api@vger.kernel.org \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mhocko@suse.cz \
--cc=minchan@kernel.org \
--cc=raghavendra.kt@linux.vnet.ibm.com \
--cc=rientjes@google.com \
--cc=vdavydov@parallels.com \
--cc=walken@google.com \
--cc=xemul@parallels.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