aboutsummaryrefslogtreecommitdiffstats
path: root/mm/page_alloc.c
diff options
context:
space:
mode:
Diffstat (limited to 'mm/page_alloc.c')
-rw-r--r--mm/page_alloc.c34
1 files changed, 33 insertions, 1 deletions
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index 7945247b1e53..36be3ba4bbed 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -2411,19 +2411,42 @@ void si_meminfo_node(struct sysinfo *val, int nid)
2411} 2411}
2412#endif 2412#endif
2413 2413
2414/*
2415 * Determine whether the zone's node should be displayed or not, depending on
2416 * whether SHOW_MEM_FILTER_NODES was passed to __show_free_areas().
2417 */
2418static bool skip_free_areas_zone(unsigned int flags, const struct zone *zone)
2419{
2420 bool ret = false;
2421
2422 if (!(flags & SHOW_MEM_FILTER_NODES))
2423 goto out;
2424
2425 get_mems_allowed();
2426 ret = !node_isset(zone->zone_pgdat->node_id,
2427 cpuset_current_mems_allowed);
2428 put_mems_allowed();
2429out:
2430 return ret;
2431}
2432
2414#define K(x) ((x) << (PAGE_SHIFT-10)) 2433#define K(x) ((x) << (PAGE_SHIFT-10))
2415 2434
2416/* 2435/*
2417 * Show free area list (used inside shift_scroll-lock stuff) 2436 * Show free area list (used inside shift_scroll-lock stuff)
2418 * We also calculate the percentage fragmentation. We do this by counting the 2437 * We also calculate the percentage fragmentation. We do this by counting the
2419 * memory on each free list with the exception of the first item on the list. 2438 * memory on each free list with the exception of the first item on the list.
2439 * Suppresses nodes that are not allowed by current's cpuset if
2440 * SHOW_MEM_FILTER_NODES is passed.
2420 */ 2441 */
2421void show_free_areas(void) 2442void __show_free_areas(unsigned int filter)
2422{ 2443{
2423 int cpu; 2444 int cpu;
2424 struct zone *zone; 2445 struct zone *zone;
2425 2446
2426 for_each_populated_zone(zone) { 2447 for_each_populated_zone(zone) {
2448 if (skip_free_areas_zone(filter, zone))
2449 continue;
2427 show_node(zone); 2450 show_node(zone);
2428 printk("%s per-cpu:\n", zone->name); 2451 printk("%s per-cpu:\n", zone->name);
2429 2452
@@ -2465,6 +2488,8 @@ void show_free_areas(void)
2465 for_each_populated_zone(zone) { 2488 for_each_populated_zone(zone) {
2466 int i; 2489 int i;
2467 2490
2491 if (skip_free_areas_zone(filter, zone))
2492 continue;
2468 show_node(zone); 2493 show_node(zone);
2469 printk("%s" 2494 printk("%s"
2470 " free:%lukB" 2495 " free:%lukB"
@@ -2532,6 +2557,8 @@ void show_free_areas(void)
2532 for_each_populated_zone(zone) { 2557 for_each_populated_zone(zone) {
2533 unsigned long nr[MAX_ORDER], flags, order, total = 0; 2558 unsigned long nr[MAX_ORDER], flags, order, total = 0;
2534 2559
2560 if (skip_free_areas_zone(filter, zone))
2561 continue;
2535 show_node(zone); 2562 show_node(zone);
2536 printk("%s: ", zone->name); 2563 printk("%s: ", zone->name);
2537 2564
@@ -2551,6 +2578,11 @@ void show_free_areas(void)
2551 show_swap_cache_info(); 2578 show_swap_cache_info();
2552} 2579}
2553 2580
2581void show_free_areas(void)
2582{
2583 __show_free_areas(0);
2584}
2585
2554static void zoneref_set_zone(struct zone *zone, struct zoneref *zoneref) 2586static void zoneref_set_zone(struct zone *zone, struct zoneref *zoneref)
2555{ 2587{
2556 zoneref->zone = zone; 2588 zoneref->zone = zone;