Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1522641

Re: [GIT PULL v2 1/5] processor.h: introduce cpu_relax_yield

From Russell King - ARM Linux <linux@armlinux.org.uk>
Newsgroups linux.kernel
Subject Re: [GIT PULL v2 1/5] processor.h: introduce cpu_relax_yield
Date 2016-11-15 13:40 +0100
Message-ID <sDLbQ-4VX-19@gated-at.bofh.it> (permalink)
References <sw5U5-3BL-5@gated-at.bofh.it> <sw5U6-3BL-15@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Tue, Oct 25, 2016 at 11:03:11AM +0200, Christian Borntraeger wrote:
> For spinning loops people do often use barrier() or cpu_relax().
> For most architectures cpu_relax and barrier are the same, but on
> some architectures cpu_relax can add some latency.
> For example on power,sparc64 and arc, cpu_relax can shift the CPU
> towards other hardware threads in an SMT environment.
> On s390 cpu_relax does even more, it uses an hypercall to the
> hypervisor to give up the timeslice.
> In contrast to the SMT yielding this can result in larger latencies.
> In some places this latency is unwanted, so another variant
> "cpu_relax_lowlatency" was introduced. Before this is used in more
> and more places, lets revert the logic and provide a cpu_relax_yield
> that can be called in places where yielding is more important than
> latency. By default this is the same as cpu_relax on all architectures.

Rather than having to update all these architectures in this way, can't
we put in some linux/*.h header something like:

#ifndef cpu_relax_yield
#define cpu_relax_yield() cpu_relax()
#endif

so only those architectures that need to do something need to be
modified?

-- 
RMK's Patch system: http://www.armlinux.org.uk/developer/patches/
FTTC broadband for 0.8mile line: currently at 9.6Mbps down 400kbps up
according to speedtest.net.

Back to linux.kernel | Previous | NextNext in thread | Find similar | Unroll thread


Thread

Re: [GIT PULL v2 1/5] processor.h: introduce cpu_relax_yield Russell King - ARM Linux <linux@armlinux.org.uk> - 2016-11-15 13:40 +0100
  Re: [GIT PULL v2 1/5] processor.h: introduce cpu_relax_yield Christian Borntraeger <borntraeger@de.ibm.com> - 2016-11-15 14:30 +0100
    Re: [GIT PULL v2 1/5] processor.h: introduce cpu_relax_yield Russell King - ARM Linux <linux@armlinux.org.uk> - 2016-11-15 14:40 +0100
      Re: [GIT PULL v2 1/5] processor.h: introduce cpu_relax_yield Christian Borntraeger <borntraeger@de.ibm.com> - 2016-11-15 15:00 +0100

csiph-web