linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Linus Torvalds <torvalds@transmeta.com>
To: Andrew Morton <akpm@digeo.com>
Cc: "Martin J. Bligh" <mbligh@aracnet.com>,
	Dave McCracken <dmccr@us.ibm.com>,
	Daniel Phillips <phillips@arcor.de>,
	linux-mm@kvack.org, Ingo Molnar <mingo@elte.hu>
Subject: Re: shared pagetable benchmarking
Date: Fri, 27 Dec 2002 23:47:44 -0800 (PST)	[thread overview]
Message-ID: <Pine.LNX.4.44.0212272338040.4568-100000@home.transmeta.com> (raw)
In-Reply-To: <3E0D4B83.FEE220B8@digeo.com>

On Fri, 27 Dec 2002, Andrew Morton wrote:
> >                 if (!file)
> >                         goto out;
> > +               if (prot & PROT_EXEC)
> > +                       flags |= MAP_POPULATE | MAP_NONBLOCK;
> 
> Yes, this could be used to prototype it, I think.
> 
> It doesn't work as-is, because remap_file_pages() requires a shared
> mapping.  Disabling that check results in a scrogged ld.so and a
> non-booting system.  remap_file_pages() plays games with the vma
> protection in ways which I do not understand.

Ahh.. Those file protection games are wrong for anything but the specific 
case of the sys_remap_file_pages() system call. The mmap() case should 
_not_ use that system call path at all, but should instead just call the 
populate function directly. Something like the appended patch.

CAREFUL! I've not checked all the details on this, but moving the
MAP_POPULATE check upwards should get rid of the problems with the vma
goign away etc, so it should make this at least closer to correct, and
makes all the extra work that sys_remap_file_pages() does totally
unnecessary, since we know the vma and ranges already.

This has not been compiled, much less tested. Consider a example ONLY.

		Linus

----
===== arch/i386/kernel/sys_i386.c 1.10 vs edited =====
--- 1.10/arch/i386/kernel/sys_i386.c	Sat Dec 21 08:24:45 2002
+++ edited/arch/i386/kernel/sys_i386.c	Fri Dec 27 19:08:30 2002
@@ -54,6 +54,8 @@
 		file = fget(fd);
 		if (!file)
 			goto out;
+		if (prot & PROT_EXEC)
+			flags |= MAP_POPULATE | MAP_NONBLOCK;
 	}
 
 	down_write(&current->mm->mmap_sem);
===== mm/mmap.c 1.58 vs edited =====
--- 1.58/mm/mmap.c	Sat Dec 14 09:42:45 2002
+++ edited/mm/mmap.c	Fri Dec 27 23:45:45 2002
@@ -576,6 +576,11 @@
 		error = file->f_op->mmap(file, vma);
 		if (error)
 			goto unmap_and_free_vma;
+
+		if (flags & MAP_POPULATE) {
+			if (vma->vm_ops && vma->vm_ops->populate)
+				vma->vm_ops->populate(vma, addr, len, prot, pgoff, flags & MAP_NONBLOCK);
+		}
 	} else if (vm_flags & VM_SHARED) {
 		error = shmem_zero_setup(vma);
 		if (error)
@@ -606,12 +611,6 @@
 	if (vm_flags & VM_LOCKED) {
 		mm->locked_vm += len >> PAGE_SHIFT;
 		make_pages_present(addr, addr + len);
-	}
-	if (flags & MAP_POPULATE) {
-		up_write(&mm->mmap_sem);
-		sys_remap_file_pages(addr, len, prot,
-					pgoff, flags & MAP_NONBLOCK);
-		down_write(&mm->mmap_sem);
 	}
 	return addr;
 

--
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/

  parent reply	other threads:[~2002-12-28  7:47 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-12-20 11:11 Andrew Morton
2002-12-20 11:13 ` William Lee Irwin III
2002-12-20 16:30 ` Dave McCracken
2002-12-20 19:59   ` Andrew Morton
2002-12-23 16:15     ` Dave McCracken
2002-12-23 23:54       ` Andrew Morton
2002-12-27  9:39       ` Daniel Phillips
2002-12-27  9:58         ` Andrew Morton
2002-12-27 15:59           ` Daniel Phillips
2002-12-27 20:02             ` Linus Torvalds
2002-12-27 20:16               ` Dave McCracken
2002-12-27 20:18                 ` Linus Torvalds
2002-12-27 20:45                   ` Dave McCracken
2002-12-27 20:50                     ` Linus Torvalds
2002-12-27 23:56                       ` Daniel Phillips
2002-12-28  0:45                       ` Martin J. Bligh
2002-12-28  2:34                         ` Andrew Morton
2002-12-28  3:10                           ` Linus Torvalds
2002-12-28  6:58                             ` Andrew Morton
2002-12-28  7:39                               ` Ingo Molnar
2002-12-28  7:47                               ` Linus Torvalds [this message]
2002-12-28 23:28                                 ` Andrew Morton
2002-12-28  3:19                           ` Martin J. Bligh
2002-12-23 18:19 ` Dave McCracken

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=Pine.LNX.4.44.0212272338040.4568-100000@home.transmeta.com \
    --to=torvalds@transmeta.com \
    --cc=akpm@digeo.com \
    --cc=dmccr@us.ibm.com \
    --cc=linux-mm@kvack.org \
    --cc=mbligh@aracnet.com \
    --cc=mingo@elte.hu \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox