linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Oscar Salvador <osalvador@suse.de>
To: Baolin Wang <baolin.wang@linux.alibaba.com>
Cc: akpm@linux-foundation.org, willy@infradead.org, david@redhat.com,
	hannes@cmpxchg.org, 21cnbao@gmail.com, ryan.roberts@arm.com,
	ziy@nvidia.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] mm: huge_memory: add folio_mark_accessed() when zapping file THP
Date: Thu, 10 Apr 2025 10:45:49 +0200	[thread overview]
Message-ID: <Z_eFPetk00AaFXem@localhost.localdomain> (raw)
In-Reply-To: <fc117f60d7b686f87067f36a0ef7cdbc3a78109c.1744190345.git.baolin.wang@linux.alibaba.com>

On Wed, Apr 09, 2025 at 05:38:58PM +0800, Baolin Wang wrote:
> When investigating performance issues during file folio unmap, I noticed some
> behavioral differences in handling non-PMD-sized folios and PMD-sized folios.
> For non-PMD-sized file folios, it will call folio_mark_accessed() to mark the
> folio as having seen activity, but this is not done for PMD-sized folios.
> 
> This might not cause obvious issues, but a potential problem could be that,
> it might lead to reclaim hot file folios under memory pressure, as quoted
> from Johannes:
> 
> "
> Sometimes file contents are only accessed through relatively short-lived
> mappings. But they can nevertheless be accessed a lot and be hot. It's
> important to not lose that information on unmap, and end up kicking out a
> frequently used cache page.
> "
> 
> Therefore, we should also add folio_mark_accessed() for PMD-sized file
> folios when unmapping.
> 
> Signed-off-by: Baolin Wang <baolin.wang@linux.alibaba.com>
> Acked-by: Johannes Weiner <hannes@cmpxchg.org>
> Acked-by: Zi Yan <ziy@nvidia.com>

Reviewed-by: Oscar Salvador <osalvador@suse.de>

Although I agree with David here that pmd_present would be more obvious than
flush_needed.
It was not obvious to be at first glance.

 

-- 
Oscar Salvador
SUSE Labs


  parent reply	other threads:[~2025-04-10  8:45 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-09  9:38 Baolin Wang
2025-04-09  9:46 ` David Hildenbrand
2025-04-09  9:49   ` Baolin Wang
2025-04-09  9:53     ` David Hildenbrand
2025-04-10  8:45 ` Oscar Salvador [this message]
2025-04-11  1:07   ` Baolin Wang
2025-04-11  3:14     ` Oscar Salvador

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=Z_eFPetk00AaFXem@localhost.localdomain \
    --to=osalvador@suse.de \
    --cc=21cnbao@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=baolin.wang@linux.alibaba.com \
    --cc=david@redhat.com \
    --cc=hannes@cmpxchg.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=ryan.roberts@arm.com \
    --cc=willy@infradead.org \
    --cc=ziy@nvidia.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