mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Colin Ian King <colin.king@canonical.com>
To: paulmck@kernel.org, Paul Gortmaker <paul.gortmaker@windriver.com>
Cc: linux-kernel@vger.kernel.org, cgroups@vger.kernel.org,
	rdunlap@infradead.org, Frederic Weisbecker <fweisbec@gmail.com>,
	Josh Triplett <josh@joshtriplett.org>,
	Thomas Gleixner <tglx@linutronix.de>,
	Ingo Molnar <mingo@kernel.org>, Li Zefan <lizefan@huawei.com>
Subject: Re: [PATCH v2 0/4] support for global CPU list abbreviations
Date: Tue, 10 Nov 2020 16:09:55 +0000	[thread overview]
Message-ID: <6d3f4fbf-3d40-20a4-5c14-145906bf6c0f@canonical.com> (raw)
In-Reply-To: <20201110153211.GU3249@paulmck-ThinkPad-P72>

On 10/11/2020 15:32, Paul E. McKenney wrote:
> On Mon, Nov 09, 2020 at 11:07:21PM -0500, Paul Gortmaker wrote:
>> RFC/v1 ---> v2:
>>
>> commit #1:
>>    leave one line stub behind for !SMP solving build failures.
>>    Reported by Randy Dunlap and various build bots.
>>
>> commit #4
>>    manage to remember '\0' char in strlen from one line to the next.
>>    Reported by Colin King.

shouldn't that be "Reported and fixed by Colin King"? ;-)

>>
>> Original description from v1/RFC below remains unchanged...
> 
> Queued and this time kicking off testing that actually includes your
> patches!  ;-)
> 
> 							Thanx, Paul
> 
>>  ---
>>
>> The basic objective here was to add support for "nohz_full=8-last" and/or
>> "rcu_nocbs="4-last" -- essentially introduce "last" as a portable
>> reference evaluated at boot/runtime for anything using a CPU list.
>>
>> The thinking behind this, is that people carve off a few early CPUs to
>> support housekeeping tasks, and perhaps dedicate one to a busy I/O
>> peripheral, and then the remaining pool of CPUs out to the end are a
>> part of a commonly configured pool used for the real work the user
>> cares about.
>>
>> Extend that logic out to a fleet of machines - some new, and some
>> nearing EOL, and you've probably got a wide range of core counts to
>> contend with - even though the early number of cores dedicated to the
>> system overhead probably doesn't vary.
>>
>> This change would enable sysadmins to have a common bootarg across all
>> such systems, and would also avoid any off-by-one fencepost errors that
>> happen for users who might briefly forget that core counts start at
>> zero.
>>
>> Looking around before starting, I noticed RCU already had a short-form
>> abbreviation "all" -- but if we want to treat CPU lists in a uniform
>> matter, then tokens shouldn't be implemented at a subsystem level and
>> hence be subsystem specific; each with their own variations.
>>
>> So I moved "all" to global use - for boot args, and for cgroups.  Then
>> I added the inverse "none" and finally, the one I wanted -- "last".
>>
>> The use of "last" isn't a standalone word like "all" or "none".  It will
>> be a part of a complete range specification, possibly with CSV separate
>> ranges, and possibly specified multiple times.  So I had to be a bit
>> more careful with string matching - and hence un-inlined the parse
>> function as commit #1 in this series.
>>
>> But it really is a generic support for "replace token ABC with known at
>> boot value XYZ" - for example, it would be trivial to extend support to
>> add "half" as a dynamic token to be replaced with 1/2 the core count,
>> even though I wouldn't suggest that has a use case like "last" does.
>>
>> I tested the string matching with a bunch of intentionally badly crafted
>> strings in a user-space harness, and tested bootarg use with nohz_full
>> and rcu_nocbs, and also the post-boot cgroup use case as per below:
>>
>>    root@hackbox:/sys/fs/cgroup/cpuset# mkdir foo
>>    root@hackbox:/sys/fs/cgroup/cpuset# cd foo
>>    root@hackbox:/sys/fs/cgroup/cpuset/foo# cat cpuset.cpus
>>    
>>    root@hackbox:/sys/fs/cgroup/cpuset/foo# /bin/echo 10-last > cpuset.cpus
>>    root@hackbox:/sys/fs/cgroup/cpuset/foo# cat cpuset.cpus
>>    10-15
>>    root@hackbox:/sys/fs/cgroup/cpuset/foo# /bin/echo all > cpuset.cpus
>>    root@hackbox:/sys/fs/cgroup/cpuset/foo# cat cpuset.cpus
>>    0-15
>>    root@hackbox:/sys/fs/cgroup/cpuset/foo# /bin/echo none > cpuset.cpus
>>    root@hackbox:/sys/fs/cgroup/cpuset/foo# cat cpuset.cpus
>>    
>>    root@hackbox:/sys/fs/cgroup/cpuset/foo#
>>
>> This was on a 16 core machine with CONFIG_NR_CPUS=16 in .config file.
>>
>> Note that the two use cases (boot and runtime) are why you see "early"
>> parameter in the code - I entertained just sticking the string copy on
>> the stack vs. the early alloc dance, but this felt more correct/robust.
>> The cgroup and modular code using cpulist_parse() are runtime cases.
>>
>> ---
>>
>> Cc: Frederic Weisbecker <fweisbec@gmail.com>
>> Cc: "Paul E. McKenney" <paulmck@kernel.org>
>> Cc: Josh Triplett <josh@joshtriplett.org>
>> Cc: Thomas Gleixner <tglx@linutronix.de>
>> Cc: Ingo Molnar <mingo@kernel.org>
>> Cc: Li Zefan <lizefan@huawei.com>
>>
>> Paul Gortmaker (4):
>>   cpumask: un-inline cpulist_parse for SMP; prepare for ascii helpers
>>   cpumask: make "all" alias global and not just RCU
>>   cpumask: add a "none" alias to complement "all"
>>   cpumask: add "last" alias for cpu list specifications
>>
>>  .../admin-guide/kernel-parameters.rst         |  20 +++
>>  .../admin-guide/kernel-parameters.txt         |   4 +-
>>  include/linux/cpumask.h                       |   8 ++
>>  kernel/rcu/tree_plugin.h                      |  13 +-
>>  lib/cpumask.c                                 | 132 ++++++++++++++++++
>>  5 files changed, 165 insertions(+), 12 deletions(-)
>>
>> -- 
>> 2.25.1
>>


      reply	other threads:[~2020-11-10 16:10 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-10  4:07 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 ` [PATCH 3/4] cpumask: add a "none" alias to complement "all" Paul Gortmaker
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 [this message]

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=6d3f4fbf-3d40-20a4-5c14-145906bf6c0f@canonical.com \
    --to=colin.king@canonical.com \
    --cc=cgroups@vger.kernel.org \
    --cc=fweisbec@gmail.com \
    --cc=josh@joshtriplett.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lizefan@huawei.com \
    --cc=mingo@kernel.org \
    --cc=paul.gortmaker@windriver.com \
    --cc=paulmck@kernel.org \
    --cc=rdunlap@infradead.org \
    --cc=tglx@linutronix.de \
    /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

all inboxes | Powered by JetHome®