From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756058AbYAZMCA (ORCPT ); Sat, 26 Jan 2008 07:02:00 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1752346AbYAZMBw (ORCPT ); Sat, 26 Jan 2008 07:01:52 -0500 Received: from relay1.sgi.com ([192.48.171.29]:43591 "EHLO relay.sgi.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751720AbYAZMBv (ORCPT ); Sat, 26 Jan 2008 07:01:51 -0500 Date: Sat, 26 Jan 2008 06:01:50 -0600 From: Robin Holt To: Christoph Lameter Cc: Robin Holt , Andrea Arcangeli , Avi Kivity , Izik Eidus , Nick Piggin , kvm-devel@lists.sourceforge.net, Benjamin Herrenschmidt , Peter Zijlstra , steiner@sgi.com, linux-kernel@vger.kernel.org, linux-mm@kvack.org, daniel.blueman@quadrics.com, Hugh Dickins Subject: Re: [patch 1/4] mmu_notifier: Core code Message-ID: <20080126120149.GS3058@sgi.com> References: <20080125055606.102986685@sgi.com> <20080125055801.212744875@sgi.com> <20080125183934.GO26420@sgi.com> <20080125185646.GQ3058@sgi.com> <20080125193554.GP26420@sgi.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.15+20070412 (2007-04-11) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > void mmu_notifier_register(struct mmu_notifier *mn, struct mm_struct *mm) > { > - spin_lock(&mmu_notifier_list_lock); > - hlist_add_head(&mn->hlist, &mm->mmu_notifier.head); > - spin_unlock(&mmu_notifier_list_lock); > + down_write(&mm->mmap_sem); > + __mmu_notifier_register(mn, mm); > + up_write(&mm->mmap_sem); > } > EXPORT_SYMBOL_GPL(mmu_notifier_register); But what if the caller is already holding the mmap_sem? Why force the acquire into this function? Since we are dealing with a semaphore/mutex, it is reasonable that other structures are protected by this, more work will be done, and therefore put the weight of acquiring the sema in the control of the caller where they can decide if more needs to be completed. That was why I originally suggested creating a new rwsem_is_write_locked() function and basing a BUG_ON upon that. Thanks, Robin From mboxrd@z Thu Jan 1 00:00:00 1970 From: Robin Holt Subject: Re: [patch 1/4] mmu_notifier: Core code Date: Sat, 26 Jan 2008 06:01:50 -0600 Message-ID: <20080126120149.GS3058@sgi.com> References: <20080125055606.102986685@sgi.com> <20080125055801.212744875@sgi.com> <20080125183934.GO26420@sgi.com> <20080125185646.GQ3058@sgi.com> <20080125193554.GP26420@sgi.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Cc: Nick Piggin , Andrea Arcangeli , Peter Zijlstra , linux-mm-Bw31MaZKKs3YtjvyW6yDsg@public.gmane.org, Benjamin Herrenschmidt , steiner-sJ/iWh9BUns@public.gmane.org, linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, Avi Kivity , kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org, daniel.blueman-xqY44rlHlBpWk0Htik3J/w@public.gmane.org, Robin Holt , Hugh Dickins To: Christoph Lameter Return-path: Content-Disposition: inline In-Reply-To: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: kvm-devel-bounces-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org Errors-To: kvm-devel-bounces-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org List-Id: kvm.vger.kernel.org > void mmu_notifier_register(struct mmu_notifier *mn, struct mm_struct *mm) > { > - spin_lock(&mmu_notifier_list_lock); > - hlist_add_head(&mn->hlist, &mm->mmu_notifier.head); > - spin_unlock(&mmu_notifier_list_lock); > + down_write(&mm->mmap_sem); > + __mmu_notifier_register(mn, mm); > + up_write(&mm->mmap_sem); > } > EXPORT_SYMBOL_GPL(mmu_notifier_register); But what if the caller is already holding the mmap_sem? Why force the acquire into this function? Since we are dealing with a semaphore/mutex, it is reasonable that other structures are protected by this, more work will be done, and therefore put the weight of acquiring the sema in the control of the caller where they can decide if more needs to be completed. That was why I originally suggested creating a new rwsem_is_write_locked() function and basing a BUG_ON upon that. Thanks, Robin ------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ From mboxrd@z Thu Jan 1 00:00:00 1970 Date: Sat, 26 Jan 2008 06:01:50 -0600 From: Robin Holt Subject: Re: [patch 1/4] mmu_notifier: Core code Message-ID: <20080126120149.GS3058@sgi.com> References: <20080125055606.102986685@sgi.com> <20080125055801.212744875@sgi.com> <20080125183934.GO26420@sgi.com> <20080125185646.GQ3058@sgi.com> <20080125193554.GP26420@sgi.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Sender: owner-linux-mm@kvack.org Return-Path: To: Christoph Lameter Cc: Robin Holt , Andrea Arcangeli , Avi Kivity , Izik Eidus , Nick Piggin , kvm-devel@lists.sourceforge.net, Benjamin Herrenschmidt , Peter Zijlstra , steiner@sgi.com, linux-kernel@vger.kernel.org, linux-mm@kvack.org, daniel.blueman@quadrics.com, Hugh Dickins List-ID: > void mmu_notifier_register(struct mmu_notifier *mn, struct mm_struct *mm) > { > - spin_lock(&mmu_notifier_list_lock); > - hlist_add_head(&mn->hlist, &mm->mmu_notifier.head); > - spin_unlock(&mmu_notifier_list_lock); > + down_write(&mm->mmap_sem); > + __mmu_notifier_register(mn, mm); > + up_write(&mm->mmap_sem); > } > EXPORT_SYMBOL_GPL(mmu_notifier_register); But what if the caller is already holding the mmap_sem? Why force the acquire into this function? Since we are dealing with a semaphore/mutex, it is reasonable that other structures are protected by this, more work will be done, and therefore put the weight of acquiring the sema in the control of the caller where they can decide if more needs to be completed. That was why I originally suggested creating a new rwsem_is_write_locked() function and basing a BUG_ON upon that. Thanks, Robin -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@kvack.org. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: email@kvack.org