Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 338720
b: refs/heads/master
c: 377e4f1
h: refs/heads/master
v: v3
  • Loading branch information
Rabin Vincent authored and Linus Torvalds committed Dec 12, 2012
1 parent df1b992 commit 5020054
Show file tree
Hide file tree
Showing 2 changed files with 41 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: d0e1d66b5aa1ec9f556f951aa9a114cc192cd01c
refs/heads/master: 377e4f167664d8bc390c04c911d846366000159c
42 changes: 40 additions & 2 deletions trunk/mm/page_alloc.c
Original file line number Diff line number Diff line change
Expand Up @@ -2877,6 +2877,31 @@ bool skip_free_areas_node(unsigned int flags, int nid)

#define K(x) ((x) << (PAGE_SHIFT-10))

static void show_migration_types(unsigned char type)
{
static const char types[MIGRATE_TYPES] = {
[MIGRATE_UNMOVABLE] = 'U',
[MIGRATE_RECLAIMABLE] = 'E',
[MIGRATE_MOVABLE] = 'M',
[MIGRATE_RESERVE] = 'R',
#ifdef CONFIG_CMA
[MIGRATE_CMA] = 'C',
#endif
[MIGRATE_ISOLATE] = 'I',
};
char tmp[MIGRATE_TYPES + 1];
char *p = tmp;
int i;

for (i = 0; i < MIGRATE_TYPES; i++) {
if (type & (1 << i))
*p++ = types[i];
}

*p = '\0';
printk("(%s) ", tmp);
}

/*
* Show free area list (used inside shift_scroll-lock stuff)
* We also calculate the percentage fragmentation. We do this by counting the
Expand Down Expand Up @@ -3005,6 +3030,7 @@ void show_free_areas(unsigned int filter)

for_each_populated_zone(zone) {
unsigned long nr[MAX_ORDER], flags, order, total = 0;
unsigned char types[MAX_ORDER];

if (skip_free_areas_node(filter, zone_to_nid(zone)))
continue;
Expand All @@ -3013,12 +3039,24 @@ void show_free_areas(unsigned int filter)

spin_lock_irqsave(&zone->lock, flags);
for (order = 0; order < MAX_ORDER; order++) {
nr[order] = zone->free_area[order].nr_free;
struct free_area *area = &zone->free_area[order];
int type;

nr[order] = area->nr_free;
total += nr[order] << order;

types[order] = 0;
for (type = 0; type < MIGRATE_TYPES; type++) {
if (!list_empty(&area->free_list[type]))
types[order] |= 1 << type;
}
}
spin_unlock_irqrestore(&zone->lock, flags);
for (order = 0; order < MAX_ORDER; order++)
for (order = 0; order < MAX_ORDER; order++) {
printk("%lu*%lukB ", nr[order], K(1UL) << order);
if (nr[order])
show_migration_types(types[order]);
}
printk("= %lukB\n", K(total));
}

Expand Down

0 comments on commit 5020054

Please sign in to comment.