* [PATCH] ratelimit: convert flags to int to save 8 bytes in size
@ 2024-08-17 12:37 Mateusz Guzik
2024-08-17 12:41 ` Mateusz Guzik
0 siblings, 1 reply; 2+ messages in thread
From: Mateusz Guzik @ 2024-08-17 12:37 UTC (permalink / raw)
To: akpm; +Cc: linux-kernel, linux-mm, Mateusz Guzik
Only bit 1 is used, making an unsigned long a total overkill.
This brings it from 64 to 32 bytes, which in turn shrinks user_struct
from 136 to 128 bytes. Since the latter is allocated with hwalign, this
means the total usage goes down from 192 to 128 bytes per object.
No functional changes.
Signed-off-by: Mateusz Guzik <mjguzik@gmail.com>
---
./scripts/get_maintainer.pl --git was most unhelpful showing nothing
I have no idea who to prod about it, I think it is pretty trivial not
needing any discussion.
Andrew Morton pulled in some of the changes to the file, so that's my
primary recipient.
include/linux/ratelimit_types.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/include/linux/ratelimit_types.h b/include/linux/ratelimit_types.h
index 002266693e50..765232ce0b5e 100644
--- a/include/linux/ratelimit_types.h
+++ b/include/linux/ratelimit_types.h
@@ -19,8 +19,8 @@ struct ratelimit_state {
int burst;
int printed;
int missed;
+ unsigned int flags;
unsigned long begin;
- unsigned long flags;
};
#define RATELIMIT_STATE_INIT_FLAGS(name, interval_init, burst_init, flags_init) { \
--
2.43.0
^ permalink raw reply [flat|nested] 2+ messages in thread* Re: [PATCH] ratelimit: convert flags to int to save 8 bytes in size
2024-08-17 12:37 [PATCH] ratelimit: convert flags to int to save 8 bytes in size Mateusz Guzik
@ 2024-08-17 12:41 ` Mateusz Guzik
0 siblings, 0 replies; 2+ messages in thread
From: Mateusz Guzik @ 2024-08-17 12:41 UTC (permalink / raw)
To: akpm; +Cc: linux-kernel, linux-mm
On Sat, Aug 17, 2024 at 02:37:54PM +0200, Mateusz Guzik wrote:
> Only bit 1 is used, making an unsigned long a total overkill.
>
> This brings it from 64 to 32 bytes, which in turn shrinks user_struct
sigh, 40 to 32 bytes of course
this is embedded into user_struct, avoidably pushing it past 128 bytes
of size
> from 136 to 128 bytes. Since the latter is allocated with hwalign, this
> means the total usage goes down from 192 to 128 bytes per object.
>
> No functional changes.
>
> Signed-off-by: Mateusz Guzik <mjguzik@gmail.com>
> ---
>
> ./scripts/get_maintainer.pl --git was most unhelpful showing nothing
>
> I have no idea who to prod about it, I think it is pretty trivial not
> needing any discussion.
>
> Andrew Morton pulled in some of the changes to the file, so that's my
> primary recipient.
>
> include/linux/ratelimit_types.h | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/include/linux/ratelimit_types.h b/include/linux/ratelimit_types.h
> index 002266693e50..765232ce0b5e 100644
> --- a/include/linux/ratelimit_types.h
> +++ b/include/linux/ratelimit_types.h
> @@ -19,8 +19,8 @@ struct ratelimit_state {
> int burst;
> int printed;
> int missed;
> + unsigned int flags;
> unsigned long begin;
> - unsigned long flags;
> };
>
> #define RATELIMIT_STATE_INIT_FLAGS(name, interval_init, burst_init, flags_init) { \
> --
> 2.43.0
>
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2024-08-17 12:42 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-08-17 12:37 [PATCH] ratelimit: convert flags to int to save 8 bytes in size Mateusz Guzik
2024-08-17 12:41 ` Mateusz Guzik
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox