Re: [patch 00/41] cpu alloc / cpu ops v3: Optimize per cpu access

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, 2008-05-30 at 11:26 -0700, Christoph Lameter wrote:
> On Fri, 30 May 2008, Peter Zijlstra wrote:
> 
> > Please consider adding this get/put interface.
> 
> If you could explain why? So far this seems to be based on a 
> misunderstanding.

Take for instance kmem_cache_cpu, you currently serialize that by strict
per-cpu-ness and disabling preemption.

The problem is that the preempt-off sections are rather long - so what
we do is add a lock (mutex) and serialize that way - ignoring the cpu
affinity.


so currently:

  preempt_disable();
  c = get_cpu_slab();

  do load of stuff on c;
  preempt_enable();


where the preempt-off section is rather long, we'd like to change that
to:


  c = get_cpu_slab();

  do stuff to c;

  put_cpu_slab(c);


so that we can pick between:


!rt

get_cpu_slab(s)
{
	preempt_disable();
	return THIS_CPU(s->cpu_slab);
}

put_cpu_slab(c)
{
	preempt_enable();
}


-rt:

get_cpu_slab(s)
{
	c = THIS_CPU(s->cpu_slab);
	spin_lock(&c->lock); // <-- really a PI-mutex
}

put_cpu_slab(c)
{
	spin_unlock(&c->lock);
}


Also, it explicitly ties the preempt-off section to the data used in
case of !rt, which in turn allows for the direct conversion to the
locked version.



--
To unsubscribe from this list: send the line "unsubscribe linux-arch" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel]     [Kernel Newbies]     [x86 Platform Driver]     [Netdev]     [Linux Wireless]     [Netfilter]     [Bugtraq]     [Linux Filesystems]     [Yosemite Discussion]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Device Mapper]

  Powered by Linux