Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 2467
b: refs/heads/master
c: 08ef472
h: refs/heads/master
i:
  2465: 46712b3
  2463: bd0ee89
v: v3
  • Loading branch information
Hugh Dickins authored and Linus Torvalds committed Jun 22, 2005
1 parent d66b286 commit d63e9d4
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 36 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: 7c2f3fda5666c280bcd00ac3b86963270b23e796
refs/heads/master: 08ef472937e918875a82fd350d3de138aac50414
45 changes: 10 additions & 35 deletions trunk/mm/memory.c
Original file line number Diff line number Diff line change
Expand Up @@ -840,23 +840,8 @@ check_user_page_readable(struct mm_struct *mm, unsigned long address)
{
return __follow_page(mm, address, /*read*/1, /*write*/0) != NULL;
}

EXPORT_SYMBOL(check_user_page_readable);

/*
* Given a physical address, is there a useful struct page pointing to
* it? This may become more complex in the future if we start dealing
* with IO-aperture pages for direct-IO.
*/

static inline struct page *get_page_map(struct page *page)
{
if (!pfn_valid(page_to_pfn(page)))
return NULL;
return page;
}


static inline int
untouched_anonymous_page(struct mm_struct* mm, struct vm_area_struct *vma,
unsigned long address)
Expand Down Expand Up @@ -887,7 +872,6 @@ untouched_anonymous_page(struct mm_struct* mm, struct vm_area_struct *vma,
return 0;
}


int get_user_pages(struct task_struct *tsk, struct mm_struct *mm,
unsigned long start, int len, int write, int force,
struct page **pages, struct vm_area_struct **vmas)
Expand Down Expand Up @@ -951,21 +935,21 @@ int get_user_pages(struct task_struct *tsk, struct mm_struct *mm,
}
spin_lock(&mm->page_table_lock);
do {
struct page *map;
struct page *page;
int lookup_write = write;

cond_resched_lock(&mm->page_table_lock);
while (!(map = follow_page(mm, start, lookup_write))) {
while (!(page = follow_page(mm, start, lookup_write))) {
/*
* Shortcut for anonymous pages. We don't want
* to force the creation of pages tables for
* insanly big anonymously mapped areas that
* insanely big anonymously mapped areas that
* nobody touched so far. This is important
* for doing a core dump for these mappings.
*/
if (!lookup_write &&
untouched_anonymous_page(mm,vma,start)) {
map = ZERO_PAGE(start);
page = ZERO_PAGE(start);
break;
}
spin_unlock(&mm->page_table_lock);
Expand Down Expand Up @@ -994,30 +978,21 @@ int get_user_pages(struct task_struct *tsk, struct mm_struct *mm,
spin_lock(&mm->page_table_lock);
}
if (pages) {
pages[i] = get_page_map(map);
if (!pages[i]) {
spin_unlock(&mm->page_table_lock);
while (i--)
page_cache_release(pages[i]);
i = -EFAULT;
goto out;
}
flush_dcache_page(pages[i]);
if (!PageReserved(pages[i]))
page_cache_get(pages[i]);
pages[i] = page;
flush_dcache_page(page);
if (!PageReserved(page))
page_cache_get(page);
}
if (vmas)
vmas[i] = vma;
i++;
start += PAGE_SIZE;
len--;
} while(len && start < vma->vm_end);
} while (len && start < vma->vm_end);
spin_unlock(&mm->page_table_lock);
} while(len);
out:
} while (len);
return i;
}

EXPORT_SYMBOL(get_user_pages);

static int zeromap_pte_range(struct mm_struct *mm, pmd_t *pmd,
Expand Down

0 comments on commit d63e9d4

Please sign in to comment.