All of lore.kernel.org
 help / color / mirror / Atom feed
From: SJ Park <sj@kernel.org>
Cc: SJ Park <sj@kernel.org>, "Liam R. Howlett" <liam@infradead.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	Brendan Higgins <brendan.higgins@linux.dev>,
	David Gow <davidgow@davidgow.net>,
	David Hildenbrand <david@kernel.org>,
	Jonathan Corbet <corbet@lwn.net>,
	Lorenzo Stoakes <ljs@kernel.org>, Michal Hocko <mhocko@suse.com>,
	Mike Rapoport <rppt@kernel.org>,
	Randy Dunlap <rdunlap@infradead.org>,
	Shuah Khan <skhan@linuxfoundation.org>,
	Suren Baghdasaryan <surenb@google.com>,
	Vlastimil Babka <vbabka@kernel.org>,
	damon@lists.linux.dev, kunit-dev@googlegroups.com,
	linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-kselftest@vger.kernel.org, linux-mm@kvack.org
Subject: [RFC PATCH v4 0/7] snapshot_set_swap_area() unpins the previously selected swap device and
Date: Sun, 27 Sep 2026 05:05:24 -0700	[thread overview]
Message-ID: <20260927120533.50484-1-sj@kernel.org> (raw)

Add repin_hibernation_swap_type(), which looks up the new device, clears
the old SWP_HIBERNATION flag and sets the new one under a single swap_lock
acquisition.  The same-device case is short- circuited so userspace can
re-select the same swap area without tripping WARN_ON_ONCE and -EBUSY. 
Switch snapshot_set_swap_area() to the new helper.

A failed lookup now preserves the previous pin instead of dropping it, so
a bad SNAPSHOT_SET_SWAP_AREA leaves the prior selection intact.  The open
and release paths keep using pin_hibernation_swap_type() and
unpin_hibernation_swap_type().

The race was identified during AI-assisted review of the SWP_HIBERNATION
pinning series.

SJ Park (7):
  mm/damon/core: introduce damos_quota_goal->complement
  mm/damon/core: add complement argument to damos_new_quota_goal()
  mm/damon/sysfs-schemes: support quota goal complement flag
  mm/damon/tests/core-kunit: test quota_goal->complement commit
  Docs/mm/damon/design: document damos quota goal complement flag
  Docs/admin-guide/mm/damon/usage: update for quota goal complement file
  Docs/ABI/damon: update for quota goal metric complement sysfs file

 .../ABI/testing/sysfs-kernel-mm-damon         |  6 ++++
 Documentation/admin-guide/mm/damon/usage.rst  | 15 +++++----
 Documentation/mm/damon/design.rst             | 15 ++++++---
 include/linux/damon.h                         |  4 ++-
 mm/damon/core.c                               | 33 ++++++++++++++++---
 mm/damon/lru_sort.c                           |  5 +--
 mm/damon/reclaim.c                            |  5 +--
 mm/damon/sysfs-schemes.c                      | 30 +++++++++++++++++
 mm/damon/tests/core-kunit.h                   |  3 ++
 samples/damon/mtier.c                         |  2 +-
 10 files changed, 97 insertions(+), 21 deletions(-)


base-commit: 1c2b8d2725f84b43fabe3b3e9628c91db8ca6c65
-- 
2.47.3

             reply	other threads:[~2026-09-27 12:05 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-27 12:05 SJ Park [this message]
2026-09-27 12:05 ` [RFC PATCH v4 1/7] mm/damon/core: introduce damos_quota_goal->complement SJ Park
2026-09-27 12:17   ` sashiko-bot
2026-09-27 12:22     ` SJ Park
2026-09-27 12:05 ` [RFC PATCH v4 2/7] mm/damon/core: add complement argument to damos_new_quota_goal() SJ Park
2026-09-27 12:12   ` sashiko-bot
2026-09-27 12:30     ` SJ Park
2026-09-27 12:05 ` [RFC PATCH v4 3/7] mm/damon/sysfs-schemes: support quota goal complement flag SJ Park
2026-09-27 12:19   ` sashiko-bot
2026-09-27 12:31     ` SJ Park
2026-09-27 12:05 ` [RFC PATCH v4 4/7] mm/damon/tests/core-kunit: test quota_goal->complement commit SJ Park
2026-09-27 12:13   ` sashiko-bot
2026-09-27 12:05 ` [RFC PATCH v4 5/7] Docs/mm/damon/design: document damos quota goal complement flag SJ Park
2026-09-27 12:13   ` sashiko-bot
2026-09-27 12:35     ` SJ Park
2026-09-27 12:05 ` [RFC PATCH v4 6/7] Docs/admin-guide/mm/damon/usage: update for quota goal complement file SJ Park
2026-09-27 12:13   ` sashiko-bot
2026-09-27 12:36     ` SJ Park
2026-09-27 12:05 ` [RFC PATCH v4 7/7] Docs/ABI/damon: update for quota goal metric complement sysfs file SJ Park
2026-09-27 12:14   ` sashiko-bot
2026-09-27 12:37     ` SJ Park
2026-09-27 13:05 ` [RFC PATCH v4 0/7] mm/damon: introduce damos quota goal target metric complement flag (was: "Re: [RFC PATCH v4 0/7] snapshot_set_swap_area() unpins the previously selected swap device and") SJ Park

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=20260927120533.50484-1-sj@kernel.org \
    --to=sj@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=brendan.higgins@linux.dev \
    --cc=corbet@lwn.net \
    --cc=damon@lists.linux.dev \
    --cc=david@kernel.org \
    --cc=davidgow@davidgow.net \
    --cc=kunit-dev@googlegroups.com \
    --cc=liam@infradead.org \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=ljs@kernel.org \
    --cc=mhocko@suse.com \
    --cc=rdunlap@infradead.org \
    --cc=rppt@kernel.org \
    --cc=skhan@linuxfoundation.org \
    --cc=surenb@google.com \
    --cc=vbabka@kernel.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 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.