diff mbox series

ratelimit: convert flags to int to save 8 bytes in size

Message ID 20240817123754.240924-1-mjguzik@gmail.com (mailing list archive)
State New
Headers show
Series ratelimit: convert flags to int to save 8 bytes in size | expand

Commit Message

Mateusz Guzik Aug. 17, 2024, 12:37 p.m. UTC
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(-)

Comments

Mateusz Guzik Aug. 17, 2024, 12:41 p.m. UTC | #1
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
> 
>
diff mbox series

Patch

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) { \