Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 329132
b: refs/heads/master
c: a00bb1e
h: refs/heads/master
v: v3
  • Loading branch information
Zhenzhong Duan authored and Konrad Rzeszutek Wilk committed Sep 21, 2012
1 parent 38489a2 commit 6092463
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 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: 15773b68fc5854e8890a8e251c568d583a540e4c
refs/heads/master: a00bb1e9fc0925c0061e9d844523a3a47a7e2f7f
9 changes: 7 additions & 2 deletions trunk/mm/frontswap.c
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,11 @@ static int __frontswap_unuse_pages(unsigned long total, unsigned long *unused,
return ret;
}

/*
* Used to check if it's necessory and feasible to unuse pages.
* Return 1 when nothing to do, 0 when need to shink pages,
* error code when there is an error.
*/
static int __frontswap_shrink(unsigned long target_pages,
unsigned long *pages_to_unuse,
int *type)
Expand All @@ -275,7 +280,7 @@ static int __frontswap_shrink(unsigned long target_pages,
if (total_pages <= target_pages) {
/* Nothing to do */
*pages_to_unuse = 0;
return 0;
return 1;
}
total_pages_to_unuse = total_pages - target_pages;
return __frontswap_unuse_pages(total_pages_to_unuse, pages_to_unuse, type);
Expand All @@ -302,7 +307,7 @@ void frontswap_shrink(unsigned long target_pages)
spin_lock(&swap_lock);
ret = __frontswap_shrink(target_pages, &pages_to_unuse, &type);
spin_unlock(&swap_lock);
if (ret == 0 && pages_to_unuse)
if (ret == 0)
try_to_unuse(type, true, pages_to_unuse);
return;
}
Expand Down

0 comments on commit 6092463

Please sign in to comment.