From patchwork Tue Oct 18 11:34:17 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Rutland X-Patchwork-Id: 78003 Delivered-To: patch@linaro.org Received: by 10.140.97.247 with SMTP id m110csp836088qge; Tue, 18 Oct 2016 04:34:57 -0700 (PDT) X-Received: by 10.99.188.1 with SMTP id q1mr994709pge.145.1476790497388; Tue, 18 Oct 2016 04:34:57 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f17si31908310pga.83.2016.10.18.04.34.56; Tue, 18 Oct 2016 04:34:57 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933222AbcJRLex (ORCPT + 27 others); Tue, 18 Oct 2016 07:34:53 -0400 Received: from foss.arm.com ([217.140.101.70]:58086 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932125AbcJRLew (ORCPT ); Tue, 18 Oct 2016 07:34:52 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id AADFF16; Tue, 18 Oct 2016 04:34:51 -0700 (PDT) Received: from leverpostej.cambridge.arm.com (usa-sjc-imap-foss1.foss.arm.com [10.72.51.249]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id A4C4F3F21A; Tue, 18 Oct 2016 04:34:50 -0700 (PDT) From: Mark Rutland To: linux-kernel@vger.kernel.org Cc: Mark Rutland , Andrew Morton , Vlastimil Babka , Mel Gorman , linux-mm@kvack.org Subject: [PATCH] mm: pagealloc: fix continued prints in show_free_areas Date: Tue, 18 Oct 2016 12:34:17 +0100 Message-Id: <1476790457-7776-1-git-send-email-mark.rutland@arm.com> X-Mailer: git-send-email 1.9.1 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Recently, printk was reworked in commit: 4bcc595ccd80decb ("printk: reinstate KERN_CONT for printing continuation lines") As of this commit, printk calls missing KERN_CONT will have a linebreak inserted implicitly. In show_free_areas, we miss KERN_CONT in a few cases, and as a result prints are unexpectedly split over a number of lines, making them difficult to read (in v4.9-rc1). This patch uses pr_cont (with uits implicit KERN_CONT) to mark all continued prints that occur withing a show_free_areas() call. Note that show_migration_types() is only called by show_free_areas(). Depending on CONFIG_NUMA a printk after show_node() may or may not be a continuation, but follows an explicit newline if not (and thus marking it as a continuation should not be harmful). Signed-off-by: Mark Rutland Cc: Andrew Morton Cc: Vlastimil Babka Cc: Mel Gorman Cc: linux-mm@kvack.org Cc: linux-kernel@vger.kernel.org --- mm/page_alloc.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) -- 1.9.1 diff --git a/mm/page_alloc.c b/mm/page_alloc.c index 2b3bf67..833f271 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -4224,7 +4224,7 @@ static void show_migration_types(unsigned char type) } *p = '\0'; - printk("(%s) ", tmp); + pr_cont("(%s) ", tmp); } /* @@ -4335,7 +4335,7 @@ void show_free_areas(unsigned int filter) free_pcp += per_cpu_ptr(zone->pageset, cpu)->pcp.count; show_node(zone); - printk("%s" + pr_cont("%s" " free:%lukB" " min:%lukB" " low:%lukB" @@ -4382,8 +4382,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"); + pr_cont(" %ld", zone->lowmem_reserve[i]); + pr_cont("\n"); } for_each_populated_zone(zone) { @@ -4394,7 +4394,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); + pr_cont("%s: ", zone->name); spin_lock_irqsave(&zone->lock, flags); for (order = 0; order < MAX_ORDER; order++) { @@ -4412,11 +4412,11 @@ 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); + pr_cont("%lu*%lukB ", nr[order], K(1UL) << order); if (nr[order]) show_migration_types(types[order]); } - printk("= %lukB\n", K(total)); + pr_cont("= %lukB\n", K(total)); } hugetlb_show_meminfo();