linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Oscar Salvador <osalvador@suse.de>
To: Kairui Song <kasong@tencent.com>
Cc: linux-mm@kvack.org, Andrew Morton <akpm@linux-foundation.org>,
	David Hildenbrand <david@redhat.com>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] mm/memory: fix mapcount / refcount sanity check for mTHP reuse
Date: Mon, 28 Apr 2025 10:21:11 +0200	[thread overview]
Message-ID: <aA86d6L6GhAjnri1@localhost.localdomain> (raw)
In-Reply-To: <20250425074325.61833-1-ryncsn@gmail.com>

On Fri, Apr 25, 2025 at 03:43:25PM +0800, Kairui Song wrote:
> From: Kairui Song <kasong@tencent.com>
> 
> The following WARNING was triggered during swap stress test with
> mTHP enabled:
... 
> The WARN_ON here is simply incorrect. The refcount here must be at least
> the mapcount, not the opposite. Each mapcount must have a corresponding
> refcount, but the refcount may increase if other components grab the
> folio, which is acceptable. Meanwhile, having a mapcount larger than
> refcount is a real problem.
> 
> So fix the WARN_ON condition.
> 
> Fixes: 1da190f4d0a6 ("mm: Copy-on-Write (COW) reuse support for PTE-mapped THP")
> Reported-by: Kairui Song <kasong@tencent.com>
> Closes: https://lore.kernel.org/all/CAMgjq7D+ea3eg9gRCVvRnto3Sv3_H3WVhupX4e=k8T5QAfBHbw@mail.gmail.com/
> Suggested-by: David Hildenbrand <david@redhat.com>
> Signed-off-by: Kairui Song <kasong@tencent.com>

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


-- 
Oscar Salvador
SUSE Labs


  parent reply	other threads:[~2025-04-28  8:21 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-25  7:43 Kairui Song
2025-04-25  8:03 ` David Hildenbrand
2025-04-28  8:21 ` Oscar Salvador [this message]
2025-04-28 11:39 ` Anshuman Khandual

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=aA86d6L6GhAjnri1@localhost.localdomain \
    --to=osalvador@suse.de \
    --cc=akpm@linux-foundation.org \
    --cc=david@redhat.com \
    --cc=kasong@tencent.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.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