diff options
Diffstat (limited to 'mm')
-rw-r--r-- | mm/memory.c | 29 |
1 files changed, 4 insertions, 25 deletions
diff --git a/mm/memory.c b/mm/memory.c index 622a4ef5409f..51f7c0a220d4 100644 --- a/mm/memory.c +++ b/mm/memory.c | |||
@@ -809,8 +809,7 @@ unsigned long zap_page_range(struct vm_area_struct *vma, unsigned long address, | |||
809 | * Do a quick page-table lookup for a single page. | 809 | * Do a quick page-table lookup for a single page. |
810 | * mm->page_table_lock must be held. | 810 | * mm->page_table_lock must be held. |
811 | */ | 811 | */ |
812 | static struct page *__follow_page(struct mm_struct *mm, unsigned long address, | 812 | struct page *follow_page(struct mm_struct *mm, unsigned long address, int write) |
813 | int read, int write, int accessed) | ||
814 | { | 813 | { |
815 | pgd_t *pgd; | 814 | pgd_t *pgd; |
816 | pud_t *pud; | 815 | pud_t *pud; |
@@ -846,16 +845,12 @@ static struct page *__follow_page(struct mm_struct *mm, unsigned long address, | |||
846 | if (pte_present(pte)) { | 845 | if (pte_present(pte)) { |
847 | if (write && !pte_write(pte)) | 846 | if (write && !pte_write(pte)) |
848 | goto out; | 847 | goto out; |
849 | if (read && !pte_read(pte)) | ||
850 | goto out; | ||
851 | pfn = pte_pfn(pte); | 848 | pfn = pte_pfn(pte); |
852 | if (pfn_valid(pfn)) { | 849 | if (pfn_valid(pfn)) { |
853 | page = pfn_to_page(pfn); | 850 | page = pfn_to_page(pfn); |
854 | if (accessed) { | 851 | if (write && !pte_dirty(pte) &&!PageDirty(page)) |
855 | if (write && !pte_dirty(pte) &&!PageDirty(page)) | 852 | set_page_dirty(page); |
856 | set_page_dirty(page); | 853 | mark_page_accessed(page); |
857 | mark_page_accessed(page); | ||
858 | } | ||
859 | return page; | 854 | return page; |
860 | } | 855 | } |
861 | } | 856 | } |
@@ -864,22 +859,6 @@ out: | |||
864 | return NULL; | 859 | return NULL; |
865 | } | 860 | } |
866 | 861 | ||
867 | inline struct page * | ||
868 | follow_page(struct mm_struct *mm, unsigned long address, int write) | ||
869 | { | ||
870 | return __follow_page(mm, address, 0, write, 1); | ||
871 | } | ||
872 | |||
873 | /* | ||
874 | * check_user_page_readable() can be called frm niterrupt context by oprofile, | ||
875 | * so we need to avoid taking any non-irq-safe locks | ||
876 | */ | ||
877 | int check_user_page_readable(struct mm_struct *mm, unsigned long address) | ||
878 | { | ||
879 | return __follow_page(mm, address, 1, 0, 0) != NULL; | ||
880 | } | ||
881 | EXPORT_SYMBOL(check_user_page_readable); | ||
882 | |||
883 | static inline int | 862 | static inline int |
884 | untouched_anonymous_page(struct mm_struct* mm, struct vm_area_struct *vma, | 863 | untouched_anonymous_page(struct mm_struct* mm, struct vm_area_struct *vma, |
885 | unsigned long address) | 864 | unsigned long address) |