summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Hildenbrand (Red Hat) <david@kernel.org>2026-01-20 02:01:24 +0300
committerAndrew Morton <akpm@linux-foundation.org>2026-02-01 01:22:34 +0300
commit631eb2282630dc0cccd8284c4ea37e29d17d1f48 (patch)
treec63e418314c67236641427db6a032ec54ef0b266
parent03d6a2f68419b808d51ba39c84aedd6e9a6a92d8 (diff)
downloadlinux-631eb2282630dc0cccd8284c4ea37e29d17d1f48.tar.xz
mm/balloon_compaction: assert that the balloon_pages_lock is held
Let's add some sanity checks for holding the balloon_pages_lock when we're effectively inflating/deflating a page. Link: https://lkml.kernel.org/r/20260119230133.3551867-17-david@kernel.org Signed-off-by: David Hildenbrand (Red Hat) <david@kernel.org> Reviewed-by: Lorenzo Stoakes <lorenzo.stoakes@oracle.com> Acked-by: Michael S. Tsirkin <mst@redhat.com> Cc: Arnd Bergmann <arnd@arndb.de> Cc: Christophe Leroy <christophe.leroy@csgroup.eu> Cc: Eugenio Pérez <eperezma@redhat.com> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Cc: Jason Wang <jasowang@redhat.com> Cc: Jerrin Shaji George <jerrin.shaji-george@broadcom.com> Cc: Jonathan Corbet <corbet@lwn.net> Cc: Liam Howlett <liam.howlett@oracle.com> Cc: Madhavan Srinivasan <maddy@linux.ibm.com> Cc: Michael Ellerman <mpe@ellerman.id.au> Cc: Michal Hocko <mhocko@suse.com> Cc: Mike Rapoport <rppt@kernel.org> Cc: Nicholas Piggin <npiggin@gmail.com> Cc: Oscar Salvador <osalvador@suse.de> Cc: SeongJae Park <sj@kernel.org> Cc: Suren Baghdasaryan <surenb@google.com> Cc: Vlastimil Babka <vbabka@suse.cz> Cc: Xuan Zhuo <xuanzhuo@linux.alibaba.com> Cc: Zi Yan <ziy@nvidia.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
-rw-r--r--mm/balloon_compaction.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/mm/balloon_compaction.c b/mm/balloon_compaction.c
index 30fa7ee8e1f3..f77b305b0459 100644
--- a/mm/balloon_compaction.c
+++ b/mm/balloon_compaction.c
@@ -28,6 +28,7 @@ static DEFINE_SPINLOCK(balloon_pages_lock);
static void balloon_page_insert(struct balloon_dev_info *balloon,
struct page *page)
{
+ lockdep_assert_held(&balloon_pages_lock);
__SetPageOffline(page);
if (IS_ENABLED(CONFIG_BALLOON_COMPACTION)) {
SetPageMovableOps(page);
@@ -45,6 +46,7 @@ static void balloon_page_insert(struct balloon_dev_info *balloon,
*/
static void balloon_page_finalize(struct page *page)
{
+ lockdep_assert_held(&balloon_pages_lock);
if (IS_ENABLED(CONFIG_BALLOON_COMPACTION))
set_page_private(page, 0);
/* PageOffline is sticky until the page is freed to the buddy. */