Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932895AbbFIJ41 (ORCPT ); Tue, 9 Jun 2015 05:56:27 -0400 Received: from mail-wi0-f169.google.com ([209.85.212.169]:35589 "EHLO mail-wi0-f169.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753733AbbFIJ4Q (ORCPT ); Tue, 9 Jun 2015 05:56:16 -0400 Date: Tue, 9 Jun 2015 11:56:10 +0200 From: Ingo Molnar To: namhyung@kernel.org, adrian.hunter@intel.com, acme@redhat.com, hpa@zytor.com, linux-kernel@vger.kernel.org, tglx@linutronix.de, dsahern@gmail.com, jolsa@redhat.com Cc: linux-tip-commits@vger.kernel.org Subject: Re: [tip:perf/core] perf tools: Protect accesses the dso rbtrees/ lists with a rw lock Message-ID: <20150609095610.GA18359@gmail.com> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 794 Lines: 25 * tip-bot for Arnaldo Carvalho de Melo wrote: > +void dsos__add(struct dsos *dsos, struct dso *dso) > +{ > + pthread_rwlock_wrlock(&dsos->lock); > + __dsos__add(dsos, dso); > + pthread_rwlock_unlock(&dsos->lock); > } Please introduce wrappers and use the kernel API names: read_lock()/read_unlock()/etc. (and name the mutex primitives mutex_lock()/unlock()) That way kernel developers will find their way around the perf locking details easily, and we can also use liblockdep to check locking correctness. Thanks! Ingo -- 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/