aboutsummaryrefslogtreecommitdiffstats
path: root/mm
diff options
context:
space:
mode:
authorAtsushi Nemoto <anemo@mba.ocn.ne.jp>2006-12-12 12:14:55 -0500
committerLinus Torvalds <torvalds@woody.osdl.org>2006-12-13 12:27:08 -0500
commit9de455b20705f36384a711d4a20bcf7ba1ab180b (patch)
tree6eb3643514d12d06a69a5c889d612f66b68288e6 /mm
parent77fff4ae2b7bba6d66a8287d9ab948e2b6c16145 (diff)
[PATCH] Pass vma argument to copy_user_highpage().
To allow a more effective copy_user_highpage() on certain architectures, a vma argument is added to the function and cow_user_page() allowing the implementation of these functions to check for the VM_EXEC bit. The main part of this patch was originally written by Ralf Baechle; Atushi Nemoto did the the debugging. Signed-off-by: Atsushi Nemoto <anemo@mba.ocn.ne.jp> Signed-off-by: Ralf Baechle <ralf@linux-mips.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'mm')
-rw-r--r--mm/hugetlb.c6
-rw-r--r--mm/memory.c10
2 files changed, 8 insertions, 8 deletions
diff --git a/mm/hugetlb.c b/mm/hugetlb.c
index 089092d152ab..cb362f761f17 100644
--- a/mm/hugetlb.c
+++ b/mm/hugetlb.c
@@ -44,14 +44,14 @@ static void clear_huge_page(struct page *page, unsigned long addr)
44} 44}
45 45
46static void copy_huge_page(struct page *dst, struct page *src, 46static void copy_huge_page(struct page *dst, struct page *src,
47 unsigned long addr) 47 unsigned long addr, struct vm_area_struct *vma)
48{ 48{
49 int i; 49 int i;
50 50
51 might_sleep(); 51 might_sleep();
52 for (i = 0; i < HPAGE_SIZE/PAGE_SIZE; i++) { 52 for (i = 0; i < HPAGE_SIZE/PAGE_SIZE; i++) {
53 cond_resched(); 53 cond_resched();
54 copy_user_highpage(dst + i, src + i, addr + i*PAGE_SIZE); 54 copy_user_highpage(dst + i, src + i, addr + i*PAGE_SIZE, vma);
55 } 55 }
56} 56}
57 57
@@ -442,7 +442,7 @@ static int hugetlb_cow(struct mm_struct *mm, struct vm_area_struct *vma,
442 } 442 }
443 443
444 spin_unlock(&mm->page_table_lock); 444 spin_unlock(&mm->page_table_lock);
445 copy_huge_page(new_page, old_page, address); 445 copy_huge_page(new_page, old_page, address, vma);
446 spin_lock(&mm->page_table_lock); 446 spin_lock(&mm->page_table_lock);
447 447
448 ptep = huge_pte_offset(mm, address & HPAGE_MASK); 448 ptep = huge_pte_offset(mm, address & HPAGE_MASK);
diff --git a/mm/memory.c b/mm/memory.c
index bf6100236e62..c00bac66ce9f 100644
--- a/mm/memory.c
+++ b/mm/memory.c
@@ -1441,7 +1441,7 @@ static inline pte_t maybe_mkwrite(pte_t pte, struct vm_area_struct *vma)
1441 return pte; 1441 return pte;
1442} 1442}
1443 1443
1444static inline void cow_user_page(struct page *dst, struct page *src, unsigned long va) 1444static inline void cow_user_page(struct page *dst, struct page *src, unsigned long va, struct vm_area_struct *vma)
1445{ 1445{
1446 /* 1446 /*
1447 * If the source page was a PFN mapping, we don't have 1447 * If the source page was a PFN mapping, we don't have
@@ -1464,9 +1464,9 @@ static inline void cow_user_page(struct page *dst, struct page *src, unsigned lo
1464 kunmap_atomic(kaddr, KM_USER0); 1464 kunmap_atomic(kaddr, KM_USER0);
1465 flush_dcache_page(dst); 1465 flush_dcache_page(dst);
1466 return; 1466 return;
1467 1467
1468 } 1468 }
1469 copy_user_highpage(dst, src, va); 1469 copy_user_highpage(dst, src, va, vma);
1470} 1470}
1471 1471
1472/* 1472/*
@@ -1577,7 +1577,7 @@ gotten:
1577 new_page = alloc_page_vma(GFP_HIGHUSER, vma, address); 1577 new_page = alloc_page_vma(GFP_HIGHUSER, vma, address);
1578 if (!new_page) 1578 if (!new_page)
1579 goto oom; 1579 goto oom;
1580 cow_user_page(new_page, old_page, address); 1580 cow_user_page(new_page, old_page, address, vma);
1581 } 1581 }
1582 1582
1583 /* 1583 /*
@@ -2200,7 +2200,7 @@ retry:
2200 page = alloc_page_vma(GFP_HIGHUSER, vma, address); 2200 page = alloc_page_vma(GFP_HIGHUSER, vma, address);
2201 if (!page) 2201 if (!page)
2202 goto oom; 2202 goto oom;
2203 copy_user_highpage(page, new_page, address); 2203 copy_user_highpage(page, new_page, address, vma);
2204 page_cache_release(new_page); 2204 page_cache_release(new_page);
2205 new_page = page; 2205 new_page = page;
2206 anon = 1; 2206 anon = 1;