From: Joel Fernandes <joel@joelfernandes.org>
To: Konstantin Khlebnikov <khlebnikov@yandex-team.ru>
Cc: Minchan Kim <minchan@kernel.org>,
linux-kernel@vger.kernel.org, vdavydov.dev@gmail.com,
Brendan Gregg <bgregg@netflix.com>,
kernel-team@android.com, Alexey Dobriyan <adobriyan@gmail.com>,
Al Viro <viro@zeniv.linux.org.uk>,
Andrew Morton <akpm@linux-foundation.org>,
carmenjackson@google.com, Christian Hansen <chansen3@cisco.com>,
Colin Ian King <colin.king@canonical.com>,
dancol@google.com, David Howells <dhowells@redhat.com>,
fmayer@google.com, joaodias@google.com,
Jonathan Corbet <corbet@lwn.net>,
Kees Cook <keescook@chromium.org>,
Kirill Tkhai <ktkhai@virtuozzo.com>,
linux-doc@vger.kernel.org, linux-fsdevel@vger.kernel.org,
linux-mm@kvack.org, Michal Hocko <mhocko@suse.com>,
Mike Rapoport <rppt@linux.ibm.com>,
namhyung@google.com, sspatil@google.com
Subject: Re: [PATCH v1 1/2] mm/page_idle: Add support for per-pid page_idle using virtual indexing
Date: Fri, 26 Jul 2019 08:54:21 -0400 [thread overview]
Message-ID: <20190726125421.GA103959@google.com> (raw)
In-Reply-To: <9cba9acb-9451-a53e-278d-92f7b66ae20b@yandex-team.ru>
On Fri, Jul 26, 2019 at 02:16:20PM +0300, Konstantin Khlebnikov wrote:
> On 26.07.2019 3:06, Joel Fernandes wrote:
> > On Thu, Jul 25, 2019 at 11:15:53AM +0300, Konstantin Khlebnikov wrote:
> > [snip]
> > > > > > Thanks for bringing up the swapping corner case.. Perhaps we can improve
> > > > > > the heap profiler to detect this by looking at bits 0-4 in pagemap. While it
> > > > >
> > > > > Yeb, that could work but it could add overhead again what you want to remove?
> > > > > Even, userspace should keep metadata to identify that page was already swapped
> > > > > in last period or newly swapped in new period.
> > > >
> > > > Yep.
> > > Between samples page could be read from swap and swapped out back multiple times.
> > > For tracking this swap ptes could be marked with idle bit too.
> > > I believe it's not so hard to find free bit for this.
> > >
> > > Refault\swapout will automatically clear this bit in pte even if
> > > page goes nowhere stays if swap-cache.
> >
> > Could you clarify more about your idea? Do you mean swapout will clear the new
> > idle swap-pte bit if the page was accessed just before the swapout? >
> > Instead, I thought of using is_swap_pte() to detect if the PTE belong to a
> > page that was swapped. And if so, then assume the page was idle. Sure we
> > would miss data that the page was accessed before the swap out in the
> > sampling window, however if the page was swapped out, then it is likely idle
> > anyway.
>
>
> I mean page might be in swap when you mark pages idle and
> then been accessed and swapped back before second pass.
>
> I propose marking swap pte with idle bit which will be automatically
> cleared by following swapin/swapout pair:
>
> page alloc -> install page pte
> page swapout -> install swap entry in pte
> mark vm idle -> set swap-idle bit in swap pte
> access/swapin -> install page pte (clear page idle if set)
> page swapout -> install swap entry in pte (without swap idle bit)
> scan vm idle -> see swap entry without idle bit -> page has been accessed since marking idle
>
> One bit in pte is enough for tracking. This does not needs any propagation for
> idle bits between page and swap, or marking pages as idle in swap cache.
Ok I see the case you are referring to now. This can be a follow-up patch to
address the case, because.. the limitation you mentioned is also something
inherrent in the (traditional) physical page_idle tracking if that were used.
The reason being, after swapping, the PTE is not mapped to any page so there
is nothing to mark as idle. So if the page gets swapped out and in in the
meanwhile, then you would run into the same issue.
But yes, we should certainly address it in the future. I just want to keep
things simple at the moment. I will make a note about your suggestion but you
are welcomed to write a patch for it on top of my patch. I am about to send
another revision shortly for futhre review.
thanks,
- Joel
next prev parent reply other threads:[~2019-07-26 12:54 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-07-22 21:32 Joel Fernandes (Google)
2019-07-22 21:32 ` [PATCH v1 2/2] doc: Update documentation for page_idle virtual address indexing Joel Fernandes (Google)
2019-07-22 22:06 ` [PATCH v1 1/2] mm/page_idle: Add support for per-pid page_idle using virtual indexing Andrew Morton
2019-07-23 14:43 ` Joel Fernandes
2019-07-24 19:33 ` Joel Fernandes
2019-07-23 6:05 ` Michal Hocko
2019-07-23 14:34 ` Joel Fernandes
2019-07-23 6:13 ` Minchan Kim
2019-07-23 14:20 ` Joel Fernandes
2019-07-24 4:28 ` Minchan Kim
2019-07-24 14:10 ` Joel Fernandes
2019-07-25 8:15 ` Konstantin Khlebnikov
2019-07-26 0:06 ` Joel Fernandes
2019-07-26 11:16 ` Konstantin Khlebnikov
2019-07-26 12:54 ` Joel Fernandes [this message]
2019-07-23 8:43 ` Konstantin Khlebnikov
2019-07-23 10:10 ` Konstantin Khlebnikov
2019-07-23 13:47 ` Joel Fernandes
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=20190726125421.GA103959@google.com \
--to=joel@joelfernandes.org \
--cc=adobriyan@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=bgregg@netflix.com \
--cc=carmenjackson@google.com \
--cc=chansen3@cisco.com \
--cc=colin.king@canonical.com \
--cc=corbet@lwn.net \
--cc=dancol@google.com \
--cc=dhowells@redhat.com \
--cc=fmayer@google.com \
--cc=joaodias@google.com \
--cc=keescook@chromium.org \
--cc=kernel-team@android.com \
--cc=khlebnikov@yandex-team.ru \
--cc=ktkhai@virtuozzo.com \
--cc=linux-doc@vger.kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mhocko@suse.com \
--cc=minchan@kernel.org \
--cc=namhyung@google.com \
--cc=rppt@linux.ibm.com \
--cc=sspatil@google.com \
--cc=vdavydov.dev@gmail.com \
--cc=viro@zeniv.linux.org.uk \
/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