linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [patch] mm, hugetlb: include hugepages in meminfo
@ 2013-03-20  0:18 David Rientjes
  2013-03-20  9:53 ` Michal Hocko
  2013-03-20 19:07 ` [patch v2] " David Rientjes
  0 siblings, 2 replies; 8+ messages in thread
From: David Rientjes @ 2013-03-20  0:18 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linux-kernel, linux-mm

Particularly in oom conditions, it's troublesome that hugetlb memory is 
not displayed.  All other meminfo that is emitted will not add up to what 
is expected, and there is no artifact left in the kernel log to show that 
a potentially significant amount of memory is actually allocated as 
hugepages which are not available to be reclaimed.

Booting with hugepages=8192 on the command line, this memory is now shown 
in oom conditions.  For example, with echo m > /proc/sysrq-trigger:

Node 0 hugepages_total=2048 hugepages_free=2048 hugepages_surp=0 hugepages_size=2048kB
Node 1 hugepages_total=2048 hugepages_free=2048 hugepages_surp=0 hugepages_size=2048kB
Node 2 hugepages_total=2048 hugepages_free=2048 hugepages_surp=0 hugepages_size=2048kB
Node 3 hugepages_total=2048 hugepages_free=2048 hugepages_surp=0 hugepages_size=2048kB

Signed-off-by: David Rientjes <rientjes@google.com>
---
 include/linux/hugetlb.h |  4 ++++
 mm/hugetlb.c            | 14 ++++++++++++++
 mm/page_alloc.c         |  3 +++
 3 files changed, 21 insertions(+)

diff --git a/include/linux/hugetlb.h b/include/linux/hugetlb.h
--- a/include/linux/hugetlb.h
+++ b/include/linux/hugetlb.h
@@ -58,6 +58,7 @@ void __unmap_hugepage_range(struct mmu_gather *tlb, struct vm_area_struct *vma,
 int hugetlb_prefault(struct address_space *, struct vm_area_struct *);
 void hugetlb_report_meminfo(struct seq_file *);
 int hugetlb_report_node_meminfo(int, char *);
+void hugetlb_show_meminfo(void);
 unsigned long hugetlb_total_pages(void);
 int hugetlb_fault(struct mm_struct *mm, struct vm_area_struct *vma,
 			unsigned long address, unsigned int flags);
@@ -114,6 +115,9 @@ static inline void hugetlb_report_meminfo(struct seq_file *m)
 {
 }
 #define hugetlb_report_node_meminfo(n, buf)	0
+static inline void hugetlb_show_meminfo(void)
+{
+}
 #define follow_huge_pmd(mm, addr, pmd, write)	NULL
 #define follow_huge_pud(mm, addr, pud, write)	NULL
 #define prepare_hugepage_range(file, addr, len)	(-EINVAL)
diff --git a/mm/hugetlb.c b/mm/hugetlb.c
--- a/mm/hugetlb.c
+++ b/mm/hugetlb.c
@@ -2121,6 +2121,20 @@ int hugetlb_report_node_meminfo(int nid, char *buf)
 		nid, h->surplus_huge_pages_node[nid]);
 }
 
+void hugetlb_show_meminfo(void)
+{
+	struct hstate *h = &default_hstate;
+	int nid;
+
+	for_each_node_state(nid, N_MEMORY)
+		pr_info("Node %d hugepages_total=%u hugepages_free=%u hugepages_surp=%u hugepages_size=%lukB\n",
+		        nid,
+			h->nr_huge_pages_node[nid],
+			h->free_huge_pages_node[nid],
+			h->surplus_huge_pages_node[nid],
+			1UL << (huge_page_order(h) + PAGE_SHIFT - 10));
+}
+
 /* Return the number pages of memory we physically have, in PAGE_SIZE units. */
 unsigned long hugetlb_total_pages(void)
 {
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -58,6 +58,7 @@
 #include <linux/prefetch.h>
 #include <linux/migrate.h>
 #include <linux/page-debug-flags.h>
+#include <linux/hugetlb.h>
 #include <linux/sched/rt.h>
 
 #include <asm/tlbflush.h>
@@ -3105,6 +3106,8 @@ void show_free_areas(unsigned int filter)
 		printk("= %lukB\n", K(total));
 	}
 
+	hugetlb_show_meminfo();
+
 	printk("%ld total pagecache pages\n", global_page_state(NR_FILE_PAGES));
 
 	show_swap_cache_info();

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [patch] mm, hugetlb: include hugepages in meminfo
  2013-03-20  0:18 [patch] mm, hugetlb: include hugepages in meminfo David Rientjes
