show_mem updates
Subsystems (13)
v2 cover show_mem updates
Hi,
the previous version has been posted [1] and there didn't seem to be any opposition so I am reposting it for inclusion. There was only one change and warn_alloc_show_mem does cpuset_print_current_mems_allowed now. Besides that acks have been added.
This is a mixture of one bug fix (patch 1), an enhancement (patch 2) and cleanups (the rest of the series). First two patches should be really straightforward. Patch 3 removes some arch specific show_mem implementations because I think they are quite outdated and do not really serve any useful purpose anymore. I think we should really strive to have a consistent show_mem output regardless of the architecture. If some architecture is really special and wants to dump something additional we should do that via an arch specific hook.
The last patch adds nodemask parameter so that we do not rely on the hardcoded mems_allowed of the current task when doing the node filtering. I consider this more a cleanup than a fix because basically all users use a nodemask which is a subset of mems_allowed. There is only one call path in the memory hotplug which doesn't comply with this but that is hardly something to worry about.
[1] http://lkml.kernel.org/r/[email protected]
This is on top of the current mmotm (mmotm-2016-12-19-16-31) tree . Michal Hocko (4):
mm, page_alloc: do not report all nodes in show_mem mm, page_alloc: warn_alloc print nodemask
arch, mm: remove arch specific show_mem lib/show_mem.c: teach show_mem to work with the given nodemask
arch/ia64/mm/init.c | 48 ------------------------------------ arch/parisc/mm/init.c | 49 ------------------------------------- arch/powerpc/xmon/xmon.c | 2 +- arch/sparc/kernel/setup_32.c | 2 +- arch/sparc/mm/init_32.c | 11 --------- arch/tile/mm/pgtable.c | 45 ---------------------------------- arch/unicore32/mm/init.c | 44 --------------------------------- drivers/net/ethernet/sgi/ioc3-eth.c | 2 +- drivers/tty/sysrq.c | 2 +- drivers/tty/vt/keyboard.c | 2 +- include/linux/mm.h | 9 +++---- lib/show_mem.c | 4 +-- mm/nommu.c | 6 ++--- mm/oom_kill.c | 2 +- mm/page_alloc.c | 49 ++++++++++++++++++++----------------- mm/vmalloc.c | 4 +-- 16 files changed, 44 insertions(+), 237 deletions(-)
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
PATCH v2 1/4 mm, page_alloc: do not report all nodes in show_mem
From: Michal Hocko <[email protected]>
599d0c954f91 ("mm, vmscan: move LRU lists to node") has added per numa node statistics to show_mem but it forgot to add skip_free_areas_node to fileter out nodes which are outside of the allocating task numa policy. Add this check to not pollute the output with the pointless information.
--- mm/page_alloc.c | 3 +++ 1 file changed, 3 insertions(+)
mm/page_alloc.c +3 -0
@@ -4345,6 +4345,9 @@ void show_free_areas(unsigned int filter) global_page_state(NR_FREE_CMA_PAGES));for_each_online_pgdat (pgdat) { +if (skip_free_areas_node (filter, pgdat->node_id)) +continue ; +printk ("Node %d" " active_anon:%lukB" " inactive_anon:%lukB"
Signature · 7 lines
2.11.0 -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Re: [PATCH 1/4] mm, page_alloc: do not report all nodes in show_mem
Quoted 9 lines · Michal Hocko
From: Michal Hocko <[email protected]>
599d0c954f91("mm, vmscan: move LRU lists to node") has added per numa node statistics toshow_membut it forgot to addskip_free_areas_nodeto fileter out nodes which are outside of the allocating task numa policy. Add this check to not pollute the output with the pointless information.
Quoted 4 lines
Acked-by Mel Gorman <[email protected]>Acked-by Johannes Weiner <[email protected]>Signed-off-by Michal Hocko <[email protected]>---
Quoted 18 lines
mm/page_alloc.c | 3 +++ 1 file changed, 3 insertions(+)mm/page_alloc.c +3
-1@@ -4345,6 +4345,9 @@ void show_free_areas(unsigned int filter) global_page_state(NR_FREE_CMA_PAGES));for_each_online_pgdat (pgdat) { +if (skip_free_areas_node (filter, pgdat->node_id)) +continue ; +printk ("Node %d" " active_anon:%lukB" " inactive_anon:%lukB" --
Quoted 1 line
2.11.0
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Re: [PATCH 1/4] mm, page_alloc: do not report all nodes in show_mem
In reply to Michal HockoQuoted 11 lines · Michal Hocko
From: Michal Hocko <[email protected]>
599d0c954f91("mm, vmscan: move LRU lists to node") has added per numa node statistics toshow_membut it forgot to addskip_free_areas_nodeto fileter out nodes which are outside of the allocating task numa policy. Add this check to not pollute the output with the pointless information.Acked-by Mel Gorman <[email protected]>Acked-by Johannes Weiner <[email protected]>Signed-off-by Michal Hocko <[email protected]>
s/fileter/filter/
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
PATCH v2 2/4 mm, page_alloc: warn_alloc print nodemask
In reply to Michal HockoFrom: Michal Hocko <[email protected]>
warn_alloc is currently used for to report an allocation failure or an allocation stall. We print some details of the allocation request like the gfp mask and the request order. We do not print the allocation nodemask which is important when debugging the reason for the allocation failure as well. We alreaddy print the nodemask in the OOM report.
Add nodemask to warn_alloc and print it in warn_alloc as well.
Changes since v1
- print cpusets as well - Vlastimil
--- include/linux/mm.h | 4 ++-- mm/page_alloc.c | 10 ++++++---- mm/vmalloc.c | 4 ++-- 3 files changed, 10 insertions(+), 8 deletions(-)
include/linux/mm.h +2 -2
@@ -1912,8 +1912,8 @@ extern void si_meminfo_node(struct sysinfo *val, int nid);extern unsigned long arch_reserved_kernel_pages (void );#endif -extern __printf(2, 3) -void warn_alloc(gfp_t gfp_mask, const char *fmt, ...); +extern __printf(3, 4) +void warn_alloc(gfp_t gfp_mask, nodemask_t *nodemask, const char *fmt, ...); extern void setup_per_cpu_pageset(void);
mm/page_alloc.c +6 -4
@@ -3031,12 +3031,13 @@ static void warn_alloc_show_mem(gfp_t gfp_mask)show_mem (filter); } -void warn_alloc (gfp_t gfp_mask,const char *fmt, ...) +void warn_alloc (gfp_t gfp_mask,nodemask_t *nodemask,const char *fmt, ...) {struct va_format vaf;va_list args; static DEFINE_RATELIMIT_STATE(nopage_rs, DEFAULT_RATELIMIT_INTERVAL, DEFAULT_RATELIMIT_BURST); +nodemask_t *nm = (nodemask) ? nodemask : &cpuset_current_mems_allowed;if ((gfp_mask & __GFP_NOWARN) || !__ratelimit (&nopage_rs) ||debug_guardpage_minorder () >0 )
@@ -3050,7 +3051,8 @@ void warn_alloc(gfp_t gfp_mask, const char *fmt, ...)pr_cont ("%pV" , &vaf);va_end (args); -pr_cont (", mode:%#x(%pGg)\n" , gfp_mask, &gfp_mask); +pr_cont (", mode:%#x(%pGg), nodemask=%*pbl\n" , gfp_mask, &gfp_mask,nodemask_pr_args (nm)); +cpuset_print_current_mems_allowed ();dump_stack ();warn_alloc_show_mem (gfp_mask);
@@ -3709,7 +3711,7 @@ __alloc_pages_slowpath(gfp_t gfp_mask, unsigned int order,/* Make sure we know about allocations which stall for too long */ if (time_after (jiffies, alloc_start + stall_timeout)) { -warn_alloc (gfp_mask, +warn_alloc (gfp_mask, ac->nodemask,"page allocation stalls for %ums, order:%u" ,jiffies_to_msecs (jiffies-alloc_start), order); stall_timeout +=10 *HZ ;
@@ -3743,7 +3745,7 @@ __alloc_pages_slowpath(gfp_t gfp_mask, unsigned int order, } nopage: -warn_alloc (gfp_mask, +warn_alloc (gfp_mask, ac->nodemask,"page allocation failure: order:%u" , order); got_pg:return page;
mm/vmalloc.c +2 -2
@@ -1662,7 +1662,7 @@ static void *__vmalloc_area_node(struct vm_struct *area, gfp_t gfp_mask,return area->addr; fail: -warn_alloc (gfp_mask, +warn_alloc (gfp_mask,NULL ,"vmalloc: allocation failure, allocated %ld of %ld bytes" , (area->nr_pages*PAGE_SIZE ), area->size);vfree (area->addr);
@@ -1724,7 +1724,7 @@ void *__vmalloc_node_range(unsigned long size, unsigned long align,return addr; fail: -warn_alloc (gfp_mask, +warn_alloc (gfp_mask,NULL ,"vmalloc: allocation failure: %lu bytes" , real_size);return NULL ; }
Signature · 7 lines
2.11.0 -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Re: [PATCH 2/4] mm, page_alloc: warn_alloc print nodemask
Quoted 9 lines · Michal Hocko
From: Michal Hocko <[email protected]>
warn_allocis currently used for to report an allocation failure or an allocation stall. We print some details of the allocation request like the gfp mask and the request order. We do not print the allocation nodemask which is important when debugging the reason for the allocation failure as well. We alreaddy print the nodemask in the OOM report.
Quoted 8 lines
Add nodemask to
warn_allocand print it inwarn_allocas well.Changes since v1
- print cpusets as well - VlastimilAcked-by Mel Gorman <[email protected]>Signed-off-by Michal Hocko <[email protected]>---
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
David Rientjes
reviewerRe: [PATCH 2/4] mm, page_alloc: warn_alloc print nodemask
In reply to Michal HockoQuoted 21 lines · Michal Hocko
include/linux/mm.h +2
-2@@ -1912,8 +1912,8 @@ extern void si_meminfo_node(struct sysinfo *val, int nid);extern unsigned long arch_reserved_kernel_pages (void );#endif -extern __printf(2, 3) -void warn_alloc(gfp_t gfp_mask, const char *fmt, ...); +extern __printf(3, 4) +void warn_alloc(gfp_t gfp_mask, nodemask_t *nodemask, const char *fmt, ...); extern void setup_per_cpu_pageset(void);mm/page_alloc.c +0
-0@@ -3031,12 +3031,13 @@ static void warn_alloc_show_mem(gfp_t gfp_mask)show_mem (filter);
mm/page_alloc.c static void warn_alloc_show_mem(gfp_t gfp_mask) · line 3040
Quoted 10 lines
mm/page_alloc.c +2
-1} -void warn_alloc (gfp_t gfp_mask,const char *fmt, ...) +void warn_alloc (gfp_t gfp_mask,nodemask_t *nodemask,const char *fmt, ...) {struct va_format vaf;va_list args; static DEFINE_RATELIMIT_STATE(nopage_rs, DEFAULT_RATELIMIT_INTERVAL, DEFAULT_RATELIMIT_BURST); +nodemask_t *nm = (nodemask) ? nodemask : &cpuset_current_mems_allowed;
Small nit: wouldn't it be helpful to know if ac->nodemask is actually NULL rather than setting it to cpuset_current_mems_allowed here? We know the effective nodemask from cpuset_print_current_mems_allowed(), but we don't know if there's a bug in the page allocator which is failing to set ac->nodemask appropriately if we blindly set it here when cpusets are not enabled.
Quoted 45 lines
mm/page_alloc.c +4
-3if ((gfp_mask & __GFP_NOWARN) || !__ratelimit (&nopage_rs) ||debug_guardpage_minorder () >0 )@@ -3050,7 +3051,8 @@ void warn_alloc(gfp_t gfp_mask, const char *fmt, ...)pr_cont ("%pV" , &vaf);va_end (args); -pr_cont (", mode:%#x(%pGg)\n" , gfp_mask, &gfp_mask); +pr_cont (", mode:%#x(%pGg), nodemask=%*pbl\n" , gfp_mask, &gfp_mask,nodemask_pr_args (nm)); +cpuset_print_current_mems_allowed ();dump_stack ();warn_alloc_show_mem (gfp_mask);@@ -3709,7 +3711,7 @@ __alloc_pages_slowpath(gfp_t gfp_mask, unsigned int order,/* Make sure we know about allocations which stall for too long */ if (time_after (jiffies, alloc_start + stall_timeout)) { -warn_alloc (gfp_mask, +warn_alloc (gfp_mask, ac->nodemask,"page allocation stalls for %ums, order:%u" ,jiffies_to_msecs (jiffies-alloc_start), order); stall_timeout +=10 *HZ ;@@ -3743,7 +3745,7 @@ __alloc_pages_slowpath(gfp_t gfp_mask, unsigned int order, } nopage: -warn_alloc (gfp_mask, +warn_alloc (gfp_mask, ac->nodemask,"page allocation failure: order:%u" , order); got_pg:return page;mm/vmalloc.c +1
-1@@ -1662,7 +1662,7 @@ static void *__vmalloc_area_node(struct vm_struct *area, gfp_t gfp_mask,return area->addr; fail: -warn_alloc (gfp_mask, +warn_alloc (gfp_mask,NULL ,"vmalloc: allocation failure, allocated %ld of %ld bytes" , (area->nr_pages*PAGE_SIZE ), area->size);vfree (area->addr);
mm/vmalloc.c void *__vmalloc_node_range(unsigned long size, unsigned long align, · line 1730
Quoted 8 lines
mm/vmalloc.c +1
-1@@ -1724,7 +1724,7 @@ void *__vmalloc_node_range(unsigned long size, unsigned long align,return addr; fail: -warn_alloc (gfp_mask, +warn_alloc (gfp_mask,NULL ,"vmalloc: allocation failure: %lu bytes" , real_size);return NULL ; }
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Re: [PATCH 2/4] mm, page_alloc: warn_alloc print nodemask
Quoted 25 lines · David Rientjes
Quoted 23 lines · Michal Hocko
include/linux/mm.h +2
-2@@ -1912,8 +1912,8 @@ extern void si_meminfo_node(struct sysinfo *val, int nid);extern unsigned long arch_reserved_kernel_pages (void );#endif -extern __printf(2, 3) -void warn_alloc(gfp_t gfp_mask, const char *fmt, ...); +extern __printf(3, 4) +void warn_alloc(gfp_t gfp_mask, nodemask_t *nodemask, const char *fmt, ...); extern void setup_per_cpu_pageset(void);mm/page_alloc.c +0
-0@@ -3031,12 +3031,13 @@ static void warn_alloc_show_mem(gfp_t gfp_mask)show_mem (filter); }
Quoted 15 lines
mm/page_alloc.c static void warn_alloc_show_mem(gfp_t gfp_mask) · line 3040
Quoted 8 lines
mm/page_alloc.c +2
-1-void warn_alloc (gfp_t gfp_mask,const char *fmt, ...) +void warn_alloc (gfp_t gfp_mask,nodemask_t *nodemask,const char *fmt, ...) {struct va_format vaf;va_list args; static DEFINE_RATELIMIT_STATE(nopage_rs, DEFAULT_RATELIMIT_INTERVAL, DEFAULT_RATELIMIT_BURST); +nodemask_t *nm = (nodemask) ? nodemask : &cpuset_current_mems_allowed;Small nit: wouldn't it be helpful to know if
ac->nodemaskis actually NULL rather than setting it tocpuset_current_mems_allowedhere? We know the effective nodemask fromcpuset_print_current_mems_allowed(), but we don't know if there's a bug in the page allocator which is failing to setac->nodemaskappropriately if we blindly set it here when cpusets are not enabled.
You are right that games with the nodemask are dangerous and can potentially lead to unexpected behavior. I wanted to make this code as simple as possible though and printing mems_allowed for NULL nodemask looked like the way. Feel free to post a patch to handle null nodemask in the output if you think it is an improvement.
Signature · 8 lines
Michal Hocko SUSE Labs -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
PATCH v2 3/4 arch, mm: remove arch specific show_mem
In reply to Michal HockoFrom: Michal Hocko <[email protected]>
We have a generic implementation for quite some time already. If there is any arch specific information to be printed then we should add a callback called from the generic code rather than duplicate the whole show_mem. The current code has resulted in the code duplication and the output divergence which is both confusing and adds maintainance costs. Let's just get rid of this mess.
--- arch/ia64/mm/init.c | 48 ----------------------------------------------- arch/parisc/mm/init.c | 49 ------------------------------------------------ arch/sparc/mm/init_32.c | 11 ----------- arch/tile/mm/pgtable.c | 45 -------------------------------------------- arch/unicore32/mm/init.c | 44 ------------------------------------------- 5 files changed, 197 deletions(-)
arch/ia64/mm/init.c +0 -48
@@ -684,51 +684,3 @@ int arch_remove_memory(u64 start, u64 size) }#endif #endif - -/** -* show_mem - give short summary of memory stats -* -* Shows a simple page count of reserved and used pages in the system. -* For discontig machines, it does this on a per-pgdat basis. -*/ -void show_mem (unsigned int filter) -{ -int total_reserved =0 ; -unsigned long total_present =0 ; -pg_data_t *pgdat; - -printk (KERN_INFO "Mem-info:\n" ); -show_free_areas (filter); -printk (KERN_INFO "Node memory in pages:\n" ); -for_each_online_pgdat (pgdat) { -unsigned long present; -unsigned long flags; -int reserved =0 ; -int nid = pgdat->node_id; -int zoneid; - -if (skip_free_areas_node (filter, nid)) -continue ; -pgdat_resize_lock (pgdat, &flags); - -for (zoneid =0 ; zoneid <MAX_NR_ZONES ; zoneid++) { -struct zone *zone = &pgdat->node_zones[zoneid]; -if (!populated_zone (zone)) -continue ; - - reserved += zone->present_pages - zone->managed_pages; - } - present = pgdat->node_present_pages; - -pgdat_resize_unlock (pgdat, &flags); - total_present += present; - total_reserved += reserved; -printk (KERN_INFO "Node %4d: RAM: %11ld, rsvd: %8d, " , - nid, present, reserved); - } -printk (KERN_INFO "%ld pages of RAM\n" , total_present); -printk (KERN_INFO "%d reserved pages\n" , total_reserved); -printk (KERN_INFO "Total of %ld pages in page table cache\n" , -quicklist_total_size ()); -printk (KERN_INFO "%ld free buffer pages\n" ,nr_free_buffer_pages ()); -}
arch/parisc/mm/init.c +0 -49
55 lines not on this page · raw message
arch/sparc/mm/init_32.c +0 -11
@@ -55,17 +55,6 @@ extern unsigned int sparc_ramdisk_size;unsigned long highstart_pfn, highend_pfn; -void show_mem (unsigned int filter) -{ -printk ("Mem-info:\n" ); -show_free_areas (filter); -printk ("Free swap: %6ldkB\n" , -get_nr_swap_pages () << (PAGE_SHIFT -10 )); -printk ("%ld pages of RAM\n" , totalram_pages); -printk ("%ld free pages\n" ,nr_free_pages ()); -} - -unsigned long last_valid_pfn;unsigned long calc_highpages (void )
arch/tile/mm/pgtable.c +0 -45
51 lines not on this page · raw message
arch/unicore32/mm/init.c +0 -44
50 lines not on this page · raw message
Signature · 1 line
2.11.0
PATCH v2 4/4 lib/show_mem.c: teach show_mem to work with the given nodemask
In reply to Michal HockoFrom: Michal Hocko <[email protected]>
show_mem() allows to filter out node specific data which is irrelevant to the allocation request via SHOW_MEM_FILTER_NODES. The filtering is done in skip_free_areas_node which skips all nodes which are not in the mems_allowed of the current process. This works most of the time as expected because the nodemask shouldn't be outside of the allocating task but there are some exceptions. E.g. memory hotplug might want to request allocations from outside of the allowed nodes (see new_node_page).
Get rid of this hardcoded behavior and push the allocation mask down the show_mem path and use it instead of cpuset_current_mems_allowed. NULL nodemask is interpreted as cpuset_current_mems_allowed.
--- arch/powerpc/xmon/xmon.c | 2 +- arch/sparc/kernel/setup_32.c | 2 +- drivers/net/ethernet/sgi/ioc3-eth.c | 2 +- drivers/tty/sysrq.c | 2 +- drivers/tty/vt/keyboard.c | 2 +- include/linux/mm.h | 5 ++--- lib/show_mem.c | 4 ++-- mm/nommu.c | 6 +++--- mm/oom_kill.c | 2 +- mm/page_alloc.c | 38 ++++++++++++++++++------------------- 10 files changed, 32 insertions(+), 33 deletions(-)
arch/powerpc/xmon/xmon.c +1 -1
@@ -913,7 +913,7 @@ cmds(struct pt_regs *excp)memzcan ();break ;case 'i' : -show_mem (0 ); +show_mem (0 ,NULL );break ;default : termch = cmd;
arch/sparc/kernel/setup_32.c +1 -1
@@ -82,7 +82,7 @@ static void prom_sync_me(void) "nop\n\t" : : "r" (&trapbase));prom_printf ("PROM SYNC COMMAND...\n" ); -show_free_areas (0 ); +show_free_areas (0 ,NULL );if (!is_idle_task (current)) {local_irq_enable ();sys_sync ();
drivers/net/ethernet/sgi/ioc3-eth.c +1 -1
@@ -914,7 +914,7 @@ static void ioc3_alloc_rings(struct net_device *dev) skb =ioc3_alloc_skb (RX_BUF_ALLOC_SIZE ,GFP_ATOMIC );if (!skb) { -show_free_areas (0 ); +show_free_areas (0 ,NULL );continue ; }
drivers/tty/sysrq.c +1 -1
@@ -317,7 +317,7 @@ static struct sysrq_key_op sysrq_ftrace_dump_op = {static void sysrq_handle_showmem (int key) { -show_mem (0 ); +show_mem (0 ,NULL ); }static struct sysrq_key_op sysrq_showmem_op = { .handler = sysrq_handle_showmem,
drivers/tty/vt/keyboard.c +1 -1
@@ -572,7 +572,7 @@ static void fn_scroll_back(struct vc_data *vc)static void fn_show_mem (struct vc_data *vc) { -show_mem (0 ); +show_mem (0 ,NULL ); }static void fn_show_state (struct vc_data *vc)
include/linux/mm.h +2 -3
@@ -1124,8 +1124,7 @@ extern void pagefault_out_of_memory(void);*/ #define SHOW_MEM_FILTER_NODES (0x0001u)/* disallowed nodes */ -extern void show_free_areas (unsigned int flags); -extern bool skip_free_areas_node (unsigned int flags,int nid); +extern void show_free_areas (unsigned int flags,nodemask_t *nodemask);int shmem_zero_setup (struct vm_area_struct *);#ifdef CONFIG_SHMEM
@@ -1904,7 +1903,7 @@ extern void setup_per_zone_wmarks(void);extern int __meminit init_per_zone_wmark_min (void );extern void mem_init (void );extern void __init mmap_init (void ); -extern void show_mem (unsigned int flags); +extern void show_mem (unsigned int flags,nodemask_t *nodemask);extern long si_mem_available (void );extern void si_meminfo (struct sysinfo * val);extern void si_meminfo_node (struct sysinfo *val,int nid);
lib/show_mem.c +2 -2
@@ -9,13 +9,13 @@#include <linux/quicklist.h> #include <linux/cma.h> -void show_mem (unsigned int filter) +void show_mem (unsigned int filter,nodemask_t *nodemask) {pg_data_t *pgdat;unsigned long total =0 , reserved =0 , highmem =0 ;printk ("Mem-Info:\n" ); -show_free_areas (filter); +show_free_areas (filter, nodemask);for_each_online_pgdat (pgdat) {unsigned long flags;
mm/nommu.c +3 -3
@@ -1191,7 +1191,7 @@ static int do_mmap_private(struct vm_area_struct *vma, enomem:pr_err ("Allocation of length %lu from process %d (%s) failed\n" , len, current->pid, current->comm); -show_free_areas (0 ); +show_free_areas (0 ,NULL );return -ENOMEM ; }
@@ -1412,13 +1412,13 @@ unsigned long do_mmap(struct file *file,kmem_cache_free (vm_region_jar, region);pr_warn ("Allocation of vma for %lu byte allocation from process %d failed\n" , len, current->pid); -show_free_areas (0 ); +show_free_areas (0 ,NULL );return -ENOMEM ; error_getting_region:pr_warn ("Allocation of vm region for %lu byte allocation from process %d failed\n" , len, current->pid); -show_free_areas (0 ); +show_free_areas (0 ,NULL );return -ENOMEM ; }
mm/oom_kill.c +1 -1
@@ -417,7 +417,7 @@ static void dump_header(struct oom_control *oc, struct task_struct *p)if (oc->memcg)mem_cgroup_print_oom_info (oc->memcg, p);else -show_mem (SHOW_MEM_FILTER_NODES ); +show_mem (SHOW_MEM_FILTER_NODES , nm);if (sysctl_oom_dump_tasks)dump_tasks (oc->memcg, oc->nodemask); }
mm/page_alloc.c +19 -19
@@ -3008,7 +3008,7 @@ static inline bool should_suppress_show_mem(void)return ret; } -static void warn_alloc_show_mem (gfp_t gfp_mask) +static void warn_alloc_show_mem (gfp_t gfp_mask,nodemask_t *nodemask) {unsigned int filter =SHOW_MEM_FILTER_NODES ; static DEFINE_RATELIMIT_STATE(show_mem_rs, HZ, 1);
@@ -3028,7 +3028,7 @@ static void warn_alloc_show_mem(gfp_t gfp_mask)if (in_interrupt () || !(gfp_mask & __GFP_DIRECT_RECLAIM)) filter &= ~SHOW_MEM_FILTER_NODES ; -show_mem (filter); +show_mem (filter, nodemask); }void warn_alloc (gfp_t gfp_mask,nodemask_t *nodemask,const char *fmt, ...)
@@ -3055,7 +3055,7 @@ void warn_alloc(gfp_t gfp_mask, nodemask_t *nodemask, const char *fmt, ...)cpuset_print_current_mems_allowed ();dump_stack (); -warn_alloc_show_mem (gfp_mask); +warn_alloc_show_mem (gfp_mask, nm); } static inline struct page *
@@ -4251,20 +4251,20 @@ void si_meminfo_node(struct sysinfo *val, int nid)* Determine whether the node should be displayed or not, depending on whether * SHOW_MEM_FILTER_NODES was passed to show_free_areas(). */ -bool skip_free_areas_node (unsigned int flags,int nid) +static bool show_mem_node_skip (unsigned int flags,int nid,nodemask_t *nodemask) { -bool ret = false; -unsigned int cpuset_mems_cookie; -if (!(flags &SHOW_MEM_FILTER_NODES )) - goto out; +return false; -do { - cpuset_mems_cookie =read_mems_allowed_begin (); - ret = !node_isset (nid, cpuset_current_mems_allowed); - }while (read_mems_allowed_retry (cpuset_mems_cookie)); -out: -return ret; +/* +* no node mask - aka implicit memory numa policy. Do not bother with the +* synchronization - read_mems_allowed_begin - because we do not have to be +* precise here. +*/ +if (!nodemask) + nodemask = &cpuset_current_mems_allowed; + +return !node_isset (nid, *nodemask); }#define K (x) ((x) << (PAGE_SHIFT-10))
@@ -4305,7 +4305,7 @@ static void show_migration_types(unsigned char type)* SHOW_MEM_FILTER_NODES: suppress nodes that are not allowed by current's * cpuset. */ -void show_free_areas (unsigned int filter) +void show_free_areas (unsigned int filter,nodemask_t *nodemask) {unsigned long free_pcp =0 ;int cpu;
@@ -4313,7 +4313,7 @@ void show_free_areas(unsigned int filter)pg_data_t *pgdat;for_each_populated_zone (zone) { -if (skip_free_areas_node (filter,zone_to_nid (zone))) +if (show_mem_node_skip (filter,zone_to_nid (zone), nodemask))continue ;for_each_online_cpu (cpu)
@@ -4347,7 +4347,7 @@ void show_free_areas(unsigned int filter) global_page_state(NR_FREE_CMA_PAGES));for_each_online_pgdat (pgdat) { -if (skip_free_areas_node (filter, pgdat->node_id)) +if (show_mem_node_skip (filter, pgdat->node_id, nodemask))continue ; printk("Node %d"
@@ -4399,7 +4399,7 @@ void show_free_areas(unsigned int filter)for_each_populated_zone (zone) {int i; -if (skip_free_areas_node (filter,zone_to_nid (zone))) +if (show_mem_node_skip (filter,zone_to_nid (zone), nodemask))continue ; free_pcp =0 ;
@@ -4464,7 +4464,7 @@ void show_free_areas(unsigned int filter)unsigned long nr[MAX_ORDER ], flags, total =0 ;unsigned char types[MAX_ORDER ]; -if (skip_free_areas_node (filter,zone_to_nid (zone))) +if (show_mem_node_skip (filter,zone_to_nid (zone), nodemask))continue ;show_node (zone);printk (KERN_CONT "%s: " , zone->name);
Signature · 7 lines
2.11.0 -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"[email protected]"> [email protected] </a>