From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751603AbcFYQPr (ORCPT ); Sat, 25 Jun 2016 12:15:47 -0400 Received: from merlin.infradead.org ([205.233.59.134]:51936 "EHLO merlin.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751357AbcFYQPq (ORCPT ); Sat, 25 Jun 2016 12:15:46 -0400 Date: Sat, 25 Jun 2016 18:15:40 +0200 From: Peter Zijlstra To: Boqun Feng Cc: Pan Xinhui , linux-kernel@vger.kernel.org, mingo@redhat.com, dave@stgolabs.net, will.deacon@arm.com, Waiman.Long@hpe.com, benh@kernel.crashing.org Subject: Re: [PATCH] locking/osq: Drop the overload of osq lock Message-ID: <20160625161540.GM30154@twins.programming.kicks-ass.net> References: <1466876523-33437-1-git-send-email-xinhui.pan@linux.vnet.ibm.com> <20160625142447.GK30154@twins.programming.kicks-ass.net> <20160625152130.GA2452@insomnia> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20160625152130.GA2452@insomnia> User-Agent: Mutt/1.5.23.1 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, Jun 25, 2016 at 11:21:30PM +0800, Boqun Feng wrote: > So on PPC, we have lppaca::yield_count to detect when an vcpu is > preempted, if the yield_count is even, the vcpu is running, otherwise it > is preempted(__spin_yield() is a user of this). > > Therefore it makes more sense we > > if (need_resched() || vcpu_is_preempted(old)) > > here, and implement vcpu_is_preempted() on PPC as > > bool vcpu_is_preempted(int cpu) > { > return !!(be32_to_cpu(lppaca_of(cpu).yield_count) & 1) > } > > Thoughts? Would that not have issues where the owner cpu is kept running but the spinner (ie. _this_ vcpu) gets preempted? I would think that in that case we too want to stop spinning. Although, if all vcpus are scheduled equal, it might not matter on average.