@ 2013-03-20  9:53 ` Michal Hocko
  2013-03-20 18:46   ` David Rientjes
  2013-03-20 19:07 ` [patch v2] " David Rientjes
  1 sibling, 1 reply; 8+ messages in thread
From: Michal Hocko @ 2013-03-20  9:53 UTC (permalink / raw)
  To: David Rientjes; +Cc: Andrew Morton, linux-kernel, linux-mm

On Tue 19-03-13 17:18:12, David Rientjes wrote:
> Particularly in oom conditions, it's troublesome that hugetlb memory is 
> not displayed.  All other meminfo that is emitted will not add up to what 
> is expected, and there is no artifact left in the kernel log to show that 
> a potentially significant amount of memory is actually allocated as 
> hugepages which are not available to be reclaimed.

Yes, I like the idea. It's bitten me already in the past.

The only objection I have is that you print only default_hstate. You
just need to wrap your for_each_node_state by for_each_hstate to do
that.  With that applied, feel free to add my
Acked-by: Michal Hocko <mhocko@suse.cz>

Thanks

> Booting with hugepages=8192 on the command line, this memory is now shown 
> in oom conditions.  For example, with echo m > /proc/sysrq-trigger:
> 
> Node 0 hugepages_total=2048 hugepages_free=2048 hugepages_surp=0 hugepages_size=2048kB
> Node 1 hugepages_total=2048 hugepages_free=2048 hugepages_surp=0 hugepages_size=2048kB
> Node 2 hugepages_total=2048 hugepages_free=2048 hugepages_surp=0 hugepages_size=2048kB
> Node 3 hugepages_total=2048 hugepages_free=2048 hugepages_surp=0 hugepages_size=2048kB
> 
> Signed-off-by: David Rientjes <rientjes@google.com>
> ---
>  include/linux/hugetlb.h |  4 ++++
>  mm/hugetlb.c            | 14 ++++++++++++++
>  mm/page_alloc.c         |  3 +++
>  3 files changed, 21 insertions(+)
> 
> diff --git a/include/linux/hugetlb.h b/include/linux/hugetlb.h
> --- a/include/linux/hugetlb.h
> +++ b/include/linux/hugetlb.h
> @@ -58,6 +58,7 @@ void __unmap_hugepage_range(struct mmu_gather *tlb, struct vm_area_struct *vma,
>  int hugetlb_prefault(struct address_space *, struct vm_area_struct *);
>  void hugetlb_report_meminfo(struct seq_file *);
>  int hugetlb_report_node_meminfo(int, char *);
> +void hugetlb_show_meminfo(void);
>  unsigned long hugetlb_total_pages(void);
>  int hugetlb_fault(struct mm_struct *mm, struct vm_area_struct *vma,
>  			unsigned long address, unsigned int flags);
> @@ -114,6 +115,9 @@ static inline void hugetlb_report_meminfo(struct seq_file *m)
>  {
>  }
>  #define hugetlb_report_node_meminfo(n, buf)	0
> +static inline void hugetlb_show_meminfo(void)
> +{
> +}
>  #define follow_huge_pmd(mm, addr, pmd, write)	NULL
>  #define follow_huge_pud(mm, addr, pud, write)	NULL
>  #define prepare_hugepage_range(file, addr, len)	(-EINVAL)
> diff --git a/mm/hugetlb.c b/mm/hugetlb.c
> --- a/mm/hugetlb.c
> +++ b/mm/hugetlb.c
> @@ -2121,6 +2121,20 @@ int hugetlb_report_node_meminfo(int nid, char *buf)
>  		nid, h->surplus_huge_pages_node[nid]);
>  }
>  
> +void hugetlb_show_meminfo(void)
> +{
> +	struct hstate *h = &default_hstate;
> +	int nid;
> +
> +	for_each_node_state(nid, N_MEMORY)
> +		pr_info("Node %d hugepages_total=%u hugepages_free=%u hugepages_surp=%u hugepages_size=%lukB\n",
> +		        nid,
> +			h->nr_huge_pages_node[nid],
> +			h->free_huge_pages_node[nid],
> +			h->surplus_huge_pages_node[nid],
> +			1UL << (huge_page_order(h) + PAGE_SHIFT - 10));
> +}
> +
>  /* Return the number pages of memory we physically have, in PAGE_SIZE units. */
>  unsigned long hugetlb_total_pages(void)
>  {
> diff --git a/mm/page_alloc.c b/mm/page_alloc.c
> --- a/mm/page_alloc.c
> +++ b/mm/page_alloc.c
> @@ -58,6 +58,7 @@
>  #include <linux/prefetch.h>
>  #include <linux/migrate.h>
>  #include <linux/page-debug-flags.h>
> +#include <linux/hugetlb.h>
>  #include <linux/sched/rt.h>
>  
>  #include <asm/tlbflush.h>
> @@ -3105,6 +3106,8 @@ void show_free_areas(unsigned int filter)
>  		printk("= %lukB\n", K(total));
>  	}
>  
> +	hugetlb_show_meminfo();
> +
>  	printk("%ld total pagecache pages\n", global_page_state(NR_FILE_PAGES));
>  
>  	show_swap_cache_info();
> 
> --
> To unsubscribe, send a message with 'unsubscribe linux-mm' in
> the body to majordomo@kvack.org.  For more info on Linux MM,
> see: http://www.linux-mm.org/ .
> Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

-- 
Michal Hocko
SUSE Labs

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [patch] mm, hugetlb: include hugepages in meminfo
  2013-03-20  9:53 ` Michal Hocko
