From: Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
To: Christoph Lameter <cl@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>,
akpm@linux-foundation.org, linux-kernel@vger.kernel.org,
Pekka Enberg <penberg@cs.helsinki.fi>, Tejun Heo <tj@kernel.org>,
Mel Gorman <mel@csn.ul.ie>,
mingo@elte.hu
Subject: Re: [this_cpu_xx V5 19/19] SLUB: Experimental new fastpath w/o interrupt disable
Date: Wed, 7 Oct 2009 13:12:41 -0400 [thread overview]
Message-ID: <20091007171241.GA21313@Krystal> (raw)
In-Reply-To: <alpine.DEB.1.10.0910071237430.3467@gentwo.org>
* Christoph Lameter (cl@linux-foundation.org) wrote:
> On Wed, 7 Oct 2009, Mathieu Desnoyers wrote:
>
> > preempt_check_resched is basically:
> >
> > a test TIF_NEED_RESCHED
> > if true, call to preempt_schedule
>
> You did not mention the effect of incrementing the preempt counter and
> the barrier(). Adds an additional cacheline to a very hot OS path.
> Possibly register effects.
>
What you say applies to preempt_enable(). I was describing
preempt_check_resched above, which involves no compiler barrier nor
increment whatsoever.
By the way, the barrier() you are talking about is in
preempt_enable_no_resched(), the very primitive you are considering
using to save these precious cycles.
> > I really don't see what's bothering you here. Testing a thread flag is
> > incredibly cheap. That's what is typically added to your fast path.
>
> I am trying to get rid off all unnecessary overhead. These "incredible
> cheap" tricks en masse have caused lots of regressions. And the allocator
> hotpaths are overloaded with these "incredibly cheap" checks alreayd.
>
> > So, correct behavior would be:
> >
> > preempt disable()
> > fast path attempt
> > if (fast path already taken) {
> > local_irq_save();
> > slow path.
> > local_irq_restore();
> > }
> > preempt_enable()
>
> Ok. If you have to use preempt then you have to suffer I guess..
>
Yes. A user enabling full preemption should be aware that it has a
performance footprint.
By the way, from what I remember of the slub allocator, you might find
the following more suited for your needs. I remember that the slow path
sometimes need to reenable interrupts, so:
preempt disable()
fast path attempt
if (fast path already taken) {
local_irq_save();
preempt_enable_no_resched();
slow path {
if (!flags & GFP_ATOMIC) {
local_irq_enable();
preempt_check_resched();
...
local_irq_disable();
}
}
local_irq_restore();
preempt_check_resched();
return;
}
preempt_enable()
This should work, be efficient and manage to ensure scheduler RT
correctness.
Mathieu
--
Mathieu Desnoyers
OpenPGP key fingerprint: 8CD5 52C3 8E3C 4140 715F BA06 3F25 A8FE 3BAE 9A68
next prev parent reply other threads:[~2009-10-07 17:13 UTC|newest]
Thread overview: 57+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-10-06 23:36 [this_cpu_xx V5 00/19] Introduce per cpu atomic operations and avoid per cpu address arithmetic cl
2009-10-06 23:36 ` [this_cpu_xx V5 01/19] Introduce this_cpu_ptr() and generic this_cpu_* operations cl
2009-10-06 23:52 ` Tejun Heo
2009-10-07 14:23 ` Christoph Lameter
2009-10-07 15:29 ` Tejun Heo
2009-10-06 23:36 ` [this_cpu_xx V5 02/19] this_cpu: X86 optimized this_cpu operations cl
2009-10-06 23:36 ` [this_cpu_xx V5 03/19] Use this_cpu operations for SNMP statistics cl
2009-10-06 23:36 ` [this_cpu_xx V5 04/19] Use this_cpu operations for NFS statistics cl
2009-10-06 23:36 ` [this_cpu_xx V5 05/19] use this_cpu ops for network statistics cl
2009-10-06 23:37 ` [this_cpu_xx V5 06/19] this_cpu_ptr: Straight transformations cl
2009-10-06 23:37 ` [this_cpu_xx V5 07/19] this_cpu_ptr: Eliminate get/put_cpu cl
2009-10-06 23:37 ` [this_cpu_xx V5 09/19] Use this_cpu_ptr in crypto subsystem cl
2009-10-06 23:37 ` [this_cpu_xx V5 10/19] Use this_cpu ops for VM statistics cl
2009-10-06 23:37 ` [this_cpu_xx V5 11/19] RCU: Use this_cpu operations cl
2009-10-06 23:37 ` [this_cpu_xx V5 12/19] this_cpu_ops: page allocator conversion cl
2009-10-06 23:37 ` [this_cpu_xx V5 13/19] this_cpu ops: Remove pageset_notifier cl
2009-10-06 23:37 ` [this_cpu_xx V5 14/19] Use this_cpu operations in slub cl
2009-10-06 23:37 ` [this_cpu_xx V5 15/19] SLUB: Get rid of dynamic DMA kmalloc cache allocation cl
2009-10-06 23:37 ` [this_cpu_xx V5 16/19] this_cpu: Remove slub kmem_cache fields cl
2009-10-06 23:37 ` [this_cpu_xx V5 17/19] Make slub statistics use this_cpu_inc cl
2009-10-06 23:37 ` [this_cpu_xx V5 18/19] this_cpu: slub aggressive use of this_cpu operations in the hotpaths cl
2009-10-06 23:37 ` [this_cpu_xx V5 19/19] SLUB: Experimental new fastpath w/o interrupt disable cl
2009-10-07 2:54 ` Mathieu Desnoyers
2009-10-07 9:11 ` Peter Zijlstra
2009-10-07 12:46 ` Mathieu Desnoyers
2009-10-07 13:01 ` Peter Zijlstra
2009-10-07 13:31 ` Mathieu Desnoyers
2009-10-07 14:37 ` Peter Zijlstra
2009-10-07 14:21 ` Christoph Lameter
2009-10-07 14:42 ` Christoph Lameter
2009-10-07 15:02 ` Mathieu Desnoyers
2009-10-07 15:05 ` Christoph Lameter
2009-10-07 15:19 ` Mathieu Desnoyers
2009-10-07 15:21 ` Christoph Lameter
2009-10-07 15:41 ` Mathieu Desnoyers
2009-10-07 16:42 ` Christoph Lameter
2009-10-07 17:12 ` Mathieu Desnoyers [this message]
2009-10-08 7:52 ` Peter Zijlstra
2009-10-08 12:44 ` Mathieu Desnoyers
2009-10-08 12:53 ` Peter Zijlstra
2009-10-08 16:17 ` Christoph Lameter
2009-10-08 17:22 ` Mathieu Desnoyers
2009-10-08 16:11 ` Christoph Lameter
2009-10-08 17:17 ` Mathieu Desnoyers
2009-10-08 17:44 ` Christoph Lameter
2009-10-08 19:17 ` Mathieu Desnoyers
2009-10-08 19:21 ` Christoph Lameter
2009-10-08 20:37 ` Mathieu Desnoyers
2009-10-08 21:08 ` Christoph Lameter
2009-10-12 13:56 ` Mathieu Desnoyers
2009-10-12 14:52 ` Christoph Lameter
2009-10-12 15:26 ` Mathieu Desnoyers
2009-10-12 15:23 ` Christoph Lameter
2009-10-12 15:38 ` Mathieu Desnoyers
2009-10-12 15:38 ` Christoph Lameter
2009-10-12 16:05 ` Mathieu Desnoyers
2009-10-07 15:25 ` Christoph Lameter
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=20091007171241.GA21313@Krystal \
--to=mathieu.desnoyers@polymtl.ca \
--cc=akpm@linux-foundation.org \
--cc=cl@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mel@csn.ul.ie \
--cc=mingo@elte.hu \
--cc=penberg@cs.helsinki.fi \
--cc=peterz@infradead.org \
--cc=tj@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