Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 20313
b: refs/heads/master
c: 41d78ba
h: refs/heads/master
i:
  20311: 3ec4a14
v: v3
  • Loading branch information
Hugh Dickins authored and Linus Torvalds committed Feb 15, 2006
1 parent ec9080c commit c3e02c5
Show file tree
Hide file tree
Showing 4 changed files with 10 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: 7277232374680595cdbc774fd246b206f56db015
refs/heads/master: 41d78ba55037468e6c86c53e3076d1a74841de39
4 changes: 2 additions & 2 deletions trunk/mm/hugetlb.c
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ void free_huge_page(struct page *page)
BUG_ON(page_count(page));

INIT_LIST_HEAD(&page->lru);
page[1].mapping = NULL;
page[1].lru.next = NULL; /* reset dtor */

spin_lock(&hugetlb_lock);
enqueue_huge_page(page);
Expand All @@ -105,7 +105,7 @@ struct page *alloc_huge_page(struct vm_area_struct *vma, unsigned long addr)
}
spin_unlock(&hugetlb_lock);
set_page_count(page, 1);
page[1].mapping = (void *)free_huge_page;
page[1].lru.next = (void *)free_huge_page; /* set dtor */
for (i = 0; i < (HPAGE_SIZE/PAGE_SIZE); ++i)
clear_user_highpage(&page[i], addr);
return page;
Expand Down
15 changes: 6 additions & 9 deletions trunk/mm/page_alloc.c
Original file line number Diff line number Diff line change
Expand Up @@ -169,20 +169,17 @@ static void bad_page(struct page *page)
* All pages have PG_compound set. All pages have their ->private pointing at
* the head page (even the head page has this).
*
* The first tail page's ->mapping, if non-zero, holds the address of the
* compound page's put_page() function.
*
* The order of the allocation is stored in the first tail page's ->index
* This is only for debug at present. This usage means that zero-order pages
* may not be compound.
* The first tail page's ->lru.next holds the address of the compound page's
* put_page() function. Its ->lru.prev holds the order of allocation.
* This usage means that zero-order pages may not be compound.
*/
static void prep_compound_page(struct page *page, unsigned long order)
{
int i;
int nr_pages = 1 << order;

page[1].mapping = NULL;
page[1].index = order;
page[1].lru.next = NULL; /* set dtor */
page[1].lru.prev = (void *)order;
for (i = 0; i < nr_pages; i++) {
struct page *p = page + i;

Expand All @@ -196,7 +193,7 @@ static void destroy_compound_page(struct page *page, unsigned long order)
int i;
int nr_pages = 1 << order;

if (unlikely(page[1].index != order))
if (unlikely((unsigned long)page[1].lru.prev != order))
bad_page(page);

for (i = 0; i < nr_pages; i++) {
Expand Down
2 changes: 1 addition & 1 deletion trunk/mm/swap.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ static void put_compound_page(struct page *page)
if (put_page_testzero(page)) {
void (*dtor)(struct page *page);

dtor = (void (*)(struct page *))page[1].mapping;
dtor = (void (*)(struct page *))page[1].lru.next;
(*dtor)(page);
}
}
Expand Down

0 comments on commit c3e02c5

Please sign in to comment.