@ 2013-03-20 18:46   ` David Rientjes
  2013-03-20 18:56     ` Michal Hocko
  0 siblings, 1 reply; 8+ messages in thread
From: David Rientjes @ 2013-03-20 18:46 UTC (permalink / raw)
  To: Michal Hocko; +Cc: Andrew Morton, linux-kernel, linux-mm

On Wed, 20 Mar 2013, Michal Hocko wrote:

> On Tue 19-03-13 17:18:12, David Rientjes wrote:
> > Particularly in oom conditions, it's troublesome that hugetlb memory is 
> > not displayed.  All other meminfo that is emitted will not add up to what 
> > is expected, and there is no artifact left in the kernel log to show that 
> > a potentially significant amount of memory is actually allocated as 
> > hugepages which are not available to be reclaimed.
> 
> Yes, I like the idea. It's bitten me already in the past.
> 
> The only objection I have is that you print only default_hstate. You
> just need to wrap your for_each_node_state by for_each_hstate to do
> that.  With that applied, feel free to add my
> Acked-by: Michal Hocko <mhocko@suse.cz>
> 

I didn't do this because it isn't already exported in /proc/meminfo and 
since we've made an effort to reduce the amount of information emitted by 
the oom killer at oom kill time to avoid spamming the kernel log, I only 
print the default hstate.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [patch] mm, hugetlb: include hugepages in meminfo
  2013-03-20 18:46   ` David Rientjes
@ 2013-03-20 18:56     ` Michal Hocko
  2013-03-20 18:58       ` David Rientjes
  0 siblings, 1 reply; 8+ messages in thread
From: Michal Hocko @ 2013-03-20 18:56 UTC (permalink / raw)
  To: David Rientjes; +Cc: Andrew Morton, linux-kernel, linux-mm

On Wed 20-03-13 11:46:12, David Rientjes wrote:
> On Wed, 20 Mar 2013, Michal Hocko wrote:
> 
> > On Tue 19-03-13 17:18:12, David Rientjes wrote:
> > > Particularly in oom conditions, it's troublesome that hugetlb memory is 
> > > not displayed.  All other meminfo that is emitted will not add up to what 
> > > is expected, and there is no artifact left in the kernel log to show that 
> > > a potentially significant amount of memory is actually allocated as 
> > > hugepages which are not available to be reclaimed.
> > 
> > Yes, I like the idea. It's bitten me already in the past.
> > 
> > The only objection I have is that you print only default_hstate. You
> > just need to wrap your for_each_node_state by for_each_hstate to do
> > that.  With that applied, feel free to add my
> > Acked-by: Michal Hocko <mhocko@suse.cz>
> > 
> 
> I didn't do this because it isn't already exported in /proc/meminfo and 
> since we've made an effort to reduce the amount of information emitted by 
> the oom killer at oom kill time to avoid spamming the kernel log, I only 
> print the default hstate.

I do not see how this would make the output too much excessive. If
you do not want to have too many lines in the output then the hstate
loop can be pushed inside the node loop and have only per-node number
of lines same as you are proposing except you would have a complete
information.
Besides that we are talking about handful of hstates.

-- 
Michal Hocko
SUSE Labs

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [patch] mm, hugetlb: include hugepages in meminfo
  2013-03-20 18:56     ` Michal Hocko
