Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754835AbbG0TjU (ORCPT ); Mon, 27 Jul 2015 15:39:20 -0400 Received: from mx2.suse.de ([195.135.220.15]:49652 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753291AbbG0TjT (ORCPT ); Mon, 27 Jul 2015 15:39:19 -0400 Message-ID: <1438025945.25997.46.camel@stgolabs.net> Subject: Re: [PATCH v3 2/7] locking/pvqspinlock: Add pending bit support From: Davidlohr Bueso To: Waiman Long Cc: Peter Zijlstra , Ingo Molnar , Thomas Gleixner , "H. Peter Anvin" , x86@kernel.org, linux-kernel@vger.kernel.org, Scott J Norton , Douglas Hatch Date: Mon, 27 Jul 2015 12:39:05 -0700 In-Reply-To: <55B66ACB.6010702@hp.com> References: <1437595962-21472-1-git-send-email-Waiman.Long@hp.com> <1437595962-21472-3-git-send-email-Waiman.Long@hp.com> <1437958584.25997.27.camel@stgolabs.net> <55B66ACB.6010702@hp.com> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.12.11 Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 790 Lines: 30 On Mon, 2015-07-27 at 13:30 -0400, Waiman Long wrote: > The pending bit acts as a 1-slot waiting queue. So if the vCPU needs to > fall back to regular queuing, it needs to clear the bit. Right, that's what I thought. So you would also need to call clear_pending() as soon as the trylock/pending loop hits zero. Or am I missing something? /* * trylock || pending */ for (;;) { ... if (loop--<= 0) { clear_pending(lock); goto queue; } } Also, no need to check for negative loop, zero should be enough to breakout. Thanks, Davidlohr -- 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/