Skip to content

Commit

Permalink
arm64: Implement cpu_relax as yield
Browse files Browse the repository at this point in the history
ARM64 has the yield nop hint which has the intended semantics of
cpu_relax. Implement.

The immediate application is ARM CPU emulators. An emulator can take
advantage of the yield hint to de-prioritise an emulated CPU in favor
of other emulation tasks. QEMU A64 SMP emulation has yield awareness,
and sees a significant boot time performance increase with this change.

Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
Acked-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: Will Deacon <will.deacon@arm.com>
  • Loading branch information
pete128 authored and wildea01 committed Mar 17, 2015
1 parent 06e5801 commit 1baa82f
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion arch/arm64/include/asm/processor.h
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,11 @@ extern void release_thread(struct task_struct *);

unsigned long get_wchan(struct task_struct *p);

#define cpu_relax() barrier()
static inline void cpu_relax(void)
{
asm volatile("yield" ::: "memory");
}

#define cpu_relax_lowlatency() cpu_relax()

/* Thread switching */
Expand Down

0 comments on commit 1baa82f

Please sign in to comment.