@ 2013-03-20 18:58       ` David Rientjes
  2013-03-20 19:21         ` Michal Hocko
  0 siblings, 1 reply; 8+ messages in thread
From: David Rientjes @ 2013-03-20 18:58 UTC (permalink / raw)
  To: Michal Hocko; +Cc: Andrew Morton, linux-kernel, linux-mm

On Wed, 20 Mar 2013, Michal Hocko wrote:

> > I didn't do this because it isn't already exported in /proc/meminfo and 
> > since we've made an effort to reduce the amount of information emitted by 
> > the oom killer at oom kill time to avoid spamming the kernel log, I only 
> > print the default hstate.
> 
> I do not see how this would make the output too much excessive. If
> you do not want to have too many lines in the output then the hstate
> loop can be pushed inside the node loop and have only per-node number
> of lines same as you are proposing except you would have a complete
> information.
> Besides that we are talking about handful of hstates.
> 

Sigh.  Because nobody is going to be mapping non-default hstates and then 
not know about them at oom time; 1GB hugepages on x86 with pse must be 
reserved at boot and never freed, for example.  I'll add them but it's 
just a waste of time.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [patch v2] mm, hugetlb: include hugepages in meminfo
  2013-03-20  0:18 [patch] mm, hugetlb: include hugepages in meminfo David Rientjes
  2013-03-20  9:53 ` Michal Hocko
@ 2013-03-20 19:07 ` David Rientjes
  2013-03-20 19:52   ` Michal Hocko
  1 sibling, 1 reply; 8+ messages in thread
From: David Rientjes @ 2013-03-20 19:07 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linux-kernel, linux-mm

mm, hugetlb: include hugepages in meminfo

Particularly in oom conditions, it's troublesome that hugetlb memory is 
not displayed.  All other meminfo that is emitted will not add up to what 
is expected, and there is no artifact left in the kernel log to show that 
a potentially significant amount of memory is actually allocated as 
hugepages which are not available to be reclaimed.

Booting with hugepages=8192 on the command line, this memory is now shown 
in oom conditions.  For example, with echo m > /proc/sysrq-trigger:

Node 0 hugepages_total=2048 hugepages_free=2048 hugepages_surp=0 hugepages_size=2048kB
Node 1 hugepages_total=2048 hugepages_free=2048 hugepages_surp=0 hugepages_size=2048kB
Node 2 hugepages_total=2048 hugepages_free=2048 hugepages_surp=0 hugepages_size=2048kB
Node 3 hugepages_total=2048 hugepages_free=2048 hugepages_surp=0 hugepages_size=2048kB

Acked-by: Michal Hocko <mhocko@suse.cz>
Signed-off-by: David Rientjes <rientjes@google.com>
---
 include/linux/hugetlb.h |  4 ++++
 mm/hugetlb.c            | 15 +++++++++++++++
 mm/page_alloc.c         |  3 +++
 3 files changed, 22 insertions(+)

diff --git a/include/linux/hugetlb.h b/include/linux/hugetlb.h
--- a/include/linux/hugetlb.h
+++ b/include/linux/hugetlb.h
@@ -58,6 +58,7 @@ void __unmap_hugepage_range(struct mmu_gather *tlb, struct vm_area_struct *vma,
 int hugetlb_prefault(struct address_space *, struct vm_area_struct *);
 void hugetlb_report_meminfo(struct seq_file *);
 int hugetlb_report_node_meminfo(int, char *);
+void hugetlb_show_meminfo(void);
 unsigned long hugetlb_total_pages(void);
 int hugetlb_fault(struct mm_struct *mm, struct vm_area_struct *vma,
 			unsigned long address, unsigned int flags);
@@ -114,6 +115,9 @@ static inline void hugetlb_report_meminfo(struct seq_file *m)
 {
 }
 #define hugetlb_report_node_meminfo(n, buf)	0
+static inline void hugetlb_show_meminfo(void)
+{
+}
 #define follow_huge_pmd(mm, addr, pmd, write)	NULL
 #define follow_huge_pud(mm, addr, pud, write)	NULL
 #define prepare_hugepage_range(file, addr, len)	(-EINVAL)
diff --git a/mm/hugetlb.c b/mm/hugetlb.c
--- a/mm/hugetlb.c
+++ b/mm/hugetlb.c
@@ -2121,6 +2121,21 @@ int hugetlb_report_node_meminfo(int nid, char *buf)
 		nid, h->surplus_huge_pages_node[nid]);
 }
 
+void hugetlb_show_meminfo(void)
+{
+	struct hstate *h;
+	int nid;
+
+	for_each_node_state(nid, N_MEMORY)
+		for_each_hstate(h)
+			pr_info("Node %d hugepages_total=%u hugepages_free=%u hugepages_surp=%u hugepages_size=%lukB\n",
+		        	nid,
+				h->nr_huge_pages_node[nid],
+				h->free_huge_pages_node[nid],
+				h->surplus_huge_pages_node[nid],
+				1UL << (huge_page_order(h) + PAGE_SHIFT - 10));
+}
+
 /* Return the number pages of memory we physically have, in PAGE_SIZE units. */
 unsigned long hugetlb_total_pages(void)
 {
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -58,6 +58,7 @@
 #include <linux/prefetch.h>
 #include <linux/migrate.h>
 #include <linux/page-debug-flags.h>
+#include <linux/hugetlb.h>
 #include <linux/sched/rt.h>
 
 #include <asm/tlbflush.h>
@@ -3105,6 +3106,8 @@ void show_free_areas(unsigned int filter)
 		printk("= %lukB\n", K(total));
 	}
 
+	hugetlb_show_meminfo();
+
 	printk("%ld total pagecache pages\n", global_page_state(NR_FILE_PAGES));
 
 	show_swap_cache_info();

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [patch] mm, hugetlb: include hugepages in meminfo
  2013-03-20 18:58       ` David Rientjes
