linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: ard.biesheuvel@linaro.org (Ard Biesheuvel)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v2 3/6] arm64: ptdump: fold string literals into address_markers[] and pte_bits[]
Date: Fri, 22 Apr 2016 18:48:05 +0200	[thread overview]
Message-ID: <1461343688-8552-4-git-send-email-ard.biesheuvel@linaro.org> (raw)
In-Reply-To: <1461343688-8552-1-git-send-email-ard.biesheuvel@linaro.org>

Replace the indirect string references in struct addr_marker and struct
prot_bits with char array fields. Under a relocatable kernel, this not
only saves 8 bytes in the absolute address that we no longer have to record,
it also saves 24 bytes of init data (the size of a RELA entry) since this
address no longer requires relocation processing at boot.

Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
---
I am aware that this is a drop in the ocean, but I thought I'd include it
anyway, since many people may not even realize that this issue exists in
the first place.
---
 arch/arm64/mm/dump.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/arch/arm64/mm/dump.c b/arch/arm64/mm/dump.c
index 8404190fe2bd..024f803e2fb4 100644
--- a/arch/arm64/mm/dump.c
+++ b/arch/arm64/mm/dump.c
@@ -30,7 +30,7 @@
 
 struct addr_marker {
 	unsigned long start_address;
-	const char *name;
+	char name[32];
 };
 
 static const struct addr_marker address_markers[] = {
@@ -51,7 +51,7 @@ static const struct addr_marker address_markers[] = {
 	{ VMEMMAP_START + VMEMMAP_SIZE,	"vmemmap end" },
 #endif
 	{ PAGE_OFFSET,			"Linear Mapping" },
-	{ -1,				NULL },
+	{ -1 },
 };
 
 /*
@@ -69,10 +69,10 @@ struct pg_state {
 };
 
 struct prot_bits {
-	u64		mask;
-	u64		val;
-	const char	*set;
-	const char	*clear;
+	u64	mask;
+	u64	val;
+	char	set[16];
+	char	clear[8];
 };
 
 static const struct prot_bits pte_bits[] = {
@@ -184,7 +184,7 @@ static void dump_prot(struct pg_state *st, const struct prot_bits *bits,
 		else
 			s = bits->clear;
 
-		if (s)
+		if (*s)
 			seq_printf(st->seq, " %s", s);
 	}
 }
-- 
2.7.4

  parent reply	other threads:[~2016-04-22 16:48 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-22 16:48 [PATCH v2 0/6] arm64/ARM pt dumper changes Ard Biesheuvel
2016-04-22 16:48 ` [PATCH v2 1/6] arm64: ptdump: use static initializers for vmemmap region boundaries Ard Biesheuvel
2016-04-22 17:07   ` Mark Rutland
2016-04-22 16:48 ` [PATCH v2 2/6] arm64: ptdump: add region marker for kasan shadow region Ard Biesheuvel
2016-04-22 17:09   ` Mark Rutland
2016-04-22 16:48 ` Ard Biesheuvel [this message]
2016-04-22 16:48 ` [PATCH v2 4/6] arm64: mm: dump: make page table dumping reusable Ard Biesheuvel
2016-04-25 11:07   ` Will Deacon
2016-05-13 12:56     ` Mark Rutland
2016-05-31 13:25       ` Will Deacon
2016-04-22 16:48 ` [PATCH v2 5/6] arm: " Ard Biesheuvel
2016-04-22 16:48 ` [PATCH v2 6/6] efi/arm*: add support to dump the EFI page tables Ard Biesheuvel
2016-04-22 17:01   ` Mark Rutland
2016-04-22 17:20     ` Ard Biesheuvel
2016-04-22 17:25       ` Mark Rutland
2016-04-25 11:26         ` Ard Biesheuvel
2016-04-27 20:12           ` Russell King - ARM Linux
2016-04-26 11:29 ` [PATCH v2 0/6] arm64/ARM pt dumper changes Will Deacon
2016-04-26 11:34   ` Ard Biesheuvel

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=1461343688-8552-4-git-send-email-ard.biesheuvel@linaro.org \
    --to=ard.biesheuvel@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.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 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).