Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S935058AbYCDXR7 (ORCPT ); Tue, 4 Mar 2008 18:17:59 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S934861AbYCDXOv (ORCPT ); Tue, 4 Mar 2008 18:14:51 -0500 Received: from netops-testserver-3-out.sgi.com ([192.48.171.28]:54122 "EHLO relay.sgi.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S934860AbYCDXOu (ORCPT ); Tue, 4 Mar 2008 18:14:50 -0500 Date: Tue, 4 Mar 2008 15:14:42 -0800 (PST) From: Christoph Lameter X-X-Sender: clameter@schroedinger.engr.sgi.com To: Peter Zijlstra cc: Andrea Arcangeli , Jack Steiner , Nick Piggin , akpm@linux-foundation.org, Robin Holt , Avi Kivity , kvm-devel@lists.sourceforge.net, general@lists.openfabrics.org, Steve Wise , Roland Dreier , Kanoj Sarcar , linux-kernel@vger.kernel.org, linux-mm@kvack.org, daniel.blueman@quadrics.com Subject: Re: [RFC] Notifier for Externally Mapped Memory (EMM) In-Reply-To: <1204670529.6241.52.camel@lappy> Message-ID: References: <20080221144023.GC9427@v2.random> <20080221161028.GA14220@sgi.com> <20080227192610.GF28483@v2.random> <20080302155457.GK8091@v2.random> <20080303213707.GA8091@v2.random> <20080303220502.GA5301@v2.random> <47CC9B57.5050402@qumranet.com> <20080304133020.GC5301@v2.random> <20080304222030.GB8951@v2.random> <1204670529.6241.52.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: 2244 Lines: 69 On Tue, 4 Mar 2008, Peter Zijlstra wrote: > > On Tue, 2008-03-04 at 14:35 -0800, Christoph Lameter wrote: > > > RCU means that the callbacks occur in an atomic context. > > Not really, if it requires moving the VM locks to sleepable locks under > a .config option, I think its also fair to require PREEMPT_RCU. Which would make the patchset pretty complex. RCU is not needed with a single linked list. Linked list operations can exploit atomic pointer updates and we only tear down the list when a single execution thread remains. Having said that: Here a couple of updates to address Andrea's complaint that we not check the referenced bit from the external mapper when the rerferences bit is set on an OS pte. Plus two barriers to ensure that a new emm notifier object becomes visible before the base pointer is updated. Signed-off-by: Christoph Lameter --- mm/rmap.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) Index: linux-2.6/mm/rmap.c =================================================================== --- linux-2.6.orig/mm/rmap.c 2008-03-04 14:36:36.321922321 -0800 +++ linux-2.6/mm/rmap.c 2008-03-04 15:10:46.159429369 -0800 @@ -298,10 +298,10 @@ static int page_referenced_one(struct pa (*mapcount)--; pte_unmap_unlock(pte, ptl); - if (!referenced) - /* rmap lock held */ - referenced = emm_notify(mm, emm_referenced, - address, address + PAGE_SIZE); + + /* rmap lock held */ + if (emm_notify(mm, emm_referenced, address, address + PAGE_SIZE)) + referenced = 1; out: return referenced; } @@ -1057,6 +1057,7 @@ EXPORT_SYMBOL_GPL(emm_notifier_release); void emm_notifier_register(struct emm_notifier *e, struct mm_struct *mm) { e->next = mm->emm_notifier; + smp_wmb(); mm->emm_notifier = e; } EXPORT_SYMBOL_GPL(emm_notifier_register); @@ -1069,6 +1070,7 @@ int __emm_notify(struct mm_struct *mm, e int x; while (e) { + smp_rmb(); if (e->func) { x = e->func(e, mm, op, start, end); if (x) -- 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/