Skip to content

Commit

Permalink
s390: reintroduce diag 44 calls for cpu_relax()
Browse files Browse the repository at this point in the history
Christian Borntraeger reported that the now missing diag 44 calls (voluntary
time slice end) does cause a performance regression for stop_machine() calls
if a machine has more virtual cpus than the host has physical cpus.

This patch mainly reverts 57f2ffe ("s390: remove diag 44 calls from
cpu_relax()") with the exception that we still do not issue diag 44 calls if
running with smt enabled. Due to group scheduling algorithms when running in
LPAR this would lead to significant latencies.
However, when running in LPAR we do not have more virtual than physical cpus.

Reported-and-tested-by: Christian Borntraeger <[email protected]>
Signed-off-by: Heiko Carstens <[email protected]>
Signed-off-by: Martin Schwidefsky <[email protected]>
  • Loading branch information
heicarst authored and Martin Schwidefsky committed Jan 29, 2015
1 parent bdea1f1 commit 4d92f50
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
5 changes: 1 addition & 4 deletions arch/s390/include/asm/processor.h
Original file line number Diff line number Diff line change
Expand Up @@ -215,10 +215,7 @@ static inline unsigned short stap(void)
/*
* Give up the time slice of the virtual PU.
*/
static inline void cpu_relax(void)
{
barrier();
}
void cpu_relax(void);

#define cpu_relax_lowlatency() barrier()

Expand Down
10 changes: 9 additions & 1 deletion arch/s390/kernel/processor.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,24 @@

#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/smp.h>
#include <linux/seq_file.h>
#include <linux/delay.h>
#include <linux/cpu.h>
#include <asm/elf.h>
#include <asm/lowcore.h>
#include <asm/param.h>
#include <asm/smp.h>

static DEFINE_PER_CPU(struct cpuid, cpu_id);

void cpu_relax(void)
{
if (!smp_cpu_mtid && MACHINE_HAS_DIAG44)
asm volatile("diag 0,0,0x44");
barrier();
}
EXPORT_SYMBOL(cpu_relax);

/*
* cpu_init - initializes state that is per-CPU.
*/
Expand Down

0 comments on commit 4d92f50

Please sign in to comment.