Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752447AbbGOBiZ (ORCPT ); Tue, 14 Jul 2015 21:38:25 -0400 Received: from g9t5008.houston.hp.com ([15.240.92.66]:38608 "EHLO g9t5008.houston.hp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751769AbbGOBiY (ORCPT ); Tue, 14 Jul 2015 21:38:24 -0400 Message-ID: <55A5B98D.7010008@hp.com> Date: Tue, 14 Jul 2015 21:38:21 -0400 From: Waiman Long User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:10.0.12) Gecko/20130109 Thunderbird/10.0.12 MIME-Version: 1.0 To: Peter Zijlstra CC: Ingo Molnar , Thomas Gleixner , "H. Peter Anvin" , x86@kernel.org, linux-kernel@vger.kernel.org, Scott J Norton , Douglas Hatch Subject: Re: [PATCH 2/7] locking/pvqspinlock: Allow vCPUs kick-ahead References: <1436647018-49734-1-git-send-email-Waiman.Long@hp.com> <1436647018-49734-3-git-send-email-Waiman.Long@hp.com> <20150713135220.GI3644@twins.programming.kicks-ass.net> In-Reply-To: <20150713135220.GI3644@twins.programming.kicks-ass.net> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1603 Lines: 31 On 07/13/2015 09:52 AM, Peter Zijlstra wrote: > On Sat, Jul 11, 2015 at 04:36:53PM -0400, Waiman Long wrote: >> Frequent CPU halting (vmexit) and CPU kicking (vmenter) lengthens >> critical section and block forward progress. This patch implements >> a kick-ahead mechanism where the unlocker will kick the queue head >> vCPUs as well as up to two additional vCPUs next to the queue head if >> they were halted. The kickings are done after exiting the critical >> section to improve parallelism. >> >> The amount of kick-ahead allowed depends on the number of vCPUs in >> the VM guest. This change should improve overall system performance >> in a busy overcommitted guest. > -ENONUMBERS... also highly workload sensitive, if the lock hold time is > just above our spin time you're wasting gobs of runtime. Currently SPIN_THRESHOLD is (1<<15). My test of the pause instruction is about 3ns in my 2.5GHz Haswell-EX system. That translates to a spinning time of at least 100us. I don't think we have critical sections in the kernel that take that long. I also found out that the kick-to-wakeup time can be pretty long, kicking ahead will enable the next cpu waiting in line to get the lock faster as some of the wakeup time will overlap with the critical sections of previous CPUs. Will have the performance number in the v2 patch. Cheers, Longman -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/