Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 73698
b: refs/heads/master
c: 2fc39ce
h: refs/heads/master
v: v3
  • Loading branch information
Adam Litke authored and Linus Torvalds committed Nov 15, 2007
1 parent 19ad9bc commit 784dca2
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 13 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: c79fb75e5a514a5a35f22c229042aa29f4237e3a
refs/heads/master: 2fc39cec6a9b5b41727d3386b780b69422a15152
24 changes: 12 additions & 12 deletions trunk/mm/hugetlb.c
Original file line number Diff line number Diff line change
Expand Up @@ -388,16 +388,21 @@ static struct page *alloc_huge_page(struct vm_area_struct *vma,
unsigned long addr)
{
struct page *page;
struct address_space *mapping = vma->vm_file->f_mapping;

if (hugetlb_get_quota(mapping))
return ERR_PTR(-VM_FAULT_SIGBUS);

if (vma->vm_flags & VM_MAYSHARE)
page = alloc_huge_page_shared(vma, addr);
else
page = alloc_huge_page_private(vma, addr);
if (page) {
set_page_refcounted(page);
set_page_private(page, (unsigned long) vma->vm_file->f_mapping);
}
return page;
set_page_private(page, (unsigned long) mapping);
return page;
} else
return ERR_PTR(-VM_FAULT_OOM);
}

static int __init hugetlb_init(void)
Expand Down Expand Up @@ -737,15 +742,13 @@ static int hugetlb_cow(struct mm_struct *mm, struct vm_area_struct *vma,
set_huge_ptep_writable(vma, address, ptep);
return 0;
}
if (hugetlb_get_quota(vma->vm_file->f_mapping))
return VM_FAULT_SIGBUS;

page_cache_get(old_page);
new_page = alloc_huge_page(vma, address);

if (!new_page) {
if (IS_ERR(new_page)) {
page_cache_release(old_page);
return VM_FAULT_OOM;
return -PTR_ERR(new_page);
}

spin_unlock(&mm->page_table_lock);
Expand Down Expand Up @@ -789,12 +792,9 @@ static int hugetlb_no_page(struct mm_struct *mm, struct vm_area_struct *vma,
size = i_size_read(mapping->host) >> HPAGE_SHIFT;
if (idx >= size)
goto out;
if (hugetlb_get_quota(mapping))
goto out;
page = alloc_huge_page(vma, address);
if (!page) {
hugetlb_put_quota(mapping);
ret = VM_FAULT_OOM;
if (IS_ERR(page)) {
ret = -PTR_ERR(page);
goto out;
}
clear_huge_page(page, address);
Expand Down

0 comments on commit 784dca2

Please sign in to comment.