* [PATCH] mm: page_alloc: Use KERN_CONT where appropriate
@ 2016-10-12 2:24 Joe Perches
2016-10-12 9:10 ` Michal Hocko
0 siblings, 1 reply; 5+ messages in thread
From: Joe Perches @ 2016-10-12 2:24 UTC (permalink / raw)
To: linux-kernel; +Cc: linux-mm
Recent changes to printk require KERN_CONT uses to continue logging
messages. So add KERN_CONT where necessary.
Signed-off-by: Joe Perches <joe@perches.com>
---
mm/page_alloc.c | 16 +++++++++-------
1 file changed, 9 insertions(+), 7 deletions(-)
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index ca423cc20b59..6f8c356140a0 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -4219,7 +4219,7 @@ static void show_migration_types(unsigned char type)
}
*p = '\0';
- printk("(%s) ", tmp);
+ printk(KERN_CONT "(%s) ", tmp);
}
/*
@@ -4330,7 +4330,8 @@ void show_free_areas(unsigned int filter)
free_pcp += per_cpu_ptr(zone->pageset, cpu)->pcp.count;
show_node(zone);
- printk("%s"
+ printk(KERN_CONT
+ "%s"
" free:%lukB"
" min:%lukB"
" low:%lukB"
@@ -4377,8 +4378,8 @@ void show_free_areas(unsigned int filter)
K(zone_page_state(zone, NR_FREE_CMA_PAGES)));
printk("lowmem_reserve[]:");
for (i = 0; i < MAX_NR_ZONES; i++)
- printk(" %ld", zone->lowmem_reserve[i]);
- printk("\n");
+ printk(KERN_CONT " %ld", zone->lowmem_reserve[i]);
+ printk(KERN_CONT "\n");
}
for_each_populated_zone(zone) {
@@ -4389,7 +4390,7 @@ void show_free_areas(unsigned int filter)
if (skip_free_areas_node(filter, zone_to_nid(zone)))
continue;
show_node(zone);
- printk("%s: ", zone->name);
+ printk(KERN_CONT "%s: ", zone->name);
spin_lock_irqsave(&zone->lock, flags);
for (order = 0; order < MAX_ORDER; order++) {
@@ -4407,11 +4408,12 @@ void show_free_areas(unsigned int filter)
}
spin_unlock_irqrestore(&zone->lock, flags);
for (order = 0; order < MAX_ORDER; order++) {
- printk("%lu*%lukB ", nr[order], K(1UL) << order);
+ printk(KERN_CONT "%lu*%lukB ",
+ nr[order], K(1UL) << order);
if (nr[order])
show_migration_types(types[order]);
}
- printk("= %lukB\n", K(total));
+ printk(KERN_CONT "= %lukB\n", K(total));
}
hugetlb_show_meminfo();
--
2.10.0.rc2.1.g053435c
--
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>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] mm: page_alloc: Use KERN_CONT where appropriate
2016-10-12 2:24 [PATCH] mm: page_alloc: Use KERN_CONT where appropriate Joe Perches
@ 2016-10-12 9:10 ` Michal Hocko
2016-10-12 9:57 ` Joe Perches
2016-10-12 10:37 ` Joe Perches
0 siblings, 2 replies; 5+ messages in thread
From: Michal Hocko @ 2016-10-12 9:10 UTC (permalink / raw)
To: Joe Perches; +Cc: linux-kernel, linux-mm
On Tue 11-10-16 19:24:55, Joe Perches wrote:
> Recent changes to printk require KERN_CONT uses to continue logging
> messages. So add KERN_CONT where necessary.
I was really wondering what happened when Aaron reported an allocation
failure http://lkml.kernel.org/r/20161012065423.GA16092@aaronlu.sh.intel.com
See the attached log got the current Linus' tree
Fixes: 4bcc595ccd80 ("printk: reinstate KERN_CONT for printing continuation lines")
> Signed-off-by: Joe Perches <joe@perches.com>
Acked-by: Michal Hocko <mhocko@suse.com>
I believe we can simplify the code a bit as well. What do you think
about the following on top?
---
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index 6f8c356140a0..7e1b74ee79cb 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -4078,10 +4078,12 @@ unsigned long nr_free_pagecache_pages(void)
return nr_free_zone_pages(gfp_zone(GFP_HIGHUSER_MOVABLE));
}
-static inline void show_node(struct zone *zone)
+static inline void show_zone_node(struct zone *zone)
{
if (IS_ENABLED(CONFIG_NUMA))
- printk("Node %d ", zone_to_nid(zone));
+ printk("Node %d %s", zone_to_nid(zone), zone->name);
+ else
+ printk("%s: ", zone->name);
}
long si_mem_available(void)
@@ -4329,9 +4331,8 @@ void show_free_areas(unsigned int filter)
for_each_online_cpu(cpu)
free_pcp += per_cpu_ptr(zone->pageset, cpu)->pcp.count;
- show_node(zone);
+ show_zone_node(zone);
printk(KERN_CONT
- "%s"
" free:%lukB"
" min:%lukB"
" low:%lukB"
@@ -4354,7 +4355,6 @@ void show_free_areas(unsigned int filter)
" local_pcp:%ukB"
" free_cma:%lukB"
"\n",
- zone->name,
K(zone_page_state(zone, NR_FREE_PAGES)),
K(min_wmark_pages(zone)),
K(low_wmark_pages(zone)),
@@ -4379,7 +4379,6 @@ void show_free_areas(unsigned int filter)
printk("lowmem_reserve[]:");
for (i = 0; i < MAX_NR_ZONES; i++)
printk(KERN_CONT " %ld", zone->lowmem_reserve[i]);
- printk(KERN_CONT "\n");
}
for_each_populated_zone(zone) {
@@ -4389,8 +4388,7 @@ void show_free_areas(unsigned int filter)
if (skip_free_areas_node(filter, zone_to_nid(zone)))
continue;
- show_node(zone);
- printk(KERN_CONT "%s: ", zone->name);
+ show_zone_node(zone);
spin_lock_irqsave(&zone->lock, flags);
for (order = 0; order < MAX_ORDER; order++) {
--
Michal Hocko
SUSE Labs
--
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>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] mm: page_alloc: Use KERN_CONT where appropriate
2016-10-12 9:10 ` Michal Hocko
@ 2016-10-12 9:57 ` Joe Perches
2016-10-12 10:36 ` Michal Hocko
2016-10-12 10:37 ` Joe Perches
1 sibling, 1 reply; 5+ messages in thread
From: Joe Perches @ 2016-10-12 9:57 UTC (permalink / raw)
To: Michal Hocko; +Cc: inux-kernel, linux-mm
On Wed, 2016-10-12 at 11:10 +0200, Michal Hocko wrote:
> On Tue 11-10-16 19:24:55, Joe Perches wrote:
> > Recent changes to printk require KERN_CONT uses to continue logging
> > messages. So add KERN_CONT where necessary.
>
>
> I was really wondering what happened when Aaron reported an allocation
> failure http://lkml.kernel.org/r/20161012065423.GA16092@aaronlu.sh.intel.com
> See the attached log got the current Linus' tree
>
> Fixes: 4bcc595ccd80 ("printk: reinstate KERN_CONT for printing continuation lines")
> > Signed-off-by: Joe Perches <joe@perches.com>
>
>
> Acked-by: Michal Hocko <mhocko@suse.com>
>
> I believe we can simplify the code a bit as well. What do you think
> about the following on top?
Hi Michal
I think the show_node to show_zone_node renaming is superfluous,
but if it makes you happy, it doesn't bother me.
This recent change to printk logging making KERN_CONT necessary to
continue a line might be reverted when it's better known just how
many instances in the kernel tree will need to be changed.
For now, I'd rather keep the KERN_CONT "\n" and trailing "\n" as
there are _very_ few missing newlines in logging messages today
and removing them now might be a bit early process-wise.
Dunno.
> ---
> diff --git a/mm/page_alloc.c b/mm/page_alloc.c
> index 6f8c356140a0..7e1b74ee79cb 100644
> --- a/mm/page_alloc.c
> +++ b/mm/page_alloc.c
> @@ -4078,10 +4078,12 @@ unsigned long nr_free_pagecache_pages(void)
> return nr_free_zone_pages(gfp_zone(GFP_HIGHUSER_MOVABLE));
> }
>
> -static inline void show_node(struct zone *zone)
> +static inline void show_zone_node(struct zone *zone)
> {
> if (IS_ENABLED(CONFIG_NUMA))
> - printk("Node %d ", zone_to_nid(zone));
> + printk("Node %d %s", zone_to_nid(zone), zone->name);
> + else
> + printk("%s: ", zone->name);
> }
>
> long si_mem_available(void)
> @@ -4329,9 +4331,8 @@ void show_free_areas(unsigned int filter)
> for_each_online_cpu(cpu)
> free_pcp += per_cpu_ptr(zone->pageset, cpu)->pcp.count;
>
> - show_node(zone);
> + show_zone_node(zone);
> printk(KERN_CONT
> - "%s"
> " free:%lukB"
> " min:%lukB"
> " low:%lukB"
> @@ -4354,7 +4355,6 @@ void show_free_areas(unsigned int filter)
> " local_pcp:%ukB"
> " free_cma:%lukB"
> "\n",
> - zone->name,
> K(zone_page_state(zone, NR_FREE_PAGES)),
> K(min_wmark_pages(zone)),
> K(low_wmark_pages(zone)),
> @@ -4379,7 +4379,6 @@ void show_free_areas(unsigned int filter)
> printk("lowmem_reserve[]:");
> for (i = 0; i < MAX_NR_ZONES; i++)
> printk(KERN_CONT " %ld", zone->lowmem_reserve[i]);
> - printk(KERN_CONT "\n");
> }
>
> for_each_populated_zone(zone) {
> @@ -4389,8 +4388,7 @@ void show_free_areas(unsigned int filter)
>
> if (skip_free_areas_node(filter, zone_to_nid(zone)))
> continue;
> - show_node(zone);
> - printk(KERN_CONT "%s: ", zone->name);
> + show_zone_node(zone);
>
> spin_lock_irqsave(&zone->lock, flags);
> for (order = 0; order < MAX_ORDER; order++) {
>
--
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>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] mm: page_alloc: Use KERN_CONT where appropriate
2016-10-12 9:57 ` Joe Perches
@ 2016-10-12 10:36 ` Michal Hocko
0 siblings, 0 replies; 5+ messages in thread
From: Michal Hocko @ 2016-10-12 10:36 UTC (permalink / raw)
To: Joe Perches; +Cc: inux-kernel, linux-mm
On Wed 12-10-16 02:57:30, Joe Perches wrote:
[...]
> This recent change to printk logging making KERN_CONT necessary to
> continue a line might be reverted when it's better known just how
> many instances in the kernel tree will need to be changed.
OK, I will wait until this settles.
--
Michal Hocko
SUSE Labs
--
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>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] mm: page_alloc: Use KERN_CONT where appropriate
2016-10-12 9:10 ` Michal Hocko
2016-10-12 9:57 ` Joe Perches
@ 2016-10-12 10:37 ` Joe Perches
1 sibling, 0 replies; 5+ messages in thread
From: Joe Perches @ 2016-10-12 10:37 UTC (permalink / raw)
To: Michal Hocko; +Cc: linux-mm, LKML
(resending as lkml bounced)
On Wed, 2016-10-12 at 11:10 +0200, Michal Hocko wrote:
> On Tue 11-10-16 19:24:55, Joe Perches wrote:
> > Recent changes to printk require KERN_CONT uses to continue logging
> > messages. So add KERN_CONT where necessary.
>
>
>
> I was really wondering what happened when Aaron reported an allocation
> failure http://lkml.kernel.org/r/20161012065423.GA16092@aaronlu.sh.intel.com
> See the attached log got the current Linus' tree
>
> Fixes: 4bcc595ccd80 ("printk: reinstate KERN_CONT for printing continuation lines")
> > Signed-off-by: Joe Perches <joe@perches.com>
>
>
>
> Acked-by: Michal Hocko <mhocko@suse.com>
>
> I believe we can simplify the code a bit as well. What do you think
> about the following on top?
Hi Michal
I think the show_node to show_zone_node renaming is superfluous,
but if it makes you happy, it doesn't bother me.
This recent change to printk logging making KERN_CONT necessary to
continue a line might be reverted when it's better known just how
many instances in the kernel tree will need to be changed.
For now, I'd rather keep the KERN_CONT "\n" and trailing "\n" as
there are _very_ few missing newlines in logging messages today
and removing them now might be a bit early process-wise.
Dunno.
> ---
> diff --git a/mm/page_alloc.c b/mm/page_alloc.c
> index 6f8c356140a0..7e1b74ee79cb 100644
> --- a/mm/page_alloc.c
> +++ b/mm/page_alloc.c
> @@ -4078,10 +4078,12 @@ unsigned long nr_free_pagecache_pages(void)
> return nr_free_zone_pages(gfp_zone(GFP_HIGHUSER_MOVABLE));
> }
>
> -static inline void show_node(struct zone *zone)
> +static inline void show_zone_node(struct zone *zone)
> {
> if (IS_ENABLED(CONFIG_NUMA))
> - printk("Node %d ", zone_to_nid(zone));
> + printk("Node %d %s", zone_to_nid(zone), zone->name);
> + else
> + printk("%s: ", zone->name);
> }
>
> long si_mem_available(void)
> @@ -4329,9 +4331,8 @@ void show_free_areas(unsigned int filter)
> for_each_online_cpu(cpu)
> free_pcp += per_cpu_ptr(zone->pageset, cpu)->pcp.count;
>
> - show_node(zone);
> + show_zone_node(zone);
> printk(KERN_CONT
> - "%s"
> " free:%lukB"
> " min:%lukB"
> " low:%lukB"
> @@ -4354,7 +4355,6 @@ void show_free_areas(unsigned int filter)
> " local_pcp:%ukB"
> " free_cma:%lukB"
> "\n",
> - zone->name,
> K(zone_page_state(zone, NR_FREE_PAGES)),
> K(min_wmark_pages(zone)),
> K(low_wmark_pages(zone)),
> @@ -4379,7 +4379,6 @@ void show_free_areas(unsigned int filter)
> printk("lowmem_reserve[]:");
> for (i = 0; i < MAX_NR_ZONES; i++)
> printk(KERN_CONT " %ld", zone->lowmem_reserve[i]);
> - printk(KERN_CONT "\n");
> }
>
> for_each_populated_zone(zone) {
> @@ -4389,8 +4388,7 @@ void show_free_areas(unsigned int filter)
>
> if (skip_free_areas_node(filter, zone_to_nid(zone)))
> continue;
> - show_node(zone);
> - printk(KERN_CONT "%s: ", zone->name);
> + show_zone_node(zone);
>
> spin_lock_irqsave(&zone->lock, flags);
> for (order = 0; order < MAX_ORDER; order++) {
--
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>
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2016-10-12 10:37 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-10-12 2:24 [PATCH] mm: page_alloc: Use KERN_CONT where appropriate Joe Perches
2016-10-12 9:10 ` Michal Hocko
2016-10-12 9:57 ` Joe Perches
2016-10-12 10:36 ` Michal Hocko
2016-10-12 10:37 ` Joe Perches
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox