From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757487Ab2JQQ6N (ORCPT ); Wed, 17 Oct 2012 12:58:13 -0400 Received: from mx1.redhat.com ([209.132.183.28]:52815 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756469Ab2JQQ6L (ORCPT ); Wed, 17 Oct 2012 12:58:11 -0400 Date: Wed, 17 Oct 2012 18:59:02 +0200 From: Oleg Nesterov To: Linus Torvalds Cc: Ingo Molnar , "Paul E. McKenney" , Peter Zijlstra , Srikar Dronamraju , Ananth N Mavinakayanahalli , Anton Arapov , linux-kernel@vger.kernel.org Subject: Re: [PATCH 1/2] brw_mutex: big read-write mutex Message-ID: <20121017165902.GB9872@redhat.com> References: <20121015190958.GA4799@redhat.com> <20121015191018.GA4816@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.18 (2008-05-17) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 10/16, Linus Torvalds wrote: > > On Mon, Oct 15, 2012 at 12:10 PM, Oleg Nesterov wrote: > > This patch adds the new sleeping lock, brw_mutex. Unlike rw_semaphore > > it allows multiple writers too, just "read" and "write" are mutually > > exclusive. > > So those semantics just don't sound sane. It's also not what any kind > of normal "rw" lock ever does. Yes, this is not usual. And initially I made brw_sem which allows only 1 writer, but then I changed this patch. > So can you explain why these particular insane semantics are useful, > and what for? To allow multiple uprobe_register/unregister at the same time. Mostly to not add the "regression", currently this is possible. It is not that I think this is terribly important, but still. And personally I think that "multiple writers" is not necessarily insane in general. Suppose you have the complex object/subsystem, the readers can use a single brw_mutex to access it "lockless", start_read() is very cheap. But start_write() is slow. Multiple writes can use the fine-grained inside the start_write/end_write section and do not block each other. Oleg.