Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 299104
b: refs/heads/master
c: f4477e9
h: refs/heads/master
v: v3
  • Loading branch information
Nitin Gupta authored and Greg Kroah-Hartman committed Apr 10, 2012
1 parent 60e18ed commit 691893b
Show file tree
Hide file tree
Showing 2 changed files with 19 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: 3fd654c22c7b002e8681accaed50a6d46656d815
refs/heads/master: f4477e90b3ea4c40466e8f418cf41a17aef09192
30 changes: 18 additions & 12 deletions trunk/drivers/staging/zsmalloc/zsmalloc-main.c
Original file line number Diff line number Diff line change
Expand Up @@ -267,33 +267,39 @@ static unsigned long obj_idx_to_offset(struct page *page,
return off + obj_idx * class_size;
}

static void reset_page(struct page *page)
{
clear_bit(PG_private, &page->flags);
clear_bit(PG_private_2, &page->flags);
set_page_private(page, 0);
page->mapping = NULL;
page->freelist = NULL;
reset_page_mapcount(page);
}

static void free_zspage(struct page *first_page)
{
struct page *nextp, *tmp;
struct page *nextp, *tmp, *head_extra;

BUG_ON(!is_first_page(first_page));
BUG_ON(first_page->inuse);

nextp = (struct page *)page_private(first_page);
head_extra = (struct page *)page_private(first_page);

clear_bit(PG_private, &first_page->flags);
clear_bit(PG_private_2, &first_page->flags);
set_page_private(first_page, 0);
first_page->mapping = NULL;
first_page->freelist = NULL;
reset_page_mapcount(first_page);
reset_page(first_page);
__free_page(first_page);

/* zspage with only 1 system page */
if (!nextp)
if (!head_extra)
return;

list_for_each_entry_safe(nextp, tmp, &nextp->lru, lru) {
list_for_each_entry_safe(nextp, tmp, &head_extra->lru, lru) {
list_del(&nextp->lru);
clear_bit(PG_private_2, &nextp->flags);
nextp->index = 0;
reset_page(nextp);
__free_page(nextp);
}
reset_page(head_extra);
__free_page(head_extra);
}

/* Initialize a newly allocated zspage */
Expand Down

0 comments on commit 691893b

Please sign in to comment.