Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 164464
b: refs/heads/master
c: a6f9edd
h: refs/heads/master
v: v3
  • Loading branch information
Mel Gorman authored and Linus Torvalds committed Sep 22, 2009
1 parent f773c7b commit a886499
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 10 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: 5f8dcc21211a3d4e3a7a5ca366b469fb88117f61
refs/heads/master: a6f9edd65beaef24836e8934c8912c1e974dd45c
24 changes: 15 additions & 9 deletions trunk/mm/page_alloc.c
Original file line number Diff line number Diff line change
Expand Up @@ -525,32 +525,38 @@ static void free_pcppages_bulk(struct zone *zone, int count,
struct per_cpu_pages *pcp)
{
int migratetype = 0;
int batch_free = 0;

spin_lock(&zone->lock);
zone_clear_flag(zone, ZONE_ALL_UNRECLAIMABLE);
zone->pages_scanned = 0;

__mod_zone_page_state(zone, NR_FREE_PAGES, count);
while (count--) {
while (count) {
struct page *page;
struct list_head *list;

/*
* Remove pages from lists in a round-robin fashion. This spinning
* around potentially empty lists is bloody awful, alternatives that
* don't suck are welcome
* Remove pages from lists in a round-robin fashion. A
* batch_free count is maintained that is incremented when an
* empty list is encountered. This is so more pages are freed
* off fuller lists instead of spinning excessively around empty
* lists
*/
do {
batch_free++;
if (++migratetype == MIGRATE_PCPTYPES)
migratetype = 0;
list = &pcp->lists[migratetype];
} while (list_empty(list));

page = list_entry(list->prev, struct page, lru);
/* have to delete it as __free_one_page list manipulates */
list_del(&page->lru);
trace_mm_page_pcpu_drain(page, 0, migratetype);
__free_one_page(page, zone, 0, migratetype);
do {
page = list_entry(list->prev, struct page, lru);
/* must delete as __free_one_page list manipulates */
list_del(&page->lru);
__free_one_page(page, zone, 0, migratetype);
trace_mm_page_pcpu_drain(page, 0, migratetype);
} while (--count && --batch_free && !list_empty(list));
}
spin_unlock(&zone->lock);
}
Expand Down

0 comments on commit a886499

Please sign in to comment.