* [PATCH] binfmt_elf: Reorder objects in Makefile to favor platform default.
@ 2009-10-19 14:25 Ryan C. Gordon
2009-10-19 16:26 ` Andreas Schwab
0 siblings, 1 reply; 4+ messages in thread
From: Ryan C. Gordon @ 2009-10-19 14:25 UTC (permalink / raw)
To: linux-kernel
Reordered object list so compat_binfmt_elf.o comes first. This will make it
call register_binfmt() first, inserting it at the end of the list.
Now the kernel will try the compatibility formats as a backup if the actual
system format rejects the binary. As almost all binaries loaded won't be
compatibility formats, this saves a few cycles for each process.
Signed-off-by: Ryan C. Gordon <icculus@icculus.org>
---
fs/Makefile | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/fs/Makefile b/fs/Makefile
index af6d047..173d153 100644
--- a/fs/Makefile
+++ b/fs/Makefile
@@ -40,8 +40,9 @@ obj-$(CONFIG_BINFMT_MISC) += binfmt_misc.o
# binfmt_script is always there
obj-y += binfmt_script.o
-obj-$(CONFIG_BINFMT_ELF) += binfmt_elf.o
+# List compat_* first, so they insert at end of the list, and are tried last.
obj-$(CONFIG_COMPAT_BINFMT_ELF) += compat_binfmt_elf.o
+obj-$(CONFIG_BINFMT_ELF) += binfmt_elf.o
obj-$(CONFIG_BINFMT_ELF_FDPIC) += binfmt_elf_fdpic.o
obj-$(CONFIG_BINFMT_SOM) += binfmt_som.o
obj-$(CONFIG_BINFMT_FLAT) += binfmt_flat.o
--
1.6.0.4
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] binfmt_elf: Reorder objects in Makefile to favor platform default.
2009-10-19 14:25 [PATCH] binfmt_elf: Reorder objects in Makefile to favor platform default Ryan C. Gordon
@ 2009-10-19 16:26 ` Andreas Schwab
2009-10-20 4:34 ` Ryan C. Gordon
0 siblings, 1 reply; 4+ messages in thread
From: Andreas Schwab @ 2009-10-19 16:26 UTC (permalink / raw)
To: Ryan C. Gordon; +Cc: linux-kernel
"Ryan C. Gordon" <icculus@icculus.org> writes:
> Now the kernel will try the compatibility formats as a backup if the actual
> system format rejects the binary. As almost all binaries loaded won't be
> compatibility formats, this saves a few cycles for each process.
Perhaps this should be configurable. For a 64-bit arch with mostly
32-bit userspace the compat format should probably be tried first.
Andreas.
--
Andreas Schwab, schwab@redhat.com
GPG Key fingerprint = D4E8 DBE3 3813 BB5D FA84 5EC7 45C6 250E 6F00 984E
"And now for something completely different."
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] binfmt_elf: Reorder objects in Makefile to favor platform default.
2009-10-19 16:26 ` Andreas Schwab
@ 2009-10-20 4:34 ` Ryan C. Gordon
2009-10-21 7:59 ` Ryan C. Gordon
0 siblings, 1 reply; 4+ messages in thread
From: Ryan C. Gordon @ 2009-10-20 4:34 UTC (permalink / raw)
To: Andreas Schwab; +Cc: linux-kernel
> Perhaps this should be configurable. For a 64-bit arch with mostly
> 32-bit userspace the compat format should probably be tried first.
How about this, then?
>From 22b6f98fb51bf68df09b7feb4ee8fbce6e02d01c Mon Sep 17 00:00:00 2001
From: Ryan C. Gordon <icculus@icculus.org>
Date: Tue, 20 Oct 2009 00:32:04 -0400
Subject: [PATCH] binfmt_elf: Reordered object list so compat_binfmt_elf optionally comes first.
This will make it call register_binfmt() first, inserting it at the end of
the list.
Now the kernel will try the compatibility formats as a backup if the actual
system format rejects the binary. As almost all binaries loaded won't be
compatibility formats, this saves a few cycles for each process.
For scenarios where favoring compatibility binaries makes sense, this can
be chosen via the configuration.
Signed-off-by: Ryan C. Gordon <icculus@icculus.org>
---
fs/Kconfig.binfmt | 14 ++++++++++++++
fs/Makefile | 7 +++++++
2 files changed, 21 insertions(+), 0 deletions(-)
diff --git a/fs/Kconfig.binfmt b/fs/Kconfig.binfmt
index bb4cc5b..b296ab6 100644
--- a/fs/Kconfig.binfmt
+++ b/fs/Kconfig.binfmt
@@ -27,6 +27,20 @@ config COMPAT_BINFMT_ELF
bool
depends on COMPAT && BINFMT_ELF
+config FAVOR_COMPAT_BINFMT_ELF
+ bool "Favor compatibility ELF binaries"
+ depends on COMPAT_BINFMT_ELF
+ default n
+ ---help---
+ Favor "compatibility" ELF binaries. The system will work either way,
+ but you can save a few cycles per process by choosing the type of
+ binary you expect to be loading most of the time. This scenario
+ makes sense if you have a 64-bit kernel to manage 4+ gigabytes of
+ physical RAM but want to run mostly 32-bit processes to conserve
+ that RAM.
+
+ If unsure, say N.
+
config BINFMT_ELF_FDPIC
bool "Kernel support for FDPIC ELF binaries"
default y
diff --git a/fs/Makefile b/fs/Makefile
index af6d047..36ad1c7 100644
--- a/fs/Makefile
+++ b/fs/Makefile
@@ -40,8 +40,15 @@ obj-$(CONFIG_BINFMT_MISC) += binfmt_misc.o
# binfmt_script is always there
obj-y += binfmt_script.o
+# binfmts are registered in order listed here. First registered, last tried!
+ifeq ($(CONFIG_FAVOR_COMPAT_BINFMT_ELF),y)
obj-$(CONFIG_BINFMT_ELF) += binfmt_elf.o
obj-$(CONFIG_COMPAT_BINFMT_ELF) += compat_binfmt_elf.o
+else
+obj-$(CONFIG_COMPAT_BINFMT_ELF) += compat_binfmt_elf.o
+obj-$(CONFIG_BINFMT_ELF) += binfmt_elf.o
+endif
+
obj-$(CONFIG_BINFMT_ELF_FDPIC) += binfmt_elf_fdpic.o
obj-$(CONFIG_BINFMT_SOM) += binfmt_som.o
obj-$(CONFIG_BINFMT_FLAT) += binfmt_flat.o
--
1.6.0.4
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] binfmt_elf: Reorder objects in Makefile to favor platform default.
2009-10-20 4:34 ` Ryan C. Gordon
@ 2009-10-21 7:59 ` Ryan C. Gordon
0 siblings, 0 replies; 4+ messages in thread
From: Ryan C. Gordon @ 2009-10-21 7:59 UTC (permalink / raw)
To: Andreas Schwab; +Cc: linux-kernel
> > Perhaps this should be configurable. For a 64-bit arch with mostly
> > 32-bit userspace the compat format should probably be tried first.
>
> How about this, then?
I didn't realize that commit 74641f584da8eccf30becfbb5507ab457187db22
changed the behaviour of register_binfmt, so the previous patch had it
backwards. Here's an updated patch with the order corrected to match the
config option; no other changes over the previous attempt.
>From 78c3a0bb3025fa6b6a31b259b49663a72a59a1bf Mon Sep 17 00:00:00 2001
From: Ryan C. Gordon <icculus@icculus.org>
Date: Wed, 21 Oct 2009 03:49:30 -0400
Subject: [PATCH] binfmt_elf: Reordered object list so compat_binfmt_elf optionally comes first.
This will make it call register_binfmt() after normal binfmt_elf, inserting it
at the end of the list of binfmts.
Now the kernel will try the compatibility formats as a backup if the actual
system format rejects the binary. As almost all binaries loaded won't be
compatibility formats, this saves a few cycles for each process.
For scenarios where favoring compatibility binaries makes sense, this can
be chosen via the configuration, reversing the order.
Signed-off-by: Ryan C. Gordon <icculus@icculus.org>
---
fs/Kconfig.binfmt | 14 ++++++++++++++
fs/Makefile | 7 +++++++
2 files changed, 21 insertions(+), 0 deletions(-)
diff --git a/fs/Kconfig.binfmt b/fs/Kconfig.binfmt
index bb4cc5b..b296ab6 100644
--- a/fs/Kconfig.binfmt
+++ b/fs/Kconfig.binfmt
@@ -27,6 +27,20 @@ config COMPAT_BINFMT_ELF
bool
depends on COMPAT && BINFMT_ELF
+config FAVOR_COMPAT_BINFMT_ELF
+ bool "Favor compatibility ELF binaries"
+ depends on COMPAT_BINFMT_ELF
+ default n
+ ---help---
+ Favor "compatibility" ELF binaries. The system will work either way,
+ but you can save a few cycles per process by choosing the type of
+ binary you expect to be loading most of the time. This scenario
+ makes sense if you have a 64-bit kernel to manage 4+ gigabytes of
+ physical RAM but want to run mostly 32-bit processes to conserve
+ that RAM.
+
+ If unsure, say N.
+
config BINFMT_ELF_FDPIC
bool "Kernel support for FDPIC ELF binaries"
default y
diff --git a/fs/Makefile b/fs/Makefile
index af6d047..d835dba 100644
--- a/fs/Makefile
+++ b/fs/Makefile
@@ -40,8 +40,15 @@ obj-$(CONFIG_BINFMT_MISC) += binfmt_misc.o
# binfmt_script is always there
obj-y += binfmt_script.o
+# binfmts are registered in order listed here. First registered, first tried!
+ifeq ($(CONFIG_FAVOR_COMPAT_BINFMT_ELF),y)
+obj-$(CONFIG_COMPAT_BINFMT_ELF) += compat_binfmt_elf.o
+obj-$(CONFIG_BINFMT_ELF) += binfmt_elf.o
+else
obj-$(CONFIG_BINFMT_ELF) += binfmt_elf.o
obj-$(CONFIG_COMPAT_BINFMT_ELF) += compat_binfmt_elf.o
+endif
+
obj-$(CONFIG_BINFMT_ELF_FDPIC) += binfmt_elf_fdpic.o
obj-$(CONFIG_BINFMT_SOM) += binfmt_som.o
obj-$(CONFIG_BINFMT_FLAT) += binfmt_flat.o
--
1.6.0.4
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2009-10-21 7:59 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-10-19 14:25 [PATCH] binfmt_elf: Reorder objects in Makefile to favor platform default Ryan C. Gordon
2009-10-19 16:26 ` Andreas Schwab
2009-10-20 4:34 ` Ryan C. Gordon
2009-10-21 7:59 ` Ryan C. Gordon
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®