From: "Huang, Ying" <ying.huang@intel.com>
To: <alexlzhu@fb.com>
Cc: <linux-mm@kvack.org>, <willy@infradead.org>,
<akpm@linux-foundation.org>, <riel@surriel.com>,
<hannes@cmpxchg.org>, <linux-kernel@vger.kernel.org>,
<kernel-team@fb.com>
Subject: Re: [PATCH 2/3] mm: changes to split_huge_page() to free zero filled tail pages
Date: Wed, 28 Sep 2022 16:48:40 +0800 [thread overview]
Message-ID: <87v8p728bb.fsf@yhuang6-desk2.ccr.corp.intel.com> (raw)
In-Reply-To: <94de34378bb748196e7709205a75331569d1d28e.1664347167.git.alexlzhu@fb.com> (alexlzhu@fb.com's message of "Tue, 27 Sep 2022 23:44:12 -0700")
<alexlzhu@fb.com> writes:
> From: Alexander Zhu <alexlzhu@fb.com>
>
> Currently, when /sys/kernel/mm/transparent_hugepage/enabled=always is set
> there are a large number of transparent hugepages that are almost entirely
> zero filled. This is mentioned in a number of previous patchsets
> including:
> https://lore.kernel.org/all/20210731063938.1391602-1-yuzhao@google.com/
> https://lore.kernel.org/all/
> 1635422215-99394-1-git-send-email-ningzhang@linux.alibaba.com/
>
> Currently, split_huge_page() does not have a way to identify zero filled
> pages within the THP. Thus these zero pages get remapped and continue to
> create memory waste. In this patch, we identify and free tail pages that
> are zero filled in split_huge_page(). In this way, we avoid mapping these
> pages back into page table entries and can free up unused memory within
> THPs. This is based off the previously mentioned patchset by Yu Zhao.
> However, we chose to free anonymous zero tail pages whenever they are
> encountered instead of only on reclaim or migration.
>
> We also add self tests to verify the RssAnon value to make sure zero
> pages are not remapped except in the case of userfaultfd. In the case
> of userfaultfd we remap to the shared zero page, similar to what is
> done by KSM.
>
> Signed-off-by: Alexander Zhu <alexlzhu@fb.com>
> ---
> include/linux/rmap.h | 2 +-
> include/linux/vm_event_item.h | 3 +
> mm/huge_memory.c | 44 ++++++-
> mm/migrate.c | 72 +++++++++--
> mm/migrate_device.c | 4 +-
> mm/vmstat.c | 3 +
> .../selftests/vm/split_huge_page_test.c | 113 +++++++++++++++++-
> tools/testing/selftests/vm/vm_util.c | 23 ++++
> tools/testing/selftests/vm/vm_util.h | 1 +
> 9 files changed, 250 insertions(+), 15 deletions(-)
>
> diff --git a/include/linux/rmap.h b/include/linux/rmap.h
> index b89b4b86951f..f7d5d5639dea 100644
> --- a/include/linux/rmap.h
> +++ b/include/linux/rmap.h
> @@ -372,7 +372,7 @@ int folio_mkclean(struct folio *);
> int pfn_mkclean_range(unsigned long pfn, unsigned long nr_pages, pgoff_t pgoff,
> struct vm_area_struct *vma);
>
> -void remove_migration_ptes(struct folio *src, struct folio *dst, bool locked);
> +void remove_migration_ptes(struct folio *src, struct folio *dst, bool locked, bool unmap_clean);
There are 2 bool parameters now. How about use "flags" style
parameters? IMHO, well defined constants are more readable than a set
of true/false.
Best Regards,
Huang, Ying
[snip]
next prev parent reply other threads:[~2022-09-28 8:49 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-09-28 6:44 [PATCH 0/3] THP Shrinker alexlzhu
2022-09-28 6:44 ` [PATCH 1/3] mm: add thp_utilization metrics to sysfs alexlzhu
2022-09-28 6:44 ` [PATCH 2/3] mm: changes to split_huge_page() to free zero filled tail pages alexlzhu
2022-09-28 8:48 ` Huang, Ying [this message]
2022-09-28 16:24 ` Alex Zhu (Kernel)
2022-10-01 20:39 ` kernel test robot
2022-09-28 6:44 ` [PATCH 3/3] mm: THP low utilization shrinker alexlzhu
2022-09-28 14:21 ` [PATCH 0/3] THP Shrinker David Hildenbrand
2022-09-28 16:22 ` Alex Zhu (Kernel)
[not found] <cover.1664344829.git.alexlzhu@fb.com>
2022-09-28 6:25 ` [PATCH 2/3] mm: changes to split_huge_page() to free zero filled tail pages alexlzhu
2022-09-28 17:04 ` kernel test robot
2022-09-28 19:13 ` kernel test robot
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=87v8p728bb.fsf@yhuang6-desk2.ccr.corp.intel.com \
--to=ying.huang@intel.com \
--cc=akpm@linux-foundation.org \
--cc=alexlzhu@fb.com \
--cc=hannes@cmpxchg.org \
--cc=kernel-team@fb.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=riel@surriel.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