linux-api.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Vladimir Davydov <vdavydov@parallels.com>
To: Andres Lagar-Cavilla <andreslc@google.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 6/7] proc: add kpageidle file
Date: Thu, 16 Jul 2015 12:53:56 +0300	[thread overview]
Message-ID: <20150716095356.GB2001@esperanza> (raw)
In-Reply-To: <CAJu=L59He_qOEM3fEADLaKcV0YGY+QKQ_kPN=rSF8=U_UzAt2w@mail.gmail.com>

On Wed, Jul 15, 2015 at 12:42:28PM -0700, Andres Lagar-Cavilla wrote:
> On Wed, Jul 15, 2015 at 6:54 AM, Vladimir Davydov
> <vdavydov@parallels.com> wrote:
[...]
> > +static void kpageidle_clear_pte_refs(struct page *page)
> > +{
> > +       struct rmap_walk_control rwc = {
> > +               .rmap_one = kpageidle_clear_pte_refs_one,
> > +               .anon_lock = page_lock_anon_vma_read,
> > +       };
> > +       bool need_lock;
> > +
> > +       if (!page_mapped(page) ||
> 
> Question: what about mlocked pages? Is there any point in calculating
> their idleness?

Those can be filtered out with the aid of /proc/kpageflags (this is what
the script attached to patch #0 of the series actually does). We have to
read the latter anyway in order to get information about THP. That said,
I prefer not to introduce any artificial checks for locked memory. Who
knows, may be one day somebody will use this API to track access pattern
to an mlocked area.

> 
> > +           !page_rmapping(page))
> 
> Not sure, does this skip SwapCache pages? Is there any point in
> calculating their idleness?

A SwapCache page may be mapped, and if it is we should not skip it. If
it is unmapped, we have nothing to do.

Regarding idleness of SwapCache pages, I think we shouldn't
differentiate them from other user pages here, because a shmem/anon page
can migrate to-and-fro the swap cache occasionally during a
memory-active workload, and we don't want to lose its idle status then.

> 
> > +               return;
> > +
> > +       need_lock = !PageAnon(page) || PageKsm(page);
> > +       if (need_lock && !trylock_page(page))
> > +               return;
> > +
> > +       rmap_walk(page, &rwc);
> > +
> > +       if (need_lock)
> > +               unlock_page(page);
> > +}
[...]
> > @@ -1754,6 +1754,11 @@ static void __split_huge_page_refcount(struct page *page,
> >                 /* clear PageTail before overwriting first_page */
> >                 smp_wmb();
> >
> > +               if (page_is_young(page))
> > +                       set_page_young(page_tail);
> > +               if (page_is_idle(page))
> > +                       set_page_idle(page_tail);
> > +
> 
> Why not in the block above?
> 
> page_tail->flags |= (page->flags &
> ...
> #ifdef CONFIG_WHATEVER_IT_WAS
> 1 << PG_idle
> 1 << PG_young
> #endif

Too many ifdef's :-/ Note, the flags can be in page_ext, which mean we
would have to add something like this

#if defined(CONFIG_WHATEVER_IT_WAS) && defined(CONFIG_64BIT)
1 << PG_idle
1 << PG_young
#endif
<...>
#ifndef CONFIG_64BIT
if (page_is_young(page))
	set_page_young(page_tail);
if (page_is_idle(page))
	set_page_idle(page_tail);
#endif

which IMO looks less readable than what we have now.

Thanks,
Vladimir

--
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>

  reply	other threads:[~2015-07-16  9:53 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
     [not found]   ` <40a2af5afc7b70a133737226cd9e975df42936e7.1436967694.git.vdavydov-bzQdu9zFT3WakBO8gow8eQ@public.gmane.org>
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
     [not found]   ` <5c4d3594a5b0a79248fffae67ea677d54d06aacf.1436967694.git.vdavydov-bzQdu9zFT3WakBO8gow8eQ@public.gmane.org>
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
     [not found]     ` <CAJu=L58kZW2WRpx8wLx=FXdS29BJ+euLRdDcTXJKwf-VLT6SCA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-07-16  9:28       ` Vladimir Davydov
2015-07-16 19:04         ` Andres Lagar-Cavilla
     [not found]           ` <CAJu=L5_AUFv=Bh2WiWwOsMx41z_X0cAum_WkNikSE4Bo0r+wfQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
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
     [not found]   ` <a414d0458156434ca428c0c810db2e86878e1897.1436967694.git.vdavydov-bzQdu9zFT3WakBO8gow8eQ@public.gmane.org>
2015-07-15 19:42     ` Andres Lagar-Cavilla
2015-07-16  9:53       ` Vladimir Davydov [this message]
2015-07-15 13:54 ` [PATCH -mm v8 7/7] proc: export idle flag via kpageflags Vladimir Davydov
     [not found]   ` <024b60a19e5ef246c9af3c5ff7652e71576e0bcc.1436967694.git.vdavydov-bzQdu9zFT3WakBO8gow8eQ@public.gmane.org>
2015-07-15 19:17     ` Andres Lagar-Cavilla
2015-07-15 20:47 ` [PATCH -mm v8 0/7] idle memory tracking Andres Lagar-Cavilla
     [not found]   ` <CAJu=L59MjY4F4G2bZh+hrt7aqw3R9mWPeYK65smQWUvMhz85aA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
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=20150716095356.GB2001@esperanza \
    --to=vdavydov@parallels.com \
    --cc=akpm@linux-foundation.org \
    --cc=andreslc@google.com \
    --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=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;
as well as URLs for NNTP newsgroup(s).