linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: SeongJae Park <sj38.park@gmail.com>
To: Matthew Wilcox <willy@infradead.org>
Cc: Vladimir Davydov <vdavydov.dev@gmail.com>,
	"Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>,
	Hugh Dickins <hughd@google.com>,
	linux-mm@kvack.org
Subject: Re: Idle THPs
Date: Mon, 14 Jun 2021 08:16:10 +0000	[thread overview]
Message-ID: <20210614081610.16123-1-sjpark@amazon.de> (raw)
In-Reply-To: <YMGKVmt8trMJ9kOP@casper.infradead.org>

From: SeongJae Park <sjpark@amazon.de>

On Thu, 10 Jun 2021 04:43:18 +0100 Matthew Wilcox <willy@infradead.org> wrote:

> As part of the folio work, I'm looking at PageIdle and PageYoung and
> they're defined to operate on PF_ANY.  So, for example, in
> pagecache_get_page(), we will call clear_page_idle() on the head page
> (actually, I changed this in a8cf7f272b5a -- before, it would call
> clear_page_idle() on the tail page).
> 
> However, we never actually call set_page_idle() on tail pages.  This is
> because we only call it here:
> 
>                         page = page_idle_get_page(pfn);
>                         if (page) {
>                                 page_idle_clear_pte_refs(page);
>                                 set_page_idle(page);
>                                 put_page(page);
>                         }
> 
> where page_idle_get_page() does:
> 
>         struct page *page = pfn_to_online_page(pfn);
> 
>         if (!page || !PageLRU(page) ||
>             !get_page_unless_zero(page))
>                 return NULL;
> 
> get_page_unless_zero() will always fail for tail pages (as it uses
> page_ref_add_unless(), which does not redirect to the head page's
> refcount).  So all tail pages read back as !idle in
> page_idle_bitmap_read().  Is this intended?  Should they rather
> mirror the state of their head page?

I think this is an intended behavior, as the document[1] says as below:

    For huge pages the idle flag is set only on the head page, so one has to
    read /proc/kpageflags in order to correctly count idle huge pages.

[1] https://www.kernel.org/doc/html/latest/admin-guide/mm/idle_page_tracking.html

Thanks,
SeongJae Park


  reply	other threads:[~2021-06-14  8:16 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-10  3:43 Idle THPs Matthew Wilcox
2021-06-14  8:16 ` SeongJae Park [this message]
     [not found] ` <59f61523-cb38-bf8c-51ba-1017ea7212d2@google.com>
     [not found]   ` <CAHbLzkrznNBhGHZCN-Pf=1tUK+9Ad0TEXkC_fwDNcjceDt3vuw@mail.gmail.com>
2021-06-17 15:57     ` Shakeel Butt

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=20210614081610.16123-1-sjpark@amazon.de \
    --to=sj38.park@gmail.com \
    --cc=hughd@google.com \
    --cc=kirill.shutemov@linux.intel.com \
    --cc=linux-mm@kvack.org \
    --cc=vdavydov.dev@gmail.com \
    --cc=willy@infradead.org \
    /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).