Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756554AbYA3T22 (ORCPT ); Wed, 30 Jan 2008 14:28:28 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1751991AbYA3T2R (ORCPT ); Wed, 30 Jan 2008 14:28:17 -0500 Received: from relay1.sgi.com ([192.48.171.29]:43129 "EHLO relay.sgi.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751939AbYA3T2R (ORCPT ); Wed, 30 Jan 2008 14:28:17 -0500 Date: Wed, 30 Jan 2008 11:28:15 -0800 (PST) From: Christoph Lameter X-X-Sender: clameter@schroedinger.engr.sgi.com To: Peter Zijlstra cc: Andrea Arcangeli , Robin Holt , Avi Kivity , Izik Eidus , Nick Piggin , kvm-devel@lists.sourceforge.net, Benjamin Herrenschmidt , steiner@sgi.com, linux-kernel@vger.kernel.org, linux-mm@kvack.org, daniel.blueman@quadrics.com, Hugh Dickins Subject: Re: [patch 1/6] mmu_notifier: Core code In-Reply-To: <1201713032.28547.234.camel@lappy> Message-ID: References: <20080130022909.677301714@sgi.com> <20080130022944.236370194@sgi.com> <20080130153749.GN7233@v2.random> <1201713032.28547.234.camel@lappy> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1162 Lines: 29 How about just taking the mmap_sem writelock in release? We have only a single caller of mmu_notifier_release() in mm/mmap.c and we know that we are not holding mmap_sem at that point. So just acquire it when needed? Index: linux-2.6/mm/mmu_notifier.c =================================================================== --- linux-2.6.orig/mm/mmu_notifier.c 2008-01-30 11:21:57.000000000 -0800 +++ linux-2.6/mm/mmu_notifier.c 2008-01-30 11:24:59.000000000 -0800 @@ -18,6 +19,7 @@ void mmu_notifier_release(struct mm_stru struct hlist_node *n, *t; if (unlikely(!hlist_empty(&mm->mmu_notifier.head))) { + down_write(&mm->mmap_sem); rcu_read_lock(); hlist_for_each_entry_safe_rcu(mn, n, t, &mm->mmu_notifier.head, hlist) { @@ -26,6 +28,7 @@ void mmu_notifier_release(struct mm_stru mn->ops->release(mn, mm); } rcu_read_unlock(); + up_write(&mm->mmap_sem); synchronize_rcu(); } } -- 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/