[lkml]   [2005]   [Aug]   [26]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
Patch in this message
Subject[patch 17/18] remap_file_pages linear nonuniform support: (1) try_to_unmap_one fix

From: Paolo 'Blaisorblade' Giarrusso <>

Since we probably will not support linear nonuniform VMAs, this will not
probably be needed. However I'm sending it just in case.

Fix try_to_unmap_one for linear VM_NONUNIFORM vma's.

When unmapping linear but non uniform VMA's in try_to_unmap_one, we must
encode the prots in the PTE.

However, we don't use the generic save_nonlinear_pte() function as it allows
for nonlinear offsets, on which we instead BUG() in this code path, by using

I've not added any TLB flush because PTE's have already been cleared and
flushed in both cases, and (I assume from existing practice and common sense,
but I don't trust CPU architects on having the latter ;-) ) TLB won't need to
know about changes in the "software" part of absent PTEs.

Signed-off-by: Paolo 'Blaisorblade' Giarrusso <>

linux-2.6.git-paolo/include/linux/pagemap.h | 11 +++++++++++
linux-2.6.git-paolo/mm/rmap.c | 3 +++
2 files changed, 14 insertions(+)

diff -puN include/linux/pagemap.h~rfp-linear-nonuniform-1 include/linux/pagemap.h
--- linux-2.6.git/include/linux/pagemap.h~rfp-linear-nonuniform-1 2005-08-25 12:46:20.000000000 +0200
+++ linux-2.6.git-paolo/include/linux/pagemap.h 2005-08-25 12:46:20.000000000 +0200
@@ -180,6 +180,17 @@ static inline void save_nonlinear_pte(pt
set_pte_at(mm, addr, ptep, pgoff_prot_to_pte(page->index, pgprot));

+/* For linear but nonuniform VMA's*/
+static inline void save_nonuniform_pte(pte_t pte, pte_t * ptep, struct
+ vm_area_struct *vma, struct mm_struct *mm, struct page* page,
+ unsigned long addr)
+ pgprot_t pgprot = pte_to_pgprot(pte);
+ BUG_ON(linear_page_index(vma, addr) != page->index);
+ if (pgprot_val(pgprot) != pgprot_val(vma->vm_page_prot))
+ set_pte_at(mm, addr, ptep, pgoff_prot_to_pte(page->index, pgprot));
extern void FASTCALL(__lock_page(struct page *page));
extern void FASTCALL(unlock_page(struct page *page));

diff -puN mm/rmap.c~rfp-linear-nonuniform-1 mm/rmap.c
--- linux-2.6.git/mm/rmap.c~rfp-linear-nonuniform-1 2005-08-25 12:46:20.000000000 +0200
+++ linux-2.6.git-paolo/mm/rmap.c 2005-08-25 12:46:20.000000000 +0200
@@ -543,6 +543,9 @@ static int try_to_unmap_one(struct page
flush_cache_page(vma, address, page_to_pfn(page));
pteval = ptep_clear_flush(vma, address, pte);

+ /* If nonlinear, store the file page offset in the pte. */
+ save_nonuniform_pte(pteval, pte, vma, mm, page, address);
/* Move the dirty bit to the physical page now the pte is gone. */
if (pte_dirty(pteval))
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
More majordomo info at
Please read the FAQ at
 \ /
  Last update: 2005-08-26 19:06    [W:0.015 / U:2.752 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site