* [to-be-updated] mm-khugepaged-replace-mutex_lock-mutex_unlock-usage-with-guard-macro.patch removed from -mm tree
@ 2026-07-30 22:42 Andrew Morton
0 siblings, 0 replies; only message in thread
From: Andrew Morton @ 2026-07-30 22:42 UTC (permalink / raw)
To: mm-commits, ziy, ryan.roberts, npache, ljs, liam, lance.yang,
dev.jain, david, baolin.wang, baohua, akpm, jakovnovak30, akpm
The quilt patch titled
Subject: mm/khugepaged: replace mutex_lock/mutex_unlock usage with guard macro
has been removed from the -mm tree. Its filename was
mm-khugepaged-replace-mutex_lock-mutex_unlock-usage-with-guard-macro.patch
This patch was dropped because an updated version will be issued
------------------------------------------------------
From: Jakov Novak <jakovnovak30@gmail.com>
Subject: mm/khugepaged: replace mutex_lock/mutex_unlock usage with guard macro
Date: Tue, 28 Jul 2026 22:46:37 +0200
Currently, khugepaged locks the khugepaged_mutex in two functions:
start_stop_khugepaged and khugepaged_min_free_kbytes_update. Remove
mutex_lock/mutex_unlock usage in these functions and replace it with the
guard macro. This makes the code more readable (removing a goto
statement) and makes it harder to introduce bugs in the future. No
functional changes introduced.
Link: https://lore.kernel.org/20260728204636.20998-2-jakovnovak30@gmail.com
Signed-off-by: Jakov Novak <jakovnovak30@gmail.com>
Reviewed-by: Dev Jain <dev.jain@arm.com>
Reviewed-by: Lorenzo Stoakes (ARM) <ljs@kernel.org>
Reviewed-by: Andrew Morton <akpm@linux-foundation.org>
Reviewed-by: Zi Yan <ziy@nvidia.com>
Cc: Baolin Wang <baolin.wang@linux.alibaba.com>
Cc: Barry Song <baohua@kernel.org>
Cc: David Hildenbrand <david@kernel.org>
Cc: Lance Yang <lance.yang@linux.dev>
Cc: Liam R. Howlett <liam@infradead.org>
Cc: Nico Pache <npache@redhat.com>
Cc: Ryan Roberts <ryan.roberts@arm.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---
mm/khugepaged.c | 15 ++++++---------
1 file changed, 6 insertions(+), 9 deletions(-)
--- a/mm/khugepaged.c~mm-khugepaged-replace-mutex_lock-mutex_unlock-usage-with-guard-macro
+++ a/mm/khugepaged.c
@@ -23,6 +23,7 @@
#include <linux/ksm.h>
#include <linux/pgalloc.h>
#include <linux/backing-dev.h>
+#include <linux/cleanup.h>
#include <asm/tlb.h>
#include "internal.h"
@@ -3115,18 +3116,17 @@ update_wmarks:
int start_stop_khugepaged(void)
{
- int err = 0;
-
- mutex_lock(&khugepaged_mutex);
+ guard(mutex)(&khugepaged_mutex);
if (hugepage_enabled()) {
if (!khugepaged_thread)
khugepaged_thread = kthread_run(khugepaged, NULL,
"khugepaged");
if (IS_ERR(khugepaged_thread)) {
+ int err;
pr_err("khugepaged: kthread_run(khugepaged) failed\n");
err = PTR_ERR(khugepaged_thread);
khugepaged_thread = NULL;
- goto fail;
+ return err;
}
if (!list_empty(&khugepaged_scan.mm_head))
@@ -3136,17 +3136,14 @@ int start_stop_khugepaged(void)
khugepaged_thread = NULL;
}
set_recommended_min_free_kbytes();
-fail:
- mutex_unlock(&khugepaged_mutex);
- return err;
+ return 0;
}
void khugepaged_min_free_kbytes_update(void)
{
- mutex_lock(&khugepaged_mutex);
+ guard(mutex)(&khugepaged_mutex);
if (hugepage_enabled() && khugepaged_thread)
set_recommended_min_free_kbytes();
- mutex_unlock(&khugepaged_mutex);
}
bool current_is_khugepaged(void)
_
Patches currently in -mm which might be from jakovnovak30@gmail.com are
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2026-07-30 22:42 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-30 22:42 [to-be-updated] mm-khugepaged-replace-mutex_lock-mutex_unlock-usage-with-guard-macro.patch removed from -mm tree Andrew Morton
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.