From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752271AbcF1HAd (ORCPT ); Tue, 28 Jun 2016 03:00:33 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:49235 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752250AbcF1HAb (ORCPT ); Tue, 28 Jun 2016 03:00:31 -0400 X-IBM-Helo: d06dlp02.portsmouth.uk.ibm.com X-IBM-MailFrom: heiko.carstens@de.ibm.com X-IBM-RcptTo: linux-kernel@vger.kernel.org Date: Tue, 28 Jun 2016 09:00:13 +0200 From: Heiko Carstens To: Peter Zijlstra Cc: Pan Xinhui , linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org, paulmck@linux.vnet.ibm.com, mingo@redhat.com, mpe@ellerman.id.au, paulus@samba.org, benh@kernel.crashing.org, Waiman.Long@hpe.com, boqun.feng@gmail.com, will.deacon@arm.com, dave@stgolabs.net, Martin Schwidefsky , Christian Borntraeger Subject: Re: [PATCH 1/3] kernel/sched: introduce vcpu preempted check interface References: <1467049290-32359-1-git-send-email-xinhui.pan@linux.vnet.ibm.com> <1467049290-32359-2-git-send-email-xinhui.pan@linux.vnet.ibm.com> <20160627140043.GO30921@twins.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20160627140043.GO30921@twins.programming.kicks-ass.net> User-Agent: Mutt/1.5.21 (2010-09-15) X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 16062807-0004-0000-0000-0000033A864E X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 16062807-0005-0000-0000-00001A9FB659 Message-Id: <20160628070013.GC3784@osiris> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2016-06-28_05:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=0 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1604210000 definitions=main-1606280065 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Jun 27, 2016 at 04:00:43PM +0200, Peter Zijlstra wrote: > On Mon, Jun 27, 2016 at 01:41:28PM -0400, Pan Xinhui wrote: > > +++ b/include/linux/sched.h > > @@ -3293,6 +3293,15 @@ static inline void set_task_cpu(struct task_struct *p, unsigned int cpu) > > > > #endif /* CONFIG_SMP */ > > > > +#ifdef arch_vcpu_is_preempted > > +static inline bool vcpu_is_preempted(int cpu) > > +{ > > + return arch_vcpu_is_preempted(cpu); > > +} > > +#else > > +#define vcpu_is_preempted(cpu) false > > +#endif > > #ifndef vcpu_is_preempted > #define vcpu_is_preempted(cpu) (false) > #endif > > Is so much simpler... > > Also, please Cc the virt list so that other interested parties can > comment, and maybe also the s390 folks. The s390 implementation would be to simply use cpu_is_preempted() from arch/s390/lib/spinlock.c. It's nice that there will be a common code function for this!