From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751658AbcFYS2u (ORCPT ); Sat, 25 Jun 2016 14:28:50 -0400 Received: from bombadil.infradead.org ([198.137.202.9]:57904 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751349AbcFYS2s (ORCPT ); Sat, 25 Jun 2016 14:28:48 -0400 Date: Sat, 25 Jun 2016 20:28:39 +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: <20160625182839.GN30154@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> <20160625160922.GL30154@twins.programming.kicks-ass.net> <20160625162813.GC2384@insomnia> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20160625162813.GC2384@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 Sun, Jun 26, 2016 at 12:28:13AM +0800, Boqun Feng wrote: > On Sat, Jun 25, 2016 at 06:09:22PM +0200, Peter Zijlstra wrote: > > That works here, but it would not work for the need_resched() in > > mutex_spin_on_owner() and mutex_optimistic_spin() which need equal > > treatment. > > > > Because those too we want to limit. > > > > The count thing, while a little more cumbersome, is more widely > > applicable than just the one OSQ case where we happen to have a cpu > > number. > > > > But if we don't have a cpu number, which vcpu's preemption are we > trying to detect? _this_ vcpu's preemption. If the yield count of this cpu changes, we know this vcpu has been scheduled and we should stop spinning. This is similar to the need_resched() case, which check is _this_ cpu should reschedule.