Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 176316
b: refs/heads/master
c: 4f16fc1
h: refs/heads/master
v: v3
  • Loading branch information
Naoya Horiguchi authored and Linus Torvalds committed Dec 15, 2009
1 parent b4b9ed5 commit 60b08cf
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 536240f2bde98216feac87b4891d19a536b8884a
refs/heads/master: 4f16fc107d9c9b8a72aa19b189a9216e90a7aaef
37 changes: 37 additions & 0 deletions trunk/mm/mincore.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
#include <linux/syscalls.h>
#include <linux/swap.h>
#include <linux/swapops.h>
#include <linux/hugetlb.h>

#include <asm/uaccess.h>
#include <asm/pgtable.h>
Expand Down Expand Up @@ -72,6 +73,42 @@ static long do_mincore(unsigned long addr, unsigned char *vec, unsigned long pag
if (!vma || addr < vma->vm_start)
return -ENOMEM;

#ifdef CONFIG_HUGETLB_PAGE
if (is_vm_hugetlb_page(vma)) {
struct hstate *h;
unsigned long nr_huge;
unsigned char present;

i = 0;
nr = min(pages, (vma->vm_end - addr) >> PAGE_SHIFT);
h = hstate_vma(vma);
nr_huge = ((addr + pages * PAGE_SIZE - 1) >> huge_page_shift(h))
- (addr >> huge_page_shift(h)) + 1;
nr_huge = min(nr_huge,
(vma->vm_end - addr) >> huge_page_shift(h));
while (1) {
/* hugepage always in RAM for now,
* but generally it needs to be check */
ptep = huge_pte_offset(current->mm,
addr & huge_page_mask(h));
present = !!(ptep &&
!huge_pte_none(huge_ptep_get(ptep)));
while (1) {
vec[i++] = present;
addr += PAGE_SIZE;
/* reach buffer limit */
if (i == nr)
return nr;
/* check hugepage border */
if (!((addr & ~huge_page_mask(h))
>> PAGE_SHIFT))
break;
}
}
return nr;
}
#endif

/*
* Calculate how many pages there are left in the last level of the
* PTE array for our address.
Expand Down

0 comments on commit 60b08cf

Please sign in to comment.