All of lore.kernel.org
 help / color / mirror / Atom feed
From: Breno Leitao <leitao@debian.org>
To: kasong@tencent.com
Cc: linux-mm@kvack.org, Andrew Morton <akpm@linux-foundation.org>,
	 Chris Li <chrisl@kernel.org>,
	Kemeng Shi <shikemeng@huaweicloud.com>,
	 Nhat Pham <nphamcs@gmail.com>, Baoquan He <bhe@redhat.com>,
	Barry Song <baohua@kernel.org>,
	 Youngjun Park <youngjun.park@lge.com>,
	Kairui Song <ryncsn@gmail.com>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] mm, swap: avoid leaving unused extend table after alloc race
Date: Wed, 13 May 2026 05:49:35 -0700	[thread overview]
Message-ID: <agRzO1RLpYH5RjDV@gmail.com> (raw)
In-Reply-To: <20260513-swap-extend-table-fix-v1-1-a71dea851fb3@tencent.com>

On Wed, May 13, 2026 at 05:21:11PM +0800, Kairui Song via B4 Relay wrote:
> From: Kairui Song <kasong@tencent.com>
> 
> Allocating an extend table requires dropping the ci lock first.
> While the lock is dropped, a concurrent put can decrease the slot's
> swap count to a value that is no longer maxed out, so the extend
> table is no longer required. The current allocation path still
> attach the new extend table to the cluster anyway, leaving it unused.
> 
> It's not really leaked, the next maxed out count on the same cluster
> reuses the table, and frees it properly. Swapoff will also clean it up.
> 
> The worst case is one unused page pinned per cluster until the next
> maxed-out allocation or swapoff. To eliminate the waste, re-check
> under the ci lock that the extend table is still needed before
> publishing it, and free the local allocation otherwise. The added
> overhead is ignorable.
> 
> Fixes: 0d6af9bcf383 ("mm, swap: use the swap table to track the swap count")
> Reported-by: Breno Leitao <leitao@debian.org>
> Closes: https://lore.kernel.org/linux-mm/agG6Dp0umhs6O1SY@gmail.com/
> Signed-off-by: Kairui Song <kasong@tencent.com>

Tested-by: Breno Leitao <leitao@debian.org>

Thanks for the fix,
--breno


  reply	other threads:[~2026-05-13 12:49 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-13  9:21 [PATCH] mm, swap: avoid leaving unused extend table after alloc race Kairui Song via B4 Relay
2026-05-13  9:21 ` Kairui Song
2026-05-13 12:49 ` Breno Leitao [this message]
2026-05-15  8:21 ` Kairui Song

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=agRzO1RLpYH5RjDV@gmail.com \
    --to=leitao@debian.org \
    --cc=akpm@linux-foundation.org \
    --cc=baohua@kernel.org \
    --cc=bhe@redhat.com \
    --cc=chrisl@kernel.org \
    --cc=kasong@tencent.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=nphamcs@gmail.com \
    --cc=ryncsn@gmail.com \
    --cc=shikemeng@huaweicloud.com \
    --cc=youngjun.park@lge.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.