linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Paul Gortmaker <paul.gortmaker@windriver.com>
To: linux-kernel@vger.kernel.org
Cc: cgroups@vger.kernel.org, rdunlap@infradead.org,
	colin.king@canonical.com,
	Paul Gortmaker <paul.gortmaker@windriver.com>
Subject: [PATCH 3/4] cpumask: add a "none" alias to complement "all"
Date: Mon,  9 Nov 2020 23:07:24 -0500	[thread overview]
Message-ID: <20201110040725.1478297-4-paul.gortmaker@windriver.com> (raw)
In-Reply-To: <20201110040725.1478297-1-paul.gortmaker@windriver.com>

With global support for a CPU list alias of "all", it seems to just make
sense to also trivially extend support for an opposite "none" specifier.

Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
---
 Documentation/admin-guide/kernel-parameters.rst | 6 ++++++
 lib/cpumask.c                                   | 5 +++++
 2 files changed, 11 insertions(+)

diff --git a/Documentation/admin-guide/kernel-parameters.rst b/Documentation/admin-guide/kernel-parameters.rst
index ef98ca700946..9e1c4522e1f0 100644
--- a/Documentation/admin-guide/kernel-parameters.rst
+++ b/Documentation/admin-guide/kernel-parameters.rst
@@ -76,6 +76,12 @@ is equivalent to "foo_cpus=0-N" -- where "N" is the numerically last CPU on
 the system, thus avoiding looking up the value in "/sys/devices/system/cpu"
 in advance on each deployed system.
 
+        foo_cpus=none
+
+will provide an empty/cleared cpu mask for the associated boot argument.
+
+Note that "all" and "none" are not necessarily valid/sensible input values
+for each available parameter expecting a CPU list.
 
 This document may not be entirely up to date and comprehensive. The command
 "modinfo -p ${modulename}" shows a current list of all parameters of a loadable
diff --git a/lib/cpumask.c b/lib/cpumask.c
index 15599cdf5db6..eb8b1c92501e 100644
--- a/lib/cpumask.c
+++ b/lib/cpumask.c
@@ -110,6 +110,11 @@ int cpulist_parse(const char *buf, struct cpumask *dstp)
 		return 0;
 	}
 
+	if (!strcmp(buf, "none")) {
+		cpumask_clear(dstp);
+		return 0;
+	}
+
 	return bitmap_parselist(buf, cpumask_bits(dstp), nr_cpumask_bits);
 }
 EXPORT_SYMBOL(cpulist_parse);
-- 
2.25.1


  parent reply	other threads:[~2020-11-10  4:08 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-10  4:07 [PATCH v2 0/4] support for global CPU list abbreviations Paul Gortmaker
2020-11-10  4:07 ` [PATCH 1/4] cpumask: un-inline cpulist_parse for SMP; prepare for ascii helpers Paul Gortmaker
2020-11-10  4:07 ` [PATCH 2/4] cpumask: make "all" alias global and not just RCU Paul Gortmaker
2020-11-10  4:07 ` Paul Gortmaker [this message]
2020-11-10  4:07 ` [PATCH 4/4] cpumask: add "last" alias for cpu list specifications Paul Gortmaker
2020-11-10 15:32 ` [PATCH v2 0/4] support for global CPU list abbreviations Paul E. McKenney
2020-11-10 16:09   ` Colin Ian King
  -- strict thread matches above, loose matches on Subject: below --
2020-11-08 16:08 [PATCH 0/4] RFC: " Paul Gortmaker
2020-11-08 16:08 ` [PATCH 3/4] cpumask: add a "none" alias to complement "all" Paul Gortmaker

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=20201110040725.1478297-4-paul.gortmaker@windriver.com \
    --to=paul.gortmaker@windriver.com \
    --cc=cgroups@vger.kernel.org \
    --cc=colin.king@canonical.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rdunlap@infradead.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;
as well as URLs for NNTP newsgroup(s).