public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [RFC] x86: setup code_bytes - use mask to restrict it's size
@ 2008-02-02 22:12 Cyrill Gorcunov
  2008-02-02 22:25 ` H. Peter Anvin
  0 siblings, 1 reply; 4+ messages in thread
From: Cyrill Gorcunov @ 2008-02-02 22:12 UTC (permalink / raw)
  To: Ingo Molnar; +Cc: Andi Kleen, H. Peter Anvin, LKML, Thomas Gleixner

This patch strips off 8 bytes from text section. Not a really
big advantage (especially for __init section). It seems 8192
bytes of disassembled code is rare used anyway.

before:
	text    data     bss     dec     hex filename
	9900     176      20   10096    2770 arch/x86/kernel/traps_64.o.old
after:
	text    data     bss     dec     hex filename
	9892     176      20   10088    2768 arch/x86/kernel/traps_64.o

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
---

If there is no benefit at all - just drop the patch.
Any comments are welcome ;)

Index: linux-2.6.git/arch/x86/kernel/traps_32.c
===================================================================
--- linux-2.6.git.orig/arch/x86/kernel/traps_32.c	2008-02-02 23:52:16.000000000 +0300
+++ linux-2.6.git/arch/x86/kernel/traps_32.c	2008-02-03 00:39:58.000000000 +0300
@@ -1229,8 +1229,9 @@ __setup("kstack=", kstack_setup);
 static int __init code_bytes_setup(char *s)
 {
 	code_bytes = simple_strtoul(s, NULL, 0);
-	if (code_bytes > 8192)
-		code_bytes = 8192;
+
+	/* we don't want too long code-dump */
+	code_bytes &= 8191;
 
 	return 1;
 }
Index: linux-2.6.git/arch/x86/kernel/traps_64.c
===================================================================
--- linux-2.6.git.orig/arch/x86/kernel/traps_64.c	2008-02-02 23:52:16.000000000 +0300
+++ linux-2.6.git/arch/x86/kernel/traps_64.c	2008-02-03 00:38:10.000000000 +0300
@@ -1196,8 +1196,9 @@ early_param("kstack", kstack_setup);
 static int __init code_bytes_setup(char *s)
 {
 	code_bytes = simple_strtoul(s, NULL, 0);
-	if (code_bytes > 8192)
-		code_bytes = 8192;
+
+	/* we don't want too long code-dump */
+	code_bytes &= 8191;
 
 	return 1;
 }

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

* Re: [RFC] x86: setup code_bytes - use mask to restrict it's size
  2008-02-02 22:12 [RFC] x86: setup code_bytes - use mask to restrict it's size Cyrill Gorcunov
@ 2008-02-02 22:25 ` H. Peter Anvin
  2008-02-02 22:32   ` Cyrill Gorcunov
  0 siblings, 1 reply; 4+ messages in thread
From: H. Peter Anvin @ 2008-02-02 22:25 UTC (permalink / raw)
  To: Cyrill Gorcunov; +Cc: Ingo Molnar, Andi Kleen, LKML, Thomas Gleixner

Cyrill Gorcunov wrote:
> This patch strips off 8 bytes from text section. Not a really
> big advantage (especially for __init section). It seems 8192
> bytes of disassembled code is rare used anyway.
> 
> before:
> 	text    data     bss     dec     hex filename
> 	9900     176      20   10096    2770 arch/x86/kernel/traps_64.o.old
> after:
> 	text    data     bss     dec     hex filename
> 	9892     176      20   10088    2768 arch/x86/kernel/traps_64.o
> 
> Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
> ---
> 
> If there is no benefit at all - just drop the patch.
> Any comments are welcome ;)

I don't think this is the behaviour we want (wrapping around); worse, if 
people enter a larger power of two they will get zero.

So NAK on this patch, IMO.

	-hpa

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

* Re: [RFC] x86: setup code_bytes - use mask to restrict it's size
  2008-02-02 22:25 ` H. Peter Anvin
@ 2008-02-02 22:32   ` Cyrill Gorcunov
  2008-02-02 22:59     ` H. Peter Anvin
  0 siblings, 1 reply; 4+ messages in thread
From: Cyrill Gorcunov @ 2008-02-02 22:32 UTC (permalink / raw)
  To: H. Peter Anvin; +Cc: Ingo Molnar, Andi Kleen, LKML, Thomas Gleixner

Thanks for review. Agreed with you absolutely. Silly patch, sorry :(

On 2/3/08, H. Peter Anvin <hpa@zytor.com> wrote:
> Cyrill Gorcunov wrote:
> > This patch strips off 8 bytes from text section. Not a really
> > big advantage (especially for __init section). It seems 8192
> > bytes of disassembled code is rare used anyway.
> >
> > before:
> > 	text    data     bss     dec     hex filename
> > 	9900     176      20   10096    2770 arch/x86/kernel/traps_64.o.old
> > after:
> > 	text    data     bss     dec     hex filename
> > 	9892     176      20   10088    2768 arch/x86/kernel/traps_64.o
> >
> > Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
> > ---
> >
> > If there is no benefit at all - just drop the patch.
> > Any comments are welcome ;)
>
> I don't think this is the behaviour we want (wrapping around); worse, if
> people enter a larger power of two they will get zero.
>
> So NAK on this patch, IMO.
>
> 	-hpa
>

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

* Re: [RFC] x86: setup code_bytes - use mask to restrict it's size
  2008-02-02 22:32   ` Cyrill Gorcunov
@ 2008-02-02 22:59     ` H. Peter Anvin
  0 siblings, 0 replies; 4+ messages in thread
From: H. Peter Anvin @ 2008-02-02 22:59 UTC (permalink / raw)
  To: Cyrill Gorcunov; +Cc: Ingo Molnar, Andi Kleen, LKML, Thomas Gleixner

Cyrill Gorcunov wrote:
> Thanks for review. Agreed with you absolutely. Silly patch, sorry :(

S'okay :)  Thanks for trying!

	-hpa


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

end of thread, other threads:[~2008-02-02 22:59 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-02-02 22:12 [RFC] x86: setup code_bytes - use mask to restrict it's size Cyrill Gorcunov
2008-02-02 22:25 ` H. Peter Anvin
2008-02-02 22:32   ` Cyrill Gorcunov
2008-02-02 22:59     ` H. Peter Anvin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox