Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753355AbbLCTlv (ORCPT ); Thu, 3 Dec 2015 14:41:51 -0500 Received: from mx2.suse.de ([195.135.220.15]:54325 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753143AbbLCTlu (ORCPT ); Thu, 3 Dec 2015 14:41:50 -0500 Date: Thu, 3 Dec 2015 11:41:39 -0800 From: Davidlohr Bueso To: Peter Zijlstra Cc: mingo@kernel.org, oleg@redhat.com, linux-kernel@vger.kernel.org, paulmck@linux.vnet.ibm.com, boqun.feng@gmail.com, corbet@lwn.net, mhocko@kernel.org, dhowells@redhat.com, torvalds@linux-foundation.org, will.deacon@arm.com, waiman.long@hpe.com, pjt@google.com Subject: Re: [PATCH 3/4] locking: Introduce smp_cond_acquire() Message-ID: <20151203194139.GA5650@linux-uzut.site> References: <20151203124010.627312076@infradead.org> <20151203124339.552838970@infradead.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Disposition: inline In-Reply-To: <20151203124339.552838970@infradead.org> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1088 Lines: 29 On Thu, 03 Dec 2015, Peter Zijlstra wrote: >+/** >+ * smp_cond_acquire() - Spin wait for cond with ACQUIRE ordering >+ * @cond: boolean expression to wait for >+ * >+ * Equivalent to using smp_load_acquire() on the condition variable but employs >+ * the control dependency of the wait to reduce the barrier on many platforms. >+ * >+ * The control dependency provides a LOAD->STORE order, the additional RMB >+ * provides LOAD->LOAD order, together they provide LOAD->{LOAD,STORE} order, >+ * aka. ACQUIRE. >+ */ >+#define smp_cond_acquire(cond) do { \ >+ while (!(cond)) \ >+ cpu_relax(); \ >+ smp_rmb(); /* ctrl + rmb := acquire */ \ >+} while (0) So this hides the fact that we actually are waiting on the cond, as opposed to conditional acquiring. Could it be renamed to something like smp_waitcond_acquire()? 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/