Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 5126
b: refs/heads/master
c: 1aaf18f
h: refs/heads/master
v: v3
  • Loading branch information
Andrew Morton authored and Linus Torvalds committed Jul 27, 2005
1 parent daa02ef commit 21b38c0
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 11 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 0cfc11ed45e4c00750039e5a18c0fc0d681e19db
refs/heads/master: 1aaf18ff9de1f37bf674236fc0779c3aaa65b998
25 changes: 15 additions & 10 deletions trunk/mm/memory.c
Original file line number Diff line number Diff line change
Expand Up @@ -776,8 +776,8 @@ unsigned long zap_page_range(struct vm_area_struct *vma, unsigned long address,
* Do a quick page-table lookup for a single page.
* mm->page_table_lock must be held.
*/
static struct page *
__follow_page(struct mm_struct *mm, unsigned long address, int read, int write)
static struct page *__follow_page(struct mm_struct *mm, unsigned long address,
int read, int write, int accessed)
{
pgd_t *pgd;
pud_t *pud;
Expand Down Expand Up @@ -818,9 +818,11 @@ __follow_page(struct mm_struct *mm, unsigned long address, int read, int write)
pfn = pte_pfn(pte);
if (pfn_valid(pfn)) {
page = pfn_to_page(pfn);
if (write && !pte_dirty(pte) && !PageDirty(page))
set_page_dirty(page);
mark_page_accessed(page);
if (accessed) {
if (write && !pte_dirty(pte) &&!PageDirty(page))
set_page_dirty(page);
mark_page_accessed(page);
}
return page;
}
}
Expand All @@ -829,16 +831,19 @@ __follow_page(struct mm_struct *mm, unsigned long address, int read, int write)
return NULL;
}

struct page *
inline struct page *
follow_page(struct mm_struct *mm, unsigned long address, int write)
{
return __follow_page(mm, address, /*read*/0, write);
return __follow_page(mm, address, 0, write, 1);
}

int
check_user_page_readable(struct mm_struct *mm, unsigned long address)
/*
* check_user_page_readable() can be called frm niterrupt context by oprofile,
* so we need to avoid taking any non-irq-safe locks
*/
int check_user_page_readable(struct mm_struct *mm, unsigned long address)
{
return __follow_page(mm, address, /*read*/1, /*write*/0) != NULL;
return __follow_page(mm, address, 1, 0, 0) != NULL;
}
EXPORT_SYMBOL(check_user_page_readable);

Expand Down

0 comments on commit 21b38c0

Please sign in to comment.