From: Hugh Dickins <hugh@veritas.com>
To: Andrew Morton <akpm@digeo.com>
Cc: Dave McCracken <dmccr@us.ibm.com>, Ingo Molnar <mingo@elte.hu>,
<linux-kernel@vger.kernel.org>
Subject: [PATCH] nonlinear oddities
Date: Thu, 6 Mar 2003 16:53:56 +0000 (GMT) [thread overview]
Message-ID: <Pine.LNX.4.44.0303061618460.2422-100000@localhost.localdomain> (raw)
1. Revert MAP_NONLINEAR and VM_NONLINEAR: I can easily imagine wanting
VM_NONLINEAR in future, warning that vma is unusual, but currently it's
not useful: install_page just needs to SetPageAnon if the page is put
somewhere try_to_unmap_obj_one wouldn't be able to find it.
2. filemap_populate and shmem_populate expect an absolute pgoff, but
try_to_unmap_one is forgetting to add in vm_pgoff when doing set_pte.
Could be done the other way round, with relative pgoff in the pte?
No, that would make splitting a vma tedious.
3. No patch included, but I believe 2.5.64-mm1 is testing Ingo's
file-offset-in-pte very much less than you imagine (I've yet to hit
a breakpoint on do_file_page, and I don't think that's down to the
patches above): Dave's work means that the file pages don't arrive
at Ingo's code to set the pte with file offset (unless you actually
use Ingo's syscall) - difficult to test both at once, I think.
Hugh
--- 2.5.64-mm1/include/asm-i386/mman.h Thu Mar 6 08:24:23 2003
+++ linux/include/asm-i386/mman.h Thu Mar 6 15:59:49 2003
@@ -20,7 +20,6 @@
#define MAP_NORESERVE 0x4000 /* don't check for reservations */
#define MAP_POPULATE 0x8000 /* populate (prefault) pagetables */
#define MAP_NONBLOCK 0x10000 /* do not block on IO */
-#define MAP_NONLINEAR 0x20000 /* will be used for remap_file_pages */
#define MS_ASYNC 1 /* sync memory asynchronously */
#define MS_INVALIDATE 2 /* invalidate the caches */
--- 2.5.64-mm1/include/asm-ppc64/mman.h Thu Mar 6 08:24:23 2003
+++ linux/include/asm-ppc64/mman.h Thu Mar 6 15:59:49 2003
@@ -36,7 +36,6 @@
#define MAP_POPULATE 0x8000 /* populate (prefault) pagetables */
#define MAP_NONBLOCK 0x10000 /* do not block on IO */
-#define MAP_NONLINEAR 0x20000 /* Mapping may use remap_file_pages */
#define MADV_NORMAL 0x0 /* default page-in behavior */
#define MADV_RANDOM 0x1 /* page-in minimum required */
--- 2.5.64-mm1/include/linux/mm.h Thu Mar 6 08:24:24 2003
+++ linux/include/linux/mm.h Thu Mar 6 15:59:49 2003
@@ -107,7 +107,6 @@
#define VM_RESERVED 0x00080000 /* Don't unmap it from swap_out */
#define VM_ACCOUNT 0x00100000 /* Is a VM accounted object */
#define VM_HUGETLB 0x00400000 /* Huge TLB Page VM */
-#define VM_NONLINEAR 0x00800000 /* Nonlinear area */
#ifdef CONFIG_STACK_GROWSUP
#define VM_STACK_FLAGS (VM_GROWSUP | VM_DATA_DEFAULT_FLAGS | VM_ACCOUNT)
--- 2.5.64-mm1/mm/fremap.c Thu Mar 6 08:24:24 2003
+++ linux/mm/fremap.c Thu Mar 6 15:59:49 2003
@@ -1,5 +1,5 @@
/*
- * linux/mm/mpopulate.c
+ * linux/mm/fremap.c
*
* Explicit pagetable population and nonlinear (random) mappings support.
*
@@ -57,6 +57,7 @@
pgd_t *pgd;
pmd_t *pmd;
struct pte_chain *pte_chain;
+ unsigned long pgidx;
pte_chain = pte_chain_alloc(GFP_KERNEL);
if (!pte_chain)
@@ -79,7 +80,10 @@
flush_icache_page(vma, page);
entry = mk_pte(page, prot);
set_pte(pte, entry);
- if (vma->vm_flags & VM_NONLINEAR)
+ pgidx = (addr - vma->vm_start) >> PAGE_SHIFT;
+ pgidx += vma->vm_pgoff;
+ pgidx >>= PAGE_CACHE_SHIFT - PAGE_SHIFT;
+ if (page->index != pgidx)
SetPageAnon(page);
pte_chain = page_add_rmap(page, pte, pte_chain);
pte_unmap(pte);
@@ -139,8 +143,7 @@
* and that the remapped range is valid and fully within
* the single existing vma:
*/
- if (vma &&
- ((vma->vm_flags & (VM_SHARED|VM_NONLINEAR)) == (VM_SHARED|VM_NONLINEAR)) &&
+ if (vma && (vma->vm_flags & VM_SHARED) &&
vma->vm_ops && vma->vm_ops->populate &&
end > start && start >= vma->vm_start &&
end <= vma->vm_end)
--- 2.5.64-mm1/mm/mmap.c Thu Mar 6 08:24:24 2003
+++ linux/mm/mmap.c Thu Mar 6 15:59:49 2003
@@ -219,7 +219,6 @@
flag_bits =
_trans(flags, MAP_GROWSDOWN, VM_GROWSDOWN) |
_trans(flags, MAP_DENYWRITE, VM_DENYWRITE) |
- _trans(flags, MAP_NONLINEAR, VM_NONLINEAR) |
_trans(flags, MAP_EXECUTABLE, VM_EXECUTABLE);
return prot_bits | flag_bits;
#undef _trans
--- 2.5.64-mm1/mm/rmap.c Thu Mar 6 08:24:24 2003
+++ linux/mm/rmap.c Thu Mar 6 15:59:49 2003
@@ -598,6 +598,8 @@
* in the pte.
*/
pgidx = (address - vma->vm_start) >> PAGE_SHIFT;
+ pgidx += vma->vm_pgoff;
+ pgidx >>= PAGE_CACHE_SHIFT - PAGE_SHIFT;
if (1 || page->index != pgidx) {
set_pte(ptep, pgoff_to_pte(page->index));
BUG_ON(!pte_file(*ptep));
next reply other threads:[~2003-03-06 16:41 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-03-06 16:53 Hugh Dickins [this message]
2003-03-06 19:14 ` [PATCH] nonlinear oddities Hugh Dickins
2003-03-06 19:38 ` Dave McCracken
[not found] <fa.o2ppdof.u56795@ifi.uio.no>
[not found] ` <fa.k4ichtj.1rh0gp5@ifi.uio.no>
2003-03-09 1:37 ` Ed Tomlinson
2003-03-10 12:07 ` 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=Pine.LNX.4.44.0303061618460.2422-100000@localhost.localdomain \
--to=hugh@veritas.com \
--cc=akpm@digeo.com \
--cc=dmccr@us.ibm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
/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;
as well as URLs for NNTP newsgroup(s).