From: Jay Penny <hills.a.joel@gmail.com>
To: rafael@kernel.org
Cc: linux-kernel@vger.kernel.org
Subject: [PATCH] power: Changed CMP_THREADS from hardwired value to configurable value
Date: Fri, 14 Feb 2025 22:57:54 +1100 [thread overview]
Message-ID: <3785d2b4e561eef5b3b0e6dc0ef07ebf349eaadd.camel@gmail.com> (raw)
From a873292405b37921d6a7428a7e9263f662e957cf Mon Sep 17 00:00:00 2001
From: Jay Penny <hills.a.joel@gmail.com>
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.
Signed-off-by: Jay Penny <hills.a.joel@gmail.com>
---
kernel/power/Kconfig | 13 +++++++++++++
kernel/power/swap.c | 2 +-
2 files changed, 14 insertions(+), 1 deletion(-)
diff --git a/kernel/power/Kconfig b/kernel/power/Kconfig
index ca947ed32e3d..432e75c76c49 100644
--- a/kernel/power/Kconfig
+++ b/kernel/power/Kconfig
@@ -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
diff --git a/kernel/power/swap.c b/kernel/power/swap.c
index 82b884b67152..6ac787f8421a 100644
--- a/kernel/power/swap.c
+++ b/kernel/power/swap.c
@@ -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
--
2.48.1
reply other threads:[~2025-02-14 11:57 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=3785d2b4e561eef5b3b0e6dc0ef07ebf349eaadd.camel@gmail.com \
--to=hills.a.joel@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=rafael@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox