From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755635AbcKVMcY (ORCPT ); Tue, 22 Nov 2016 07:32:24 -0500 Received: from terminus.zytor.com ([198.137.202.10]:41932 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755611AbcKVMcU (ORCPT ); Tue, 22 Nov 2016 07:32:20 -0500 Date: Tue, 22 Nov 2016 04:31:28 -0800 From: tip-bot for Pan Xinhui Message-ID: Cc: xinhui.pan@linux.vnet.ibm.com, borntraeger@de.ibm.com, pbonzini@redhat.com, linux-kernel@vger.kernel.org, mingo@kernel.org, peterz@infradead.org, tglx@linutronix.de, jgross@suse.com, torvalds@linux-foundation.org, hpa@zytor.com Reply-To: xinhui.pan@linux.vnet.ibm.com, linux-kernel@vger.kernel.org, pbonzini@redhat.com, borntraeger@de.ibm.com, peterz@infradead.org, mingo@kernel.org, jgross@suse.com, tglx@linutronix.de, torvalds@linux-foundation.org, hpa@zytor.com In-Reply-To: <1478077718-37424-2-git-send-email-xinhui.pan@linux.vnet.ibm.com> References: <1478077718-37424-2-git-send-email-xinhui.pan@linux.vnet.ibm.com> To: linux-tip-commits@vger.kernel.org Subject: [tip:locking/core] sched/core: Introduce the vcpu_is_preempted(cpu) interface Git-Commit-ID: d9345c65eb7930ac6755cf593ee7686f4029ccf4 X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit-ID: d9345c65eb7930ac6755cf593ee7686f4029ccf4 Gitweb: http://git.kernel.org/tip/d9345c65eb7930ac6755cf593ee7686f4029ccf4 Author: Pan Xinhui AuthorDate: Wed, 2 Nov 2016 05:08:28 -0400 Committer: Ingo Molnar CommitDate: Tue, 22 Nov 2016 12:48:05 +0100 sched/core: Introduce the vcpu_is_preempted(cpu) interface This patch is the first step to add support to improve lock holder preemption beaviour. vcpu_is_preempted(cpu) does the obvious thing: it tells us whether a vCPU is preempted or not. Defaults to false on architectures that don't support it. Suggested-by: Peter Zijlstra (Intel) Tested-by: Juergen Gross Signed-off-by: Pan Xinhui Signed-off-by: Peter Zijlstra (Intel) [ Translated the changelog to English. ] Acked-by: Christian Borntraeger Acked-by: Paolo Bonzini Cc: David.Laight@ACULAB.COM Cc: Linus Torvalds Cc: Peter Zijlstra Cc: Thomas Gleixner Cc: benh@kernel.crashing.org Cc: boqun.feng@gmail.com Cc: bsingharora@gmail.com Cc: dave@stgolabs.net Cc: kernellwp@gmail.com Cc: konrad.wilk@oracle.com Cc: linuxppc-dev@lists.ozlabs.org Cc: mpe@ellerman.id.au Cc: paulmck@linux.vnet.ibm.com Cc: paulus@samba.org Cc: rkrcmar@redhat.com Cc: virtualization@lists.linux-foundation.org Cc: will.deacon@arm.com Cc: xen-devel-request@lists.xenproject.org Cc: xen-devel@lists.xenproject.org Link: http://lkml.kernel.org/r/1478077718-37424-2-git-send-email-xinhui.pan@linux.vnet.ibm.com Signed-off-by: Ingo Molnar --- include/linux/sched.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/include/linux/sched.h b/include/linux/sched.h index dc37cbe..37261af 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h @@ -3510,6 +3510,18 @@ static inline void set_task_cpu(struct task_struct *p, unsigned int cpu) #endif /* CONFIG_SMP */ +/* + * In order to reduce various lock holder preemption latencies provide an + * interface to see if a vCPU is currently running or not. + * + * This allows us to terminate optimistic spin loops and block, analogous to + * the native optimistic spin heuristic of testing if the lock owner task is + * running or not. + */ +#ifndef vcpu_is_preempted +# define vcpu_is_preempted(cpu) false +#endif + extern long sched_setaffinity(pid_t pid, const struct cpumask *new_mask); extern long sched_getaffinity(pid_t pid, struct cpumask *mask);