@ 2013-03-20 19:21         ` Michal Hocko
  0 siblings, 0 replies; 8+ messages in thread
From: Michal Hocko @ 2013-03-20 19:21 UTC (permalink / raw)
  To: David Rientjes; +Cc: Andrew Morton, linux-kernel, linux-mm

On Wed 20-03-13 11:58:20, David Rientjes wrote:
> On Wed, 20 Mar 2013, Michal Hocko wrote:
> 
> > > I didn't do this because it isn't already exported in /proc/meminfo and 
> > > since we've made an effort to reduce the amount of information emitted by 
> > > the oom killer at oom kill time to avoid spamming the kernel log, I only 
> > > print the default hstate.
> > 
> > I do not see how this would make the output too much excessive. If
> > you do not want to have too many lines in the output then the hstate
> > loop can be pushed inside the node loop and have only per-node number
> > of lines same as you are proposing except you would have a complete
> > information.
> > Besides that we are talking about handful of hstates.
> > 
> 
> Sigh.  Because nobody is going to be mapping non-default hstates and then 
> not know about them at oom time;

If you are under control of the machine then you are right. But I was
already handling issues where getting any piece of information was
challenging and having this kind of information in the log would save me
a lot of time.

> 1GB hugepages on x86 with pse must be reserved at boot and never
> freed, for example.  I'll add them but it's just a waste of time.

If you feel it is the waste of _your_ time then I am OK to create a folow
up patch. I really do not see any reason to limit this output,
especially when it doesn't cost us much.

-- 
Michal Hocko
SUSE Labs

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [patch v2] mm, hugetlb: include hugepages in meminfo
  2013-03-20 19:07 ` [patch v2] " David Rientjes
@ 2013-03-20 19:52   ` Michal Hocko
  0 siblings, 0 replies; 8+ messages in thread
From: Michal Hocko @ 2013-03-20 19:52 UTC (permalink / raw)
  To: David Rientjes; +Cc: Andrew Morton, linux-kernel, linux-mm

On Wed 20-03-13 12:07:29, David Rientjes wrote:
> mm, hugetlb: include hugepages in meminfo
> 
> Particularly in oom conditions, it's troublesome that hugetlb memory is 
> not displayed.  All other meminfo that is emitted will not add up to what 
> is expected, and there is no artifact left in the kernel log to show that 
> a potentially significant amount of memory is actually allocated as 
> hugepages which are not available to be reclaimed.
> 
> Booting with hugepages=8192 on the command line, this memory is now shown 
> in oom conditions.  For example, with echo m > /proc/sysrq-trigger:
> 
> Node 0 hugepages_total=2048 hugepages_free=2048 hugepages_surp=0 hugepages_size=2048kB
> Node 1 hugepages_total=2048 hugepages_free=2048 hugepages_surp=0 hugepages_size=2048kB
> Node 2 hugepages_total=2048 hugepages_free=2048 hugepages_surp=0 hugepages_size=2048kB
> Node 3 hugepages_total=2048 hugepages_free=2048 hugepages_surp=0 hugepages_size=2048kB
> 
> Acked-by: Michal Hocko <mhocko@suse.cz>
> Signed-off-by: David Rientjes <rientjes@google.com>

Thank you!

> ---
>  include/linux/hugetlb.h |  4 ++++
>  mm/hugetlb.c            | 15 +++++++++++++++
>  mm/page_alloc.c         |  3 +++
>  3 files changed, 22 insertions(+)
> 
> diff --git a/include/linux/hugetlb.h b/include/linux/hugetlb.h
> --- a/include/linux/hugetlb.h
> +++ b/include/linux/hugetlb.h
> @@ -58,6 +58,7 @@ void __unmap_hugepage_range(struct mmu_gather *tlb, struct vm_area_struct *vma,
>  int hugetlb_prefault(struct address_space *, struct vm_area_struct *);
>  void hugetlb_report_meminfo(struct seq_file *);
>  int hugetlb_report_node_meminfo(int, char *);
> +void hugetlb_show_meminfo(void);
>  unsigned long hugetlb_total_pages(void);
>  int hugetlb_fault(struct mm_struct *mm, struct vm_area_struct *vma,
>  			unsigned long address, unsigned int flags);
> @@ -114,6 +115,9 @@ static inline void hugetlb_report_meminfo(struct seq_file *m)
>  {
>  }
>  #define hugetlb_report_node_meminfo(n, buf)	0
> +static inline void hugetlb_show_meminfo(void)
> +{
> +}
>  #define follow_huge_pmd(mm, addr, pmd, write)	NULL
>  #define follow_huge_pud(mm, addr, pud, write)	NULL
>  #define prepare_hugepage_range(file, addr, len)	(-EINVAL)
> diff --git a/mm/hugetlb.c b/mm/hugetlb.c
> --- a/mm/hugetlb.c
> +++ b/mm/hugetlb.c
> @@ -2121,6 +2121,21 @@ int hugetlb_report_node_meminfo(int nid, char *buf)
>  		nid, h->surplus_huge_pages_node[nid]);
>  }
>  
> +void hugetlb_show_meminfo(void)
> +{
> +	struct hstate *h;
> +	int nid;
> +
> +	for_each_node_state(nid, N_MEMORY)
> +		for_each_hstate(h)
> +			pr_info("Node %d hugepages_total=%u hugepages_free=%u hugepages_surp=%u hugepages_size=%lukB\n",
> +		        	nid,
> +				h->nr_huge_pages_node[nid],
> +				h->free_huge_pages_node[nid],
> +				h->surplus_huge_pages_node[nid],
> +				1UL << (huge_page_order(h) + PAGE_SHIFT - 10));
> +}
> +
>  /* Return the number pages of memory we physically have, in PAGE_SIZE units. */
>  unsigned long hugetlb_total_pages(void)
>  {
> diff --git a/mm/page_alloc.c b/mm/page_alloc.c
> --- a/mm/page_alloc.c
> +++ b/mm/page_alloc.c
> @@ -58,6 +58,7 @@
>  #include <linux/prefetch.h>
>  #include <linux/migrate.h>
>  #include <linux/page-debug-flags.h>
> +#include <linux/hugetlb.h>
>  #include <linux/sched/rt.h>
>  
>  #include <asm/tlbflush.h>
> @@ -3105,6 +3106,8 @@ void show_free_areas(unsigned int filter)
>  		printk("= %lukB\n", K(total));
>  	}
>  
> +	hugetlb_show_meminfo();
> +
>  	printk("%ld total pagecache pages\n", global_page_state(NR_FILE_PAGES));
>  
>  	show_swap_cache_info();
> 
> --
> To unsubscribe, send a message with 'unsubscribe linux-mm' in
> the body to majordomo@kvack.org.  For more info on Linux MM,
> see: http://www.linux-mm.org/ .
> Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

-- 
Michal Hocko
SUSE Labs

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2013-03-20 19:52 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-03-20  0:18 [patch] mm, hugetlb: include hugepages in meminfo David Rientjes
2013-03-20  9:53 ` Michal Hocko
2013-03-20 18:46   ` David Rientjes
2013-03-20 18:56     ` Michal Hocko
2013-03-20 18:58       ` David Rientjes
2013-03-20 19:21         ` Michal Hocko
2013-03-20 19:07 ` [patch v2] " David Rientjes
2013-03-20 19:52   ` Michal Hocko

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).