Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1574750
| From | Peter Zijlstra <peterz@infradead.org> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH] cpumask: add cpumask_any_and_but() |
| Date | 2017-02-06 14:50 +0100 |
| Message-ID | <t7RQ7-5AW-61@gated-at.bofh.it> (permalink) |
| References | <t7PXX-4pP-3@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On Mon, Feb 06, 2017 at 11:38:52AM +0000, Mark Rutland wrote: > In some cases, it's useful to be able to select a random cpu from the > intersection of two masks, excluding a particular CPU. > > For example, in some systems an uncore PMU is shared by a subset of > CPUs, and management of this PMU is assigned to some arbitrary CPU in > this set. Whenever the management CPU is hotplugged out, we wish to > migrate responsibility to another arbitrary CPU which is both in this > set and online. > > Today we can use cpumask_any_and() to select an arbitrary CPU in the > intersection of two masks. We can also use cpumask_any_but() to select > any arbitrary cpu in a mask excluding, a particular CPU. > > To do both, we either need to use a temporary cpumask, which is > wasteful, or use some lower-level cpumask helpers, which can be unclear. > > This patch adds a new cpumask_any_and_but() to cater for these cases. > > Signed-off-by: Mark Rutland <mark.rutland@arm.com> > Cc: Thomas Gleixner <tglx@linutronix.de> > Cc: Andrew Morton <akpm@linux-foundation.org> > Cc: Peter Zijlstra <peterz@infradead.org> > Cc: Rusty Russell <rusty@rustcorp.com.au> > Cc: linux-kernel@vger.kernel.org > --- > include/linux/cpumask.h | 3 +++ > lib/cpumask.c | 23 +++++++++++++++++++++++ > 2 files changed, 26 insertions(+) > > This patch would help in cases like the Qualcomm L2 cache PMU driver [1]. If > people are happy with this patch, I'd like to take it along with that patch > (modified to use the new helper). I'm also happy to leave this as a subsequent > cleanup. Have at; looks ok I suppose.
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH] cpumask: add cpumask_any_and_but() Mark Rutland <mark.rutland@arm.com> - 2017-02-06 12:50 +0100 Re: [PATCH] cpumask: add cpumask_any_and_but() Peter Zijlstra <peterz@infradead.org> - 2017-02-06 14:50 +0100 Re: [PATCH] cpumask: add cpumask_any_and_but() Rusty Russell <rusty@rustcorp.com.au> - 2017-02-08 02:10 +0100
csiph-web