All of lore.kernel.org
 help / color / mirror / Atom feed
From: Joe Perches <joe@perches.com>
To: Andrew Morton <akpm@linux-foundation.org>, linux-kernel@vger.kernel.org
Cc: linux-mm@kvack.org
Subject: [PATCH 2/3] mm: page_alloc: Fix misordered logging output, reduce code size
Date: Wed, 15 Mar 2017 18:43:14 -0700	[thread overview]
Message-ID: <2aaf6f1701ee78582743d91359018689d5826e82.1489628459.git.joe@perches.com> (raw)
In-Reply-To: <cover.1489628459.git.joe@perches.com>

When CONFIG_TRANSPARENT_HUGEPAGE is set, there is an output defect
where the values emitted do not match the textual descriptions.

Reorder the arguments appropriately.

As with commit f5f93a2657ab ("mm: page_alloc: Reduce object size
by neatening printks"), register spilling occurs when there are
a large number of arguments to a function call.

$ size mm/page_alloc.o* (defconfig)
   text    data     bss     dec     hex filename
  35874    1699     628   38201    9539 mm/page_alloc.o.new
  35914    1699     628   38241    9561 mm/page_alloc.o.old

Miscellanea:

o Break up the long printk into multiple printk and printk(KERN_CONT
  calls to avoid register spilling

Signed-off-by: Joe Perches <joe@perches.com>
---
 mm/page_alloc.c | 39 ++++++++++++++++++++-------------------
 1 file changed, 20 insertions(+), 19 deletions(-)

diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index 5db9710cb932..6816bb167394 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -4540,40 +4540,41 @@ void show_free_areas(unsigned int filter, nodemask_t *nodemask)
 		       " inactive_anon:%lukB"
 		       " active_file:%lukB"
 		       " inactive_file:%lukB"
-		       " unevictable:%lukB"
-		       " isolated(anon):%lukB"
-		       " isolated(file):%lukB"
-		       " mapped:%lukB"
-		       " dirty:%lukB"
-		       " writeback:%lukB"
-		       " shmem:%lukB"
-#ifdef CONFIG_TRANSPARENT_HUGEPAGE
-		       " shmem_thp: %lukB"
-		       " shmem_pmdmapped: %lukB"
-		       " anon_thp: %lukB"
-#endif
-		       " writeback_tmp:%lukB"
-		       " unstable:%lukB"
-		       " all_unreclaimable? %s"
-		       "\n",
+		       " unevictable:%lukB",
 		       pgdat->node_id,
 		       K(node_page_state(pgdat, NR_ACTIVE_ANON)),
 		       K(node_page_state(pgdat, NR_INACTIVE_ANON)),
 		       K(node_page_state(pgdat, NR_ACTIVE_FILE)),
 		       K(node_page_state(pgdat, NR_INACTIVE_FILE)),
-		       K(node_page_state(pgdat, NR_UNEVICTABLE)),
+		       K(node_page_state(pgdat, NR_UNEVICTABLE)));
+		printk(KERN_CONT
+		       " isolated(anon):%lukB"
+		       " isolated(file):%lukB"
+		       " mapped:%lukB"
+		       " dirty:%lukB"
+		       " writeback:%lukB"
+		       " shmem:%lukB",
 		       K(node_page_state(pgdat, NR_ISOLATED_ANON)),
 		       K(node_page_state(pgdat, NR_ISOLATED_FILE)),
 		       K(node_page_state(pgdat, NR_FILE_MAPPED)),
 		       K(node_page_state(pgdat, NR_FILE_DIRTY)),
 		       K(node_page_state(pgdat, NR_WRITEBACK)),
+		       K(node_page_state(pgdat, NR_SHMEM)));
 #ifdef CONFIG_TRANSPARENT_HUGEPAGE
+		printk(KERN_CONT
+		       " shmem_thp: %lukB"
+		       " shmem_pmdmapped: %lukB"
+		       " anon_thp: %lukB",
 		       K(node_page_state(pgdat, NR_SHMEM_THPS) * HPAGE_PMD_NR),
 		       K(node_page_state(pgdat, NR_SHMEM_PMDMAPPED)
 			 * HPAGE_PMD_NR),
-		       K(node_page_state(pgdat, NR_ANON_THPS) * HPAGE_PMD_NR),
+		       K(node_page_state(pgdat, NR_ANON_THPS) * HPAGE_PMD_NR));
 #endif
-		       K(node_page_state(pgdat, NR_SHMEM)),
+		printk(KERN_CONT
+		       " writeback_tmp:%lukB"
+		       " unstable:%lukB"
+		       " all_unreclaimable? %s"
+		       "\n",
 		       K(node_page_state(pgdat, NR_WRITEBACK_TEMP)),
 		       K(node_page_state(pgdat, NR_UNSTABLE_NFS)),
 		       pgdat->kswapd_failures >= MAX_RECLAIM_RETRIES ?
-- 
2.10.0.rc2.1.g053435c

WARNING: multiple messages have this Message-ID (diff)
From: Joe Perches <joe@perches.com>
To: Andrew Morton <akpm@linux-foundation.org>, linux-kernel@vger.kernel.org
Cc: linux-mm@kvack.org
Subject: [PATCH 2/3] mm: page_alloc: Fix misordered logging output, reduce code size
Date: Wed, 15 Mar 2017 18:43:14 -0700	[thread overview]
Message-ID: <2aaf6f1701ee78582743d91359018689d5826e82.1489628459.git.joe@perches.com> (raw)
In-Reply-To: <cover.1489628459.git.joe@perches.com>

When CONFIG_TRANSPARENT_HUGEPAGE is set, there is an output defect
where the values emitted do not match the textual descriptions.

Reorder the arguments appropriately.

As with commit f5f93a2657ab ("mm: page_alloc: Reduce object size
by neatening printks"), register spilling occurs when there are
a large number of arguments to a function call.

$ size mm/page_alloc.o* (defconfig)
   text    data     bss     dec     hex filename
  35874    1699     628   38201    9539 mm/page_alloc.o.new
  35914    1699     628   38241    9561 mm/page_alloc.o.old

Miscellanea:

o Break up the long printk into multiple printk and printk(KERN_CONT
  calls to avoid register spilling

Signed-off-by: Joe Perches <joe@perches.com>
---
 mm/page_alloc.c | 39 ++++++++++++++++++++-------------------
 1 file changed, 20 insertions(+), 19 deletions(-)

diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index 5db9710cb932..6816bb167394 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -4540,40 +4540,41 @@ void show_free_areas(unsigned int filter, nodemask_t *nodemask)
 		       " inactive_anon:%lukB"
 		       " active_file:%lukB"
 		       " inactive_file:%lukB"
-		       " unevictable:%lukB"
-		       " isolated(anon):%lukB"
-		       " isolated(file):%lukB"
-		       " mapped:%lukB"
-		       " dirty:%lukB"
-		       " writeback:%lukB"
-		       " shmem:%lukB"
-#ifdef CONFIG_TRANSPARENT_HUGEPAGE
-		       " shmem_thp: %lukB"
-		       " shmem_pmdmapped: %lukB"
-		       " anon_thp: %lukB"
-#endif
-		       " writeback_tmp:%lukB"
-		       " unstable:%lukB"
-		       " all_unreclaimable? %s"
-		       "\n",
+		       " unevictable:%lukB",
 		       pgdat->node_id,
 		       K(node_page_state(pgdat, NR_ACTIVE_ANON)),
 		       K(node_page_state(pgdat, NR_INACTIVE_ANON)),
 		       K(node_page_state(pgdat, NR_ACTIVE_FILE)),
 		       K(node_page_state(pgdat, NR_INACTIVE_FILE)),
-		       K(node_page_state(pgdat, NR_UNEVICTABLE)),
+		       K(node_page_state(pgdat, NR_UNEVICTABLE)));
+		printk(KERN_CONT
+		       " isolated(anon):%lukB"
+		       " isolated(file):%lukB"
+		       " mapped:%lukB"
+		       " dirty:%lukB"
+		       " writeback:%lukB"
+		       " shmem:%lukB",
 		       K(node_page_state(pgdat, NR_ISOLATED_ANON)),
 		       K(node_page_state(pgdat, NR_ISOLATED_FILE)),
 		       K(node_page_state(pgdat, NR_FILE_MAPPED)),
 		       K(node_page_state(pgdat, NR_FILE_DIRTY)),
 		       K(node_page_state(pgdat, NR_WRITEBACK)),
+		       K(node_page_state(pgdat, NR_SHMEM)));
 #ifdef CONFIG_TRANSPARENT_HUGEPAGE
+		printk(KERN_CONT
+		       " shmem_thp: %lukB"
+		       " shmem_pmdmapped: %lukB"
+		       " anon_thp: %lukB",
 		       K(node_page_state(pgdat, NR_SHMEM_THPS) * HPAGE_PMD_NR),
 		       K(node_page_state(pgdat, NR_SHMEM_PMDMAPPED)
 			 * HPAGE_PMD_NR),
-		       K(node_page_state(pgdat, NR_ANON_THPS) * HPAGE_PMD_NR),
+		       K(node_page_state(pgdat, NR_ANON_THPS) * HPAGE_PMD_NR));
 #endif
-		       K(node_page_state(pgdat, NR_SHMEM)),
+		printk(KERN_CONT
+		       " writeback_tmp:%lukB"
+		       " unstable:%lukB"
+		       " all_unreclaimable? %s"
+		       "\n",
 		       K(node_page_state(pgdat, NR_WRITEBACK_TEMP)),
 		       K(node_page_state(pgdat, NR_UNSTABLE_NFS)),
 		       pgdat->kswapd_failures >= MAX_RECLAIM_RETRIES ?
-- 
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>

  parent reply	other threads:[~2017-03-16  1:43 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-16  1:43 [PATCH 0/3] mm: page_alloc: Object code reductions and logging fix Joe Perches
2017-03-16  1:43 ` Joe Perches
2017-03-16  1:43 ` [PATCH 1/3] mm: page_alloc: Reduce object size by neatening printks Joe Perches
2017-03-16  1:43   ` Joe Perches
2017-03-16 10:56   ` Michal Hocko
2017-03-16 10:56     ` Michal Hocko
2017-03-16 20:32     ` Joe Perches
2017-03-16 20:32       ` Joe Perches
2017-03-17  7:39       ` Michal Hocko
2017-03-17  7:39         ` Michal Hocko
2017-03-16 11:30   ` Sergey Senozhatsky
2017-03-16 11:30     ` Sergey Senozhatsky
2017-03-16 18:37     ` Joe Perches
2017-03-16 18:37       ` Joe Perches
2017-03-16 22:53       ` Andrew Morton
2017-03-16 22:53         ` Andrew Morton
2017-03-17  1:56       ` Sergey Senozhatsky
2017-03-17  1:56         ` Sergey Senozhatsky
2017-03-18 19:31         ` Joe Perches
2017-03-18 19:31           ` Joe Perches
2017-03-20 13:00           ` Petr Mladek
2017-03-20 13:00             ` Petr Mladek
2017-03-16  1:43 ` Joe Perches [this message]
2017-03-16  1:43   ` [PATCH 2/3] mm: page_alloc: Fix misordered logging output, reduce code size Joe Perches
2017-03-16 10:57   ` Michal Hocko
2017-03-16 10:57     ` Michal Hocko
2017-03-16  1:43 ` [PATCH 3/3] mm: page_alloc: Break up a long single-line printk Joe Perches
2017-03-16  1:43   ` Joe Perches
2017-03-16 10:58   ` Michal Hocko
2017-03-16 10:58     ` Michal Hocko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2aaf6f1701ee78582743d91359018689d5826e82.1489628459.git.joe@perches.com \
    --to=joe@perches.com \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.