power: Changed CMP_THREADS from hardwired value to configurable value
Subsystems (2)
PATCH 1/1 power: Changed CMP_THREADS from hardwired value to configurable value
From a873292405b37921d6a7428a7e9263f662e957cf Mon Sep 17 00:00:00 2001
From: Jay Penny <[email protected]>
Date: Fri, 14 Feb 2025 22:27:39 +1100
Subject: [PATCH] power: Changed CMP_THREADS from hardwired value to
configurable value
I don't know what the rules are (unspoken or otherwise) for stating that this is your patch - The CoC doesn't say anything regarding it, so I'm just going to mention it here. This is my first kernel patch, so if I mess something up, it's due to a lack of experience on my part.
Changed CMP_THREADS in kernel/power/swap.c from a hardwired 3 threads, to a configurable one, and created a corresponding config option in kernel/power/Kconfig.
The fact that this is such a simple change that hasn't been made yet probably means that it shouldn't be made. That, or I'm just being pessimistic.
--- kernel/power/Kconfig | 13 +++++++++++++ kernel/power/swap.c | 2 +- 2 files changed, 14 insertions(+), 1 deletion(-)
kernel/power/Kconfig +0 -0
@@ -80,6 +80,19 @@ config HIBERNATION For more information take a look at
<file:Documentation/power/swsusp.rst>.
+config HIBERNATION_THREADS
+ int "Hibernation threads"
+ depends on HIBERNATION
+ range 1 65535
+ default 3
+ help
+ The maximum number of threads that should be used when + compressing/decompressing a hibernation image. The number + of threads used is calculated as: + clamp(num_online_cpus() - 1, 1, HIBERNATION_THREADS).
+
+ If in doubt, leave at the default of 3
+
config HIBERNATION_SNAPSHOT_DEV
bool "Userspace snapshot device"
depends on HIBERNATION
kernel/power/swap.c +0 -0
@@ -534,7 +534,7 @@ static int swap_writer_finish(struct
swap_map_handle *handle,
#define CMP_SIZE (CMP_PAGES * PAGE_SIZE)
/* Maximum number of threads for compression/decompression. */
-#define CMP_THREADS 3
+#define CMP_THREADS CONFIG_HIBERNATION_THREADS
/* Minimum/maximum number of pages for read buffering. */
#define CMP_MIN_RD_PAGES 1024
Signature · 1 line
2.48.1