From: James Bottomley <James.Bottomley@steeleye.com>
To: Linus Torvalds <torvalds@osdl.org>
Cc: Linux Kernel <linux-kernel@vger.kernel.org>
Subject: [PATCH] fix remap of shared read only mappings
Date: 04 Sep 2003 10:49:18 -0400 [thread overview]
Message-ID: <1062686960.1829.11.camel@mulgrave> (raw)
When mmap MAP_SHARED is done on a file, it gets marked with VM_MAYSHARE
and, if it's read/write, VM_SHARED. However, if it is remapped with
mremap(), the MAP_SHARED is only passed into the new mapping based on
VM_SHARED. This means that remapped read only MAP_SHARED mappings lose
VM_MAYSHARE. This is causing us a problem on parisc because we have to
align all shared mappings carefully to mitigate cache aliasing problems.
The fix is to key passing the MAP_SHARED flag back into the remapped are
off VM_MAYSHARE not VM_SHARED.
James
===== mremap.c 1.32 vs 1.33 =====
--- 1.32/mm/mremap.c Thu Aug 7 12:29:10 2003
+++ 1.33/mm/mremap.c Sun Aug 24 06:50:10 2003
@@ -420,7 +420,7 @@
if (flags & MREMAP_MAYMOVE) {
if (!(flags & MREMAP_FIXED)) {
unsigned long map_flags = 0;
- if (vma->vm_flags & VM_SHARED)
+ if (vma->vm_flags & VM_MAYSHARE)
map_flags |= MAP_SHARED;
new_addr = get_unmapped_area(vma->vm_file, 0, new_len,
next reply other threads:[~2003-09-04 14:49 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-09-04 14:49 James Bottomley [this message]
2003-09-04 21:48 ` [PATCH] fix remap of shared read only mappings Jamie Lokier
2003-09-04 22:33 ` James Bottomley
2003-09-04 22:56 ` Jamie Lokier
2003-09-04 23:23 ` James Bottomley
2003-09-04 23:40 ` Jamie Lokier
2003-09-05 0:49 ` Daniel Phillips
2003-09-05 0:49 ` Linus Torvalds
2003-09-05 1:07 ` Alan Cox
2003-09-05 1:31 ` Daniel Phillips
2003-09-05 4:35 ` Linus Torvalds
2003-09-05 0:52 ` James Bottomley
2003-09-05 1:21 ` Daniel Phillips
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=1062686960.1829.11.camel@mulgrave \
--to=james.bottomley@steeleye.com \
--cc=linux-kernel@vger.kernel.org \
--cc=torvalds@osdl.org \
/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.