All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Paul E. McKenney" <paulmck@us.ibm.com>
To: Hugh Dickins <hugh@veritas.com>
Cc: phillips@arcor.de, akpm@digeo.com, hch@infradead.org,
	linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: Re: [RFC][PATCH] Avoid vmtruncate/mmap-page-fault race
Date: Thu, 29 May 2003 19:38:26 -0700	[thread overview]
Message-ID: <20030530023826.GA1350@us.ibm.com> (raw)
In-Reply-To: <Pine.LNX.4.44.0305291723310.1800-100000@localhost.localdomain>

On Thu, May 29, 2003 at 05:33:04PM +0100, Hugh Dickins wrote:
> On Thu, 29 May 2003, Paul E. McKenney wrote:
> > On Fri, May 23, 2003 at 11:42:02AM -0700, Paul E. McKenney wrote:
> > > 
> > > Exactly -- allows a ->nopage() to drop some lock to avoid races
> > > between pagefault and either vmtruncate() or invalidate_mmap_range().
> > > This race (from the cross-host mmap viewpoint) is described in:
> > > 
> > >     http://marc.theaimsgroup.com/?l=linux-kernel&m=105286345316249&w=2
> > 
> > Rediffed for 2.5.70-mm1.
> 
> Me?  I much preferred your original, much sparer, nopagedone patch
> (labelled "uglyh as hell" by hch).  I dislike passing lots of args
> down a level so they can be passed up again to the library function.
> 
> In particular, I feel queasy (fear loss of control) about passing a
> pmd_t* down to a filesystem, which I'd prefer to have no access to
> such.  But I may be in a minority, and the decision won't be mine.

Fine by me either way.  ;-)  Here is the rediffed nopagedone patch
for 2.5.70-mm1.

						Thanx, Paul


diff -urN -X dontdiff linux-2.5.70-mm1/include/linux/mm.h linux-2.5.70-mm1.nopagedone/include/linux/mm.h
--- linux-2.5.70-mm1/include/linux/mm.h	2003-05-28 20:16:04.000000000 -0700
+++ linux-2.5.70-mm1.nopagedone/include/linux/mm.h	2003-05-29 19:34:55.000000000 -0700
@@ -143,6 +143,7 @@
 	void (*open)(struct vm_area_struct * area);
 	void (*close)(struct vm_area_struct * area);
 	struct page * (*nopage)(struct vm_area_struct * area, unsigned long address, int unused);
+	void (*nopagedone)(struct vm_area_struct * area, unsigned long address, int status);
 	int (*populate)(struct vm_area_struct * area, unsigned long address, unsigned long len, pgprot_t prot, unsigned long pgoff, int nonblock);
 };
 
diff -urN -X dontdiff linux-2.5.70-mm1/mm/memory.c linux-2.5.70-mm1.nopagedone/mm/memory.c
--- linux-2.5.70-mm1/mm/memory.c	2003-05-28 20:16:04.000000000 -0700
+++ linux-2.5.70-mm1.nopagedone/mm/memory.c	2003-05-29 19:34:55.000000000 -0700
@@ -1468,6 +1468,9 @@
 	ret = VM_FAULT_OOM;
 out:
 	pte_chain_free(pte_chain);
+	if (vma->vm_ops && vma->vm_ops->nopagedone) {
+		vma->vm_ops->nopagedone(vma, address & PAGE_MASK, ret);
+	}
 	return ret;
 }
 

WARNING: multiple messages have this Message-ID (diff)
From: "Paul E. McKenney" <paulmck@us.ibm.com>
To: Hugh Dickins <hugh@veritas.com>
Cc: phillips@arcor.de, akpm@digeo.com, hch@infradead.org,
	linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: Re: [RFC][PATCH] Avoid vmtruncate/mmap-page-fault race
Date: Thu, 29 May 2003 19:38:26 -0700	[thread overview]
Message-ID: <20030530023826.GA1350@us.ibm.com> (raw)
In-Reply-To: <Pine.LNX.4.44.0305291723310.1800-100000@localhost.localdomain>

On Thu, May 29, 2003 at 05:33:04PM +0100, Hugh Dickins wrote:
> On Thu, 29 May 2003, Paul E. McKenney wrote:
> > On Fri, May 23, 2003 at 11:42:02AM -0700, Paul E. McKenney wrote:
> > > 
> > > Exactly -- allows a ->nopage() to drop some lock to avoid races
> > > between pagefault and either vmtruncate() or invalidate_mmap_range().
> > > This race (from the cross-host mmap viewpoint) is described in:
> > > 
> > >     http://marc.theaimsgroup.com/?l=linux-kernel&m=105286345316249&w=2
> > 
> > Rediffed for 2.5.70-mm1.
> 
> Me?  I much preferred your original, much sparer, nopagedone patch
> (labelled "uglyh as hell" by hch).  I dislike passing lots of args
> down a level so they can be passed up again to the library function.
> 
> In particular, I feel queasy (fear loss of control) about passing a
> pmd_t* down to a filesystem, which I'd prefer to have no access to
> such.  But I may be in a minority, and the decision won't be mine.

Fine by me either way.  ;-)  Here is the rediffed nopagedone patch
for 2.5.70-mm1.

						Thanx, Paul


diff -urN -X dontdiff linux-2.5.70-mm1/include/linux/mm.h linux-2.5.70-mm1.nopagedone/include/linux/mm.h
--- linux-2.5.70-mm1/include/linux/mm.h	2003-05-28 20:16:04.000000000 -0700
+++ linux-2.5.70-mm1.nopagedone/include/linux/mm.h	2003-05-29 19:34:55.000000000 -0700
@@ -143,6 +143,7 @@
 	void (*open)(struct vm_area_struct * area);
 	void (*close)(struct vm_area_struct * area);
 	struct page * (*nopage)(struct vm_area_struct * area, unsigned long address, int unused);
+	void (*nopagedone)(struct vm_area_struct * area, unsigned long address, int status);
 	int (*populate)(struct vm_area_struct * area, unsigned long address, unsigned long len, pgprot_t prot, unsigned long pgoff, int nonblock);
 };
 
diff -urN -X dontdiff linux-2.5.70-mm1/mm/memory.c linux-2.5.70-mm1.nopagedone/mm/memory.c
--- linux-2.5.70-mm1/mm/memory.c	2003-05-28 20:16:04.000000000 -0700
+++ linux-2.5.70-mm1.nopagedone/mm/memory.c	2003-05-29 19:34:55.000000000 -0700
@@ -1468,6 +1468,9 @@
 	ret = VM_FAULT_OOM;
 out:
 	pte_chain_free(pte_chain);
+	if (vma->vm_ops && vma->vm_ops->nopagedone) {
+		vma->vm_ops->nopagedone(vma, address & PAGE_MASK, ret);
+	}
 	return ret;
 }
 
--
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: <a href=mailto:"aart@kvack.org"> aart@kvack.org </a>

  parent reply	other threads:[~2003-05-30 16:45 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-05-23 18:42 [RFC][PATCH] Avoid vmtruncate/mmap-page-fault race Paul E. McKenney
2003-05-23 18:42 ` Paul E. McKenney
2003-05-29 15:14 ` Paul E. McKenney
2003-05-29 15:14   ` Paul E. McKenney
2003-05-29 15:18   ` [RFC][PATCH] Remove LINUX_2_2 Paul E. McKenney
2003-05-29 15:18     ` Paul E. McKenney
2003-05-29 16:33   ` [RFC][PATCH] Avoid vmtruncate/mmap-page-fault race Hugh Dickins
2003-05-29 16:33     ` Hugh Dickins
2003-05-29 17:15     ` Daniel Phillips
2003-05-29 17:15       ` Daniel Phillips
2003-05-29 17:39       ` Daniel Phillips
2003-05-29 17:39         ` Daniel Phillips
2003-05-29 20:24         ` Paul E. McKenney
2003-05-29 20:24           ` Paul E. McKenney
2003-05-30  2:38     ` Paul E. McKenney [this message]
2003-05-30  2:38       ` Paul E. McKenney
  -- strict thread matches above, loose matches on Subject: below --
2003-05-17 18:21 [RFC][PATCH] vm_operation to avoid pagefault/inval race Daniel Phillips
2003-05-17 19:49 ` Andrew Morton
2003-05-20  1:23   ` Paul E. McKenney
2003-05-20  8:11     ` Andrew Morton
2003-05-23 14:35       ` [RFC][PATCH] Avoid vmtruncate/mmap-page-fault race Paul E. McKenney
2003-05-23 14:35         ` Paul E. McKenney
2003-05-23 16:21         ` Hugh Dickins
2003-05-23 16:21           ` Hugh Dickins
2003-05-23 17:10           ` Daniel Phillips
2003-05-23 17:10             ` Daniel Phillips
2003-05-23 17:47             ` Hugh Dickins
2003-05-23 17:47               ` Hugh Dickins

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20030530023826.GA1350@us.ibm.com \
    --to=paulmck@us.ibm.com \
    --cc=akpm@digeo.com \
    --cc=hch@infradead.org \
    --cc=hugh@veritas.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=phillips@arcor.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.