public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Save some bytes in mm_struct by filling holes on 64bit
@ 2008-03-12 14:28 Andi Kleen
  2008-03-12 18:05 ` Andrew Morton
  2008-03-13 16:40 ` Lennart Sorensen
  0 siblings, 2 replies; 4+ messages in thread
From: Andi Kleen @ 2008-03-12 14:28 UTC (permalink / raw)
  To: akpm, linux-kernel


Save some bytes in mm_struct by filling holes

Putting int values together for better packing on 64bit 
shrinks sizeof(struct mm_struct) from 776 bytes to 760 bytes.

Signed-off-by: Andi Kleen <ak@suse.de>

Index: linux-2.6.25-rc5/include/linux/mm_types.h
===================================================================
--- linux-2.6.25-rc5.orig/include/linux/mm_types.h
+++ linux-2.6.25-rc5/include/linux/mm_types.h
@@ -172,6 +172,7 @@ struct mm_struct {
 	atomic_t mm_users;			/* How many users with user space? */
 	atomic_t mm_count;			/* How many references to "struct mm_struct" (users count as 1) */
 	int map_count;				/* number of VMAs */
+	rwlock_t		ioctx_list_lock;	/* aio lock */
 	struct rw_semaphore mmap_sem;
 	spinlock_t page_table_lock;		/* Protects page tables and some counters */
 
@@ -213,14 +214,13 @@ struct mm_struct {
 	unsigned int token_priority;
 	unsigned int last_interval;
 
+	int core_waiters;
 	unsigned long flags; /* Must use atomic bitops to access the bits */
 
 	/* coredumping support */
-	int core_waiters;
 	struct completion *core_startup_done, core_done;
 
 	/* aio bits */
-	rwlock_t		ioctx_list_lock;
 	struct kioctx		*ioctx_list;
 #ifdef CONFIG_CGROUP_MEM_RES_CTLR
 	struct mem_cgroup *mem_cgroup;

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

* Re: [PATCH] Save some bytes in mm_struct by filling holes on 64bit
  2008-03-12 14:28 [PATCH] Save some bytes in mm_struct by filling holes on 64bit Andi Kleen
@ 2008-03-12 18:05 ` Andrew Morton
  2008-03-12 18:38   ` Andi Kleen
  2008-03-13 16:40 ` Lennart Sorensen
  1 sibling, 1 reply; 4+ messages in thread
From: Andrew Morton @ 2008-03-12 18:05 UTC (permalink / raw)
  To: Andi Kleen; +Cc: linux-kernel

On Wed, 12 Mar 2008 15:28:07 +0100 Andi Kleen <ak@suse.de> wrote:

> 
> Save some bytes in mm_struct by filling holes
> 
> Putting int values together for better packing on 64bit 
> shrinks sizeof(struct mm_struct) from 776 bytes to 760 bytes.
> 
> Signed-off-by: Andi Kleen <ak@suse.de>
> 
> Index: linux-2.6.25-rc5/include/linux/mm_types.h
> ===================================================================
> --- linux-2.6.25-rc5.orig/include/linux/mm_types.h
> +++ linux-2.6.25-rc5/include/linux/mm_types.h
> @@ -172,6 +172,7 @@ struct mm_struct {
>  	atomic_t mm_users;			/* How many users with user space? */
>  	atomic_t mm_count;			/* How many references to "struct mm_struct" (users count as 1) */
>  	int map_count;				/* number of VMAs */
> +	rwlock_t		ioctx_list_lock;	/* aio lock */
>  	struct rw_semaphore mmap_sem;
>  	spinlock_t page_table_lock;		/* Protects page tables and some counters */
>  
> @@ -213,14 +214,13 @@ struct mm_struct {
>  	unsigned int token_priority;
>  	unsigned int last_interval;
>  
> +	int core_waiters;
>  	unsigned long flags; /* Must use atomic bitops to access the bits */
>  
>  	/* coredumping support */
> -	int core_waiters;
>  	struct completion *core_startup_done, core_done;
>  
>  	/* aio bits */
> -	rwlock_t		ioctx_list_lock;
>  	struct kioctx		*ioctx_list;
>  #ifdef CONFIG_CGROUP_MEM_RES_CTLR
>  	struct mem_cgroup *mem_cgroup;

The current ioctx_list_lock position is better from a cache layout POV?

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

* Re: [PATCH] Save some bytes in mm_struct by filling holes on 64bit
  2008-03-12 18:05 ` Andrew Morton
@ 2008-03-12 18:38   ` Andi Kleen
  0 siblings, 0 replies; 4+ messages in thread
From: Andi Kleen @ 2008-03-12 18:38 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linux-kernel


> The current ioctx_list_lock position is better from a cache layout POV?

Hmm ok you're right perhaps it's better to move core_waiters up
instead. Updated  patch
Save some bytes in mm_struct by filling holes v2

Putting int values together for better packing on 64bit 
shrinks sizeof(struct mm_struct) from 776 bytes to 760 bytes.

Signed-off-by: Andi Kleen <ak@suse.de>

Index: linux-2.6.25-rc5/include/linux/mm_types.h
===================================================================
--- linux-2.6.25-rc5.orig/include/linux/mm_types.h
+++ linux-2.6.25-rc5/include/linux/mm_types.h
@@ -172,6 +172,7 @@ struct mm_struct {
 	atomic_t mm_users;			/* How many users with user space? */
 	atomic_t mm_count;			/* How many references to "struct mm_struct" (users 
count as 1) */
 	int map_count;				/* number of VMAs */
+	int core_waiters;
 	struct rw_semaphore mmap_sem;
 	spinlock_t page_table_lock;		/* Protects page tables and some counters */
 
@@ -216,11 +217,10 @@ struct mm_struct {
 	unsigned long flags; /* Must use atomic bitops to access the bits */
 
 	/* coredumping support */
-	int core_waiters;
 	struct completion *core_startup_done, core_done;
 
 	/* aio bits */
-	rwlock_t		ioctx_list_lock;
+	rwlock_t		ioctx_list_lock;	/* aio lock */
 	struct kioctx		*ioctx_list;
 #ifdef CONFIG_CGROUP_MEM_RES_CTLR
 	struct mem_cgroup *mem_cgroup;

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

* Re: [PATCH] Save some bytes in mm_struct by filling holes on 64bit
  2008-03-12 14:28 [PATCH] Save some bytes in mm_struct by filling holes on 64bit Andi Kleen
  2008-03-12 18:05 ` Andrew Morton
@ 2008-03-13 16:40 ` Lennart Sorensen
  1 sibling, 0 replies; 4+ messages in thread
From: Lennart Sorensen @ 2008-03-13 16:40 UTC (permalink / raw)
  To: Andi Kleen; +Cc: akpm, linux-kernel

On Wed, Mar 12, 2008 at 03:28:07PM +0100, Andi Kleen wrote:
> 
> Save some bytes in mm_struct by filling holes
> 
> Putting int values together for better packing on 64bit 
> shrinks sizeof(struct mm_struct) from 776 bytes to 760 bytes.

Are you going to fix the nice comments that mentioned what feature they
were part of now that things are all mixed together?  I wonder if a few
bytes aren't worth paying for readable code.

After all now some 'aio bits' things are not in the 'aio bits' labeled
section.

> Signed-off-by: Andi Kleen <ak@suse.de>
> 
> Index: linux-2.6.25-rc5/include/linux/mm_types.h
> ===================================================================
> --- linux-2.6.25-rc5.orig/include/linux/mm_types.h
> +++ linux-2.6.25-rc5/include/linux/mm_types.h
> @@ -172,6 +172,7 @@ struct mm_struct {
>  	atomic_t mm_users;			/* How many users with user space? */
>  	atomic_t mm_count;			/* How many references to "struct mm_struct" (users count as 1) */
>  	int map_count;				/* number of VMAs */
> +	rwlock_t		ioctx_list_lock;	/* aio lock */
>  	struct rw_semaphore mmap_sem;
>  	spinlock_t page_table_lock;		/* Protects page tables and some counters */
>  
> @@ -213,14 +214,13 @@ struct mm_struct {
>  	unsigned int token_priority;
>  	unsigned int last_interval;
>  
> +	int core_waiters;
>  	unsigned long flags; /* Must use atomic bitops to access the bits */
>  
>  	/* coredumping support */
> -	int core_waiters;
>  	struct completion *core_startup_done, core_done;
>  
>  	/* aio bits */
> -	rwlock_t		ioctx_list_lock;
>  	struct kioctx		*ioctx_list;
>  #ifdef CONFIG_CGROUP_MEM_RES_CTLR
>  	struct mem_cgroup *mem_cgroup;
> --

--
Len Sorensen

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

end of thread, other threads:[~2008-03-13 16:40 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-03-12 14:28 [PATCH] Save some bytes in mm_struct by filling holes on 64bit Andi Kleen
2008-03-12 18:05 ` Andrew Morton
2008-03-12 18:38   ` Andi Kleen
2008-03-13 16:40 ` Lennart Sorensen

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