Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 22495
b: refs/heads/master
c: d5d4b0a
h: refs/heads/master
i:
  22493: efeed54
  22491: e543fe7
  22487: 499fe09
  22479: 52afa3e
  22463: e247280
v: v3
  • Loading branch information
Chen, Kenneth W authored and Linus Torvalds committed Mar 22, 2006
1 parent ad1dca1 commit b4b9df5
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 9 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: bba1e9b2111b14625f670bd07e57fd7ed57ce804
refs/heads/master: d5d4b0aa4e1430d73050babba999365593bdb9d2
25 changes: 17 additions & 8 deletions trunk/mm/hugetlb.c
Original file line number Diff line number Diff line change
Expand Up @@ -661,10 +661,10 @@ int follow_hugetlb_page(struct mm_struct *mm, struct vm_area_struct *vma,
struct page **pages, struct vm_area_struct **vmas,
unsigned long *position, int *length, int i)
{
unsigned long vpfn, vaddr = *position;
unsigned long pfn_offset;
unsigned long vaddr = *position;
int remainder = *length;

vpfn = vaddr/PAGE_SIZE;
spin_lock(&mm->page_table_lock);
while (vaddr < vma->vm_end && remainder) {
pte_t *pte;
Expand Down Expand Up @@ -692,19 +692,28 @@ int follow_hugetlb_page(struct mm_struct *mm, struct vm_area_struct *vma,
break;
}

if (pages) {
page = &pte_page(*pte)[vpfn % (HPAGE_SIZE/PAGE_SIZE)];
get_page(page);
pages[i] = page;
}
pfn_offset = (vaddr & ~HPAGE_MASK) >> PAGE_SHIFT;
page = pte_page(*pte);
same_page:
get_page(page);
if (pages)
pages[i] = page + pfn_offset;

if (vmas)
vmas[i] = vma;

vaddr += PAGE_SIZE;
++vpfn;
++pfn_offset;
--remainder;
++i;
if (vaddr < vma->vm_end && remainder &&
pfn_offset < HPAGE_SIZE/PAGE_SIZE) {
/*
* We use pfn_offset to avoid touching the pageframes
* of this compound page.
*/
goto same_page;
}
}
spin_unlock(&mm->page_table_lock);
*length = remainder;
Expand Down

0 comments on commit b4b9df5

Please sign in to comment.