Shrink thread_info a bit
PATCH 1/1 Shrink thread_info a bit
Thread info comes in on Versatile Express at 752 bytes in size, which is quite large. Of this, the crunch state is 184 bytes, which is only used on Cirrus Logic devices.
It is wasteful to have this in every kernel when Cirrus Logic CPUs are not that widely used. So make this conditional.
--- arch/arm/include/asm/thread_info.h | 2 ++ arch/arm/kernel/asm-offsets.c | 2 ++ 2 files changed, 4 insertions(+), 0 deletions(-)
arch/arm/include/asm/thread_info.h +2 -0
@@ -59,7 +59,9 @@ struct thread_info {__u32 syscall;/* syscall number */ __u8 used_cp[16 ];/* thread used copro */ unsigned long tp_value; +#ifdef CONFIG_CRUNCH struct crunch_state crunchstate; +#endif union fp_state fpstate __attribute__((aligned(8)));union vfp_state vfpstate;#ifdef CONFIG_ARM_THUMBEE
PATCH 1/1 Shrink thread_info a bit
Hi Russell,
Quoted 18 lines · Russell King - ARM Linux
Thread info comes in on Versatile Express at 752 bytes in size, which is quite large. Of this, the crunch state is 184 bytes, which is only used on Cirrus Logic devices.
It is wasteful to have this in every kernel when Cirrus Logic CPUs are not that widely used. So make this conditional.
Signed-off-by Russell King <[email protected]>--- arch/arm/include/asm/thread_info.h | 2 ++ arch/arm/kernel/asm-offsets.c | 2 ++ 2 files changed, 4 insertions(+), 0 deletions(-)arch/arm/include/asm/thread_info.h +0
-0
arch/arm/include/asm/thread_info.h struct thread_info { · line 67
Quoted 9 lines
arch/arm/include/asm/thread_info.h +2
-0@@ -59,7 +59,9 @@ struct thread_info {__u32 syscall;/* syscall number */ __u8 used_cp[16 ];/* thread used copro */ unsigned long tp_value; +#ifdef CONFIG_CRUNCH struct crunch_state crunchstate; +#endif union fp_state fpstate __attribute__((aligned(8)));union vfp_state vfpstate;#ifdef CONFIG_ARM_THUMBEE
Where is the arch/arm/kernel/asm-offsets.c hunk?
baruch
Signature · 3 lines
~. .~ Tk Open Systems
=}------------------------------------------------ooO--U--Ooo------------{=
- baruch at tkos.co.il - tel: +972.2.679.5364, http://www.tkos.co.il -PATCH 1/1 Shrink thread_info a bit
Quoted 16 lines · Baruch Siach
Hi Russell,
Quoted 13 lines · Russell King - ARM Linux
Thread info comes in on Versatile Express at 752 bytes in size, which is quite large. Of this, the crunch state is 184 bytes, which is only used on Cirrus Logic devices.
It is wasteful to have this in every kernel when Cirrus Logic CPUs are not that widely used. So make this conditional.
Signed-off-by Russell King <[email protected]>--- arch/arm/include/asm/thread_info.h | 2 ++ arch/arm/kernel/asm-offsets.c | 2 ++ 2 files changed, 4 insertions(+), 0 deletions(-)
Quoted 16 lines
Quoted 5 lines
arch/arm/include/asm/thread_info.h +0
-0arch/arm/include/asm/thread_info.h struct thread_info { · line 67
Quoted 9 lines
arch/arm/include/asm/thread_info.h +2
-0@@ -59,7 +59,9 @@ struct thread_info {__u32 syscall;/* syscall number */ __u8 used_cp[16 ];/* thread used copro */ unsigned long tp_value; +#ifdef CONFIG_CRUNCH struct crunch_state crunchstate; +#endif union fp_state fpstate __attribute__((aligned(8)));union vfp_state vfpstate;#ifdef CONFIG_ARM_THUMBEE Where is the
arch/arm/kernel/asm-offsets.chunk?
Have you looked there?
PATCH 1/1 Shrink thread_info a bit
In reply to Russell King - ARM LinuxHi Russell,
arch/arm/include/asm/thread_info.h struct thread_info { · line 65
Quoted 12 lines · Russell King - ARM Linux
arch/arm/include/asm/thread_info.h +2
-0@@ -59,7 +59,9 @@ struct thread_info {__u32 syscall;/* syscall number */ __u8 used_cp[16 ];/* thread used copro */ unsigned long tp_value; +#ifdef CONFIG_CRUNCH struct crunch_state crunchstate; +#endif union fp_state fpstate __attribute__((aligned(8)));
Can we also shrink the contents of fp_state when AEABI && !OABI_COMPAT? It's slightly more involved as ptrace and core-dumping would need some similar treatment. We probably need to keep the union kicking around though, since the iwmmxt state is held in there.
Will
PATCH 1/1 Shrink thread_info a bit
Quoted 12 lines · Will Deacon
Hi Russell,
Quoted 9 lines · Russell King - ARM Linux
arch/arm/include/asm/thread_info.h +1
-0@@ -59,7 +59,9 @@ struct thread_info {__u32 syscall;/* syscall number */ __u8 used_cp[16 ];/* thread used copro */ unsigned long tp_value; +#ifdef CONFIG_CRUNCH
Quoted 8 lines
arch/arm/include/asm/thread_info.h struct thread_info { · line 65
Quoted 3 lines
arch/arm/include/asm/thread_info.h +1
-0struct crunch_state crunchstate; +#endif union fp_state fpstate __attribute__((aligned(8)));Can we also shrink the contents of
fp_statewhen AEABI && !OABI_COMPAT? It's slightly more involved as ptrace and core-dumping would need some similar treatment. We probably need to keep the union kicking around though, since the iwmmxt state is held in there.
This patch is the nice easy bit - doing the same with the fpstate would be much more involved because thre's also bits of assembly which would be impacted as well.
PATCH 1/1 Shrink thread_info a bit
In reply to Will DeaconQuoted 17 lines · Will Deacon
Hi Russell,
arch/arm/include/asm/thread_info.h struct thread_info { · line 65
Quoted 12 lines · Russell King - ARM Linux
arch/arm/include/asm/thread_info.h +2
-0@@ -59,7 +59,9 @@ struct thread_info {__u32 syscall;/* syscall number */ __u8 used_cp[16 ];/* thread used copro */ unsigned long tp_value; +#ifdef CONFIG_CRUNCH struct crunch_state crunchstate; +#endif union fp_state fpstate __attribute__((aligned(8)));Can we also shrink the contents of
fp_statewhen AEABI && !OABI_COMPAT?
Is this the right config combination to indicate that the FPA ABI will not be supported? I'm assuming so, since that's the condition which currently disallows CONFIG_NWFPE.
I'm not saying it's not ... I'm just unsure.
Note that the FPA state (35 words) is not that much smaller than the iwmmxt state (38 words), so not much space would be saved by shrinking that union.
I wonder whether fpstate can go away completely on platforms which have neither fpa nor iwmmxt however. That would be a more significant saving. Is it used for anything else?
Quoted 3 lines
It's slightly more involved as ptrace and core-dumping would need some similar treatment. We probably need to keep the union kicking around though, since the iwmmxt state is held in there.
We would need some sensible error return from the ptrace calls to access the FPA registers. PTRACE_GETREGSET (not currently working on ARM since the relevant generic code is #ifdef'd on CONFIG_HAVE_ARCH_TRACEHOOK for some reason) returns -EINVAL when requesting a regset that isn't there.
Fixing coredumps should be relatively easy -- I think we just need to change arm_regsets[] in arch/arm/kernel/ptrace.c appropriately.
Cheers
---Dave
PATCH 1/1 Shrink thread_info a bit
Hi Dave,
Quoted 9 lines · Dave Martin
Quoted 2 lines · Will Deacon
Can we also shrink the contents of
fp_statewhen AEABI && !OABI_COMPAT?Is this the right config combination to indicate that the FPA ABI will not be supported? I'm assuming so, since that's the condition which currently disallows
CONFIG_NWFPE.I'm not saying it's not ... I'm just unsure.
Well, we basically just want to check whether or not we might have OABI executables in userspace so I think this is the right way of doing that. I toyed with doing something like !CONFIG_VFP but that doesn't help with the compat stuff.
Quoted 3 lines
Note that the FPA state (35 words) is not that much smaller than the iwmmxt state (38 words), so not much space would be saved by shrinking that union.
Right, but the IWMMXT part of the union is already predicated on CONFIG_IWMMXT so the goal is to have an empty union for the common case (EABI and no IWMMXT).
Quoted 3 lines
I wonder whether fpstate can go away completely on platforms which have neither fpa nor iwmmxt however. That would be a more significant saving. Is it used for anything else?
That's kind of the idea, but I was just going to leave it empty.
Quoted 11 lines
Quoted 3 lines
It's slightly more involved as ptrace and core-dumping would need some similar treatment. We probably need to keep the union kicking around though, since the iwmmxt state is held in there.
We would need some sensible error return from the ptrace calls to access the FPA registers.
PTRACE_GETREGSET(not currently working on ARM since the relevant generic code is #ifdef'd onCONFIG_HAVE_ARCH_TRACEHOOKfor some reason) returns-EINVALwhen requesting a regset that isn't there.Fixing coredumps should be relatively easy -- I think we just need to change arm_regsets[] in
arch/arm/kernel/ptrace.cappropriately.
Russell also pointed out that we need to hack some assembly code for this to work, but I can't say I've looked into it yet.
Will
PATCH 1/1 Shrink thread_info a bit
In reply to Russell King - ARM LinuxQuoted 20 lines · Russell King - ARM Linux
Thread info comes in on Versatile Express at 752 bytes in size, which is quite large. Of this, the crunch state is 184 bytes, which is only used on Cirrus Logic devices.
It is wasteful to have this in every kernel when Cirrus Logic CPUs are not that widely used. So make this conditional.
Signed-off-by Russell King<[email protected]>--- arch/arm/include/asm/thread_info.h | 2 ++ arch/arm/kernel/asm-offsets.c | 2 ++ 2 files changed, 4 insertions(+), 0 deletions(-)arch/arm/include/asm/thread_info.h +0
-0
arch/arm/include/asm/thread_info.h struct thread_info { · line 67
Quoted 9 lines
arch/arm/include/asm/thread_info.h +2
-0@@ -59,7 +59,9 @@ struct thread_info {__u32 syscall;/* syscall number */ __u8 used_cp[16 ];/* thread used copro */ unsigned long tp_value; +#ifdef CONFIG_CRUNCH struct crunch_state crunchstate; +#endif union fp_state fpstate __attribute__((aligned(8)));union vfp_state vfpstate;#ifdef CONFIG_ARM_THUMBEE
Since the asm-offsets.h code already has the offset definitions under #ifdef CONFIG_CRUNCH, this qualifies as a code consistency cleanup, as well as a memory savings.
I looked at this, and can find no code outside of #ifdef CONFIG_CRUNCH that references this - so FWIW
Reviewed-by Tim Bird <[email protected]>
-- Tim