Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 273225
b: refs/heads/master
c: 220a2eb
h: refs/heads/master
i:
  273223: c8c663e
v: v3
  • Loading branch information
Andrea Arcangeli authored and Linus Torvalds committed Nov 2, 2011
1 parent a81dc4a commit d0112ad
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 2 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: cf592bf768c4fa40282b8fce58a80820065de2cb
refs/heads/master: 220a2eb228d032acde60e9fd044ca802706ff583
24 changes: 23 additions & 1 deletion trunk/arch/s390/mm/gup.c
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,22 @@ static inline int gup_pte_range(pmd_t *pmdp, pmd_t pmd, unsigned long addr,
return 1;
}

static inline void get_huge_page_tail(struct page *page)
{
/*
* __split_huge_page_refcount() cannot run
* from under us.
*/
VM_BUG_ON(page_mapcount(page) < 0);
VM_BUG_ON(atomic_read(&page->_count) != 0);
atomic_inc(&page->_mapcount);
}

static inline int gup_huge_pmd(pmd_t *pmdp, pmd_t pmd, unsigned long addr,
unsigned long end, int write, struct page **pages, int *nr)
{
unsigned long mask, result;
struct page *head, *page;
struct page *head, *page, *tail;
int refs;

result = write ? 0 : _SEGMENT_ENTRY_RO;
Expand All @@ -64,6 +75,7 @@ static inline int gup_huge_pmd(pmd_t *pmdp, pmd_t pmd, unsigned long addr,
refs = 0;
head = pmd_page(pmd);
page = head + ((addr & ~PMD_MASK) >> PAGE_SHIFT);
tail = page;
do {
VM_BUG_ON(compound_head(page) != head);
pages[*nr] = page;
Expand All @@ -81,6 +93,16 @@ static inline int gup_huge_pmd(pmd_t *pmdp, pmd_t pmd, unsigned long addr,
*nr -= refs;
while (refs--)
put_page(head);
} else {
/*
* Any tail page need their mapcount reference taken
* before we return.
*/
while (refs--) {
if (PageTail(tail))
get_huge_page_tail(tail);
tail++;
}
}

return 1;
Expand Down

0 comments on commit d0112ad

Please sign in to comment.