[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAGsJ_4zyVt13F=zwQNDuWZMKVtgh9U7pPAqgrRpM3nTn17or4g@mail.gmail.com>
Date: Tue, 23 Apr 2024 09:13:25 +0800
From: Barry Song <21cnbao@...il.com>
To: Baolin Wang <baolin.wang@...ux.alibaba.com>
Cc: akpm@...ux-foundation.org, hughd@...gle.com, willy@...radead.org,
david@...hat.com, wangkefeng.wang@...wei.com, ryan.roberts@....com,
ying.huang@...el.com, shy828301@...il.com, ziy@...dia.com, linux-mm@...ck.org,
linux-kernel@...r.kernel.org
Subject: Re: [RFC PATCH 3/5] mm: shmem: add THP validation for PMD-mapped THP
related statistics
On Mon, Apr 22, 2024 at 3:03 PM Baolin Wang
<baolin.wang@...ux.alibaba.com> wrote:
>
> In order to extend support for mTHP, add THP validation for PMD-mapped THP
> related statistics to avoid statistical confusion.
>
> Signed-off-by: Baolin Wang <baolin.wang@...ux.alibaba.com>
> ---
Reviewed-by: Barry Song <v-songbaohua@...o.com>
> mm/shmem.c | 7 ++++---
> 1 file changed, 4 insertions(+), 3 deletions(-)
>
> diff --git a/mm/shmem.c b/mm/shmem.c
> index 893c88efc45f..b4afda71a3f0 100644
> --- a/mm/shmem.c
> +++ b/mm/shmem.c
> @@ -1662,7 +1662,7 @@ static struct folio *shmem_alloc_and_add_folio(gfp_t gfp,
> return ERR_PTR(-E2BIG);
>
> folio = shmem_alloc_hugefolio(gfp, info, index, order);
> - if (!folio)
> + if (!folio && pages == HPAGE_PMD_NR)
> count_vm_event(THP_FILE_FALLBACK);
> } else {
> pages = 1;
> @@ -1680,7 +1680,7 @@ static struct folio *shmem_alloc_and_add_folio(gfp_t gfp,
> if (xa_find(&mapping->i_pages, &index,
> index + pages - 1, XA_PRESENT)) {
> error = -EEXIST;
> - } else if (huge) {
> + } else if (pages == HPAGE_PMD_NR) {
> count_vm_event(THP_FILE_FALLBACK);
> count_vm_event(THP_FILE_FALLBACK_CHARGE);
> }
> @@ -2046,7 +2046,8 @@ static int shmem_get_folio_gfp(struct inode *inode, pgoff_t index,
> folio = shmem_alloc_and_add_folio(huge_gfp,
> inode, index, fault_mm, true);
> if (!IS_ERR(folio)) {
> - count_vm_event(THP_FILE_ALLOC);
> + if (folio_test_pmd_mappable(folio))
> + count_vm_event(THP_FILE_ALLOC);
> goto alloced;
> }
> if (PTR_ERR(folio) == -EEXIST)
> --
> 2.39.3
>
Powered by blists - more mailing lists