Commit 6d3c546f authored by William Lee Irwin III's avatar William Lee Irwin III Committed by Linus Torvalds

[PATCH] beautify nr_free_pages()

nr_free_pages() is overly verbose. The following is perhaps clearer and
gets to the point with fewer lines of code and inside of 80 columns.
parent f6adf918
......@@ -502,16 +502,13 @@ void free_pages(unsigned long addr, unsigned int order)
*/
unsigned int nr_free_pages(void)
{
unsigned int sum;
zone_t *zone;
pg_data_t *pgdat = pgdat_list;
unsigned int i, sum = 0;
pg_data_t *pgdat;
for (pgdat = pgdat_list; pgdat; pgdat = pgdat->node_next)
for (i = 0; i < MAX_NR_ZONES; ++i)
sum += pgdat->node_zones[i].free_pages;
sum = 0;
while (pgdat) {
for (zone = pgdat->node_zones; zone < pgdat->node_zones + MAX_NR_ZONES; zone++)
sum += zone->free_pages;
pgdat = pgdat->node_next;
}
return sum;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment