mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Rik van Riel <riel@redhat.com>
To: Chris Metcalf <cmetcalf@ezchip.com>,
	linux-kernel@vger.kernel.org,
	Frederic Weisbecker <fweisbec@gmail.com>,
	Steven Rostedt <rostedt@goodmis.org>,
	"Paul E. McKenney" <paulmck@linux.vnet.ibm.com>,
	Ingo Molnar <mingo@kernel.org>,
	Thomas Gleixner <tglx@linutronix.de>,
	Peter Zijlstra <peterz@infradead.org>,
	Borislav Petkov <bp@alien8.de>,
	Li Zhong <zhong@linux.vnet.ibm.com>,
	Mike Galbraith <efault@gmx.de>, Kevin Hilman <khilman@linaro.org>
Subject: Re: [PATCH 3/4] nohz: add tick_nohz_full_clear_cpus() API
Date: Mon, 30 Mar 2015 12:41:06 -0400	[thread overview]
Message-ID: <55197CA2.9040706@redhat.com> (raw)
In-Reply-To: <551977C1.4000303@ezchip.com>

On 03/30/2015 12:20 PM, Chris Metcalf wrote:
> I wanted to ping the patch below again, since I haven't heard any
> feedback.
> 
> I note that Rik van Riel's change posted this weekend offers similar
> functionality for userspace.  My change offers a convenient API
> for, e.g., kernel drivers setting up default irq balancing.
> 
> https://lkml.org/lkml/2015/3/28/94

I submitted a patch to irqbalance to exclude nohz_full
cpus from having irqs assigned to them.  I could see
the same thing being useful for in-kernel irq assignment,
especially for multi-queue devices that set up irqs on
multiple CPUs.

> An alternate API would be one that just returned the full no_hz
> cpumask to kernel callers; I'd be happy with that as well, but my
> instinct was to make the API as narrow as possible to start with.
> 
> Comments?

What drivers and subsystems are you targeting?

I am just looking at blk-mq now, and it seems like the
API most appropriate for that would be an inline function
that tests whether or not a CPU is nohz_full.

for_each_possible_cpu(i) {

	...

	if (cpu_nohz_full(i))
		continue;

}

A lot of the other code in drivers and subsystems that
set up per-cpu queues and irqs seem to iterate over all
CPUs at init time, and could benefit from a function
allowing them to skip nohz_full CPUs.

Your tick_nohz_full_clear_cpus() function seems reasonable
too, for code that uses a cpumask to set up per cpu stuff.

> On 03/24/2015 03:21 PM, cmetcalf@ezchip.com wrote:
>> From: Chris Metcalf <cmetcalf@ezchip.com>
>>
>> This is useful, for example, to modify a cpumask to avoid the
>> nohz cores so that interrupts aren't sent to them.
>>
>> Signed-off-by: Chris Metcalf <cmetcalf@ezchip.com>
>> ---
>> Motivated by patch 4/4 in this series.
>>
>>   include/linux/tick.h | 7 +++++++
>>   1 file changed, 7 insertions(+)
>>
>> diff --git a/include/linux/tick.h b/include/linux/tick.h
>> index 9c085dc12ae9..d53ad4892a39 100644
>> --- a/include/linux/tick.h
>> +++ b/include/linux/tick.h
>> @@ -186,6 +186,12 @@ static inline bool tick_nohz_full_cpu(int cpu)
>>       return cpumask_test_cpu(cpu, tick_nohz_full_mask);
>>   }
>>   +static inline void tick_nohz_full_clear_cpus(struct cpumask *mask)
>> +{
>> +    if (tick_nohz_full_enabled())
>> +        cpumask_andnot(mask, mask, tick_nohz_full_mask);
>> +}
>> +
>>   extern void __tick_nohz_full_check(void);
>>   extern void tick_nohz_full_kick(void);
>>   extern void tick_nohz_full_kick_cpu(int cpu);
>> @@ -194,6 +200,7 @@ extern void __tick_nohz_task_switch(struct
>> task_struct *tsk);
>>   #else
>>   static inline bool tick_nohz_full_enabled(void) { return false; }
>>   static inline bool tick_nohz_full_cpu(int cpu) { return false; }
>> +static inline void tick_nohz_full_clear_cpus(struct cpumask *mask) { }
>>   static inline void __tick_nohz_full_check(void) { }
>>   static inline void tick_nohz_full_kick_cpu(int cpu) { }
>>   static inline void tick_nohz_full_kick(void) { }
> 


-- 
All rights reversed

  reply	other threads:[~2015-03-30 16:42 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-24 19:21 [PATCH 0/4] initial NOHZ_FULL support for tile cmetcalf
2015-03-24 19:21 ` [PATCH 1/4] tile: support arch_irq_work_raise cmetcalf
2015-03-24 21:00   ` Frederic Weisbecker
2015-03-24 21:14   ` Peter Zijlstra
2015-03-24 22:06     ` Chris Metcalf
2015-03-25  8:03       ` Peter Zijlstra
2015-03-24 19:21 ` [PATCH 2/4] tile: support CONTEXT_TRACKING and thus NOHZ_FULL cmetcalf
2015-03-24 21:15   ` Frederic Weisbecker
2015-03-24 21:49     ` Chris Metcalf
2015-03-24 19:21 ` [PATCH 3/4] nohz: add tick_nohz_full_clear_cpus() API cmetcalf
2015-03-30 16:20   ` Chris Metcalf
2015-03-30 16:41     ` Rik van Riel [this message]
2015-03-30 16:45       ` Chris Metcalf
2015-03-24 19:21 ` [PATCH 4/4] net: tile: don't send interrupts to nohz cores by default cmetcalf

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=55197CA2.9040706@redhat.com \
    --to=riel@redhat.com \
    --cc=bp@alien8.de \
    --cc=cmetcalf@ezchip.com \
    --cc=efault@gmx.de \
    --cc=fweisbec@gmail.com \
    --cc=khilman@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=paulmck@linux.vnet.ibm.com \
    --cc=peterz@infradead.org \
    --cc=rostedt@goodmis.org \
    --cc=tglx@linutronix.de \
    --cc=zhong@linux.vnet.ibm.com \
    /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

Powered by JetHome