From: Yin Fengwei <fengwei.yin@intel.com>
To: linux-mm@kvack.org, linux-kernel@vger.kernel.org,
akpm@linux-foundation.org, minchan@kernel.org, yuzhao@google.com,
willy@infradead.org, david@redhat.com, ryan.roberts@arm.com,
shy828301@gmail.com
Cc: fengwei.yin@intel.com
Subject: [RFC PATCH v2 0/4] fix large folio for madvise_cold_or_pageout()
Date: Fri, 21 Jul 2023 17:40:39 +0800 [thread overview]
Message-ID: <20230721094043.2506691-1-fengwei.yin@intel.com> (raw)
Current madvise_cold_or_pageout_pte_range() has two problems to deal
with large folio:
- Using folio_mapcount() with large folio prevent large folio from
picking up.
- always try to split large folio to normal 4K page.
Try to address these two problems by:
- Use folio_estimated_sharers() with large folio. With assumption that
the estimated result of whether the large folio is shared or not is
enough here.
- If the large folio is in the range, don't split it. Leave to page
reclaim as page reclaim can support swap large folio out as whole in
the future.
- Only split the large folio if it crosses the boundaries of the
range. If folio splitting fails, just skip the folio as madvise allows
some pages in the range are ignored.
Patch1 uses folio_estimated_sharers() to replace folio_mapcount().
Patch2 uses API pmdp_clear_flush_young_notify() to clear A bit of page
table. It also notifies the mm subscripter about the A bit clearing.
Patch3 introduce help function to check whether the folio crosses range
boundary.
Patch4 avoid splitting large folio if folio is in the range.
Changes from V1:
- Split patch1 out as Yu's suggestion
- Split patch2 out as Yu's suggestion
- Handle cold case correctly (cold operation was broken in V1 patch)
- rebase the patchset to latest mm-unstable
Testing done:
- mm selftest without new regression.
V1's link:
https://lore.kernel.org/linux-mm/20230713150558.200545-1-fengwei.yin@intel.com/
Yin Fengwei (4):
madvise: not use mapcount() against large folio for sharing check
madvise: Use notify-able API to clear and flush page table entries
mm: add functions folio_in_range() and folio_within_vma()
madvise: avoid trying to split large folio always in cold_pageout
mm/internal.h | 42 ++++++++++++++++
mm/madvise.c | 136 +++++++++++++++++++++++++++++++-------------------
2 files changed, 127 insertions(+), 51 deletions(-)
--
2.39.2
next reply other threads:[~2023-07-21 9:41 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-21 9:40 Yin Fengwei [this message]
2023-07-21 9:40 ` [RFC PATCH v2 1/4] madvise: not use mapcount() against large folio for sharing check Yin Fengwei
2023-07-21 18:57 ` Yu Zhao
2023-07-23 12:26 ` Yin, Fengwei
2023-07-25 5:22 ` Yu Zhao
2023-07-21 9:40 ` [RFC PATCH v2 2/4] madvise: Use notify-able API to clear and flush page table entries Yin Fengwei
2023-07-25 5:55 ` Yu Zhao
2023-07-26 2:49 ` Yin Fengwei
2023-07-26 3:26 ` Yu Zhao
2023-07-26 4:44 ` Yin Fengwei
2023-07-26 5:40 ` Yu Zhao
2023-07-26 6:21 ` Yin Fengwei
2023-07-27 3:28 ` Yu Zhao
2023-07-28 16:14 ` Yin, Fengwei
2023-07-21 9:40 ` [RFC PATCH v2 3/4] mm: add functions folio_in_range() and folio_within_vma() Yin Fengwei
2023-07-25 5:42 ` Yu Zhao
2023-07-21 9:40 ` [RFC PATCH v2 4/4] madvise: avoid trying to split large folio always in cold_pageout Yin Fengwei
2023-07-25 5:26 ` Yu Zhao
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=20230721094043.2506691-1-fengwei.yin@intel.com \
--to=fengwei.yin@intel.com \
--cc=akpm@linux-foundation.org \
--cc=david@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=minchan@kernel.org \
--cc=ryan.roberts@arm.com \
--cc=shy828301@gmail.com \
--cc=willy@infradead.org \
--cc=yuzhao@google.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