All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] dm: eliminate some holes in data structures
@ 2009-12-16  3:49 Mike Snitzer
  2009-12-16 19:25 ` Jonathan Brassow
  2009-12-18 22:28 ` Mike Snitzer
  0 siblings, 2 replies; 3+ messages in thread
From: Mike Snitzer @ 2009-12-16  3:49 UTC (permalink / raw)
  To: dm-devel

Eliminate 1 4-byte hole in 'struct dm_io_memory' by moving 'offset'
above the 'ptr' to which it applies (size reduced from 24 to 16 bytes).
And by association, 1 4 byte hole is eliminated in 'struct
dm_io_request' (size reduced from 56 to 48 bytes).

Eliminate all (3 4-byte) holes (and one cache-line) in 'struct
dm_snapshot' by moving 'pending_pool' after 'pending_exceptions_count'
and moving 'merge_failed' lower (size reduced from 648 to 632 bytes).

Signed-off-by: Mike Snitzer <snitzer@redhat.com>
---
 drivers/md/dm-snap.c  |   18 +++++++++---------
 include/linux/dm-io.h |    4 ++--
 2 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/drivers/md/dm-snap.c b/drivers/md/dm-snap.c
index ee8eb28..0435442 100644
--- a/drivers/md/dm-snap.c
+++ b/drivers/md/dm-snap.c
@@ -83,10 +83,10 @@ struct dm_snapshot {
 	/* Whether or not owning mapped_device is suspended */
 	int suspended;
 
-	mempool_t *pending_pool;
-
 	atomic_t pending_exceptions_count;
 
+	mempool_t *pending_pool;
+
 	struct dm_exception_table pending;
 	struct dm_exception_table complete;
 
@@ -110,6 +110,13 @@ struct dm_snapshot {
 	spinlock_t tracked_chunk_lock;
 	struct hlist_head tracked_chunk_hash[DM_TRACKED_CHUNK_HASH_SIZE];
 
+	/* Wait for events based on state_bits */
+	unsigned long state_bits;
+
+	/* Range of chunks currently being merged. */
+	chunk_t first_merging_chunk;
+	int num_merging_chunks;
+
 	/*
 	 * The merge operation failed if this flag is set.
 	 * Failure modes are handled as follows:
@@ -125,13 +132,6 @@ struct dm_snapshot {
 	 */
 	int merge_failed;
 
-	/* Wait for events based on state_bits */
-	unsigned long state_bits;
-
-	/* Range of chunks currently being merged. */
-	chunk_t first_merging_chunk;
-	int num_merging_chunks;
-
 	/*
 	 * Incoming bios that overlap with chunks being merged must wait
 	 * for them to be committed.
diff --git a/include/linux/dm-io.h b/include/linux/dm-io.h
index b6bf17e..5c9186b 100644
--- a/include/linux/dm-io.h
+++ b/include/linux/dm-io.h
@@ -37,14 +37,14 @@ enum dm_io_mem_type {
 struct dm_io_memory {
 	enum dm_io_mem_type type;
 
+	unsigned offset;
+
 	union {
 		struct page_list *pl;
 		struct bio_vec *bvec;
 		void *vma;
 		void *addr;
 	} ptr;
-
-	unsigned offset;
 };
 
 struct dm_io_notify {

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

* Re: [PATCH] dm: eliminate some holes in data structures
  2009-12-16  3:49 [PATCH] dm: eliminate some holes in data structures Mike Snitzer
@ 2009-12-16 19:25 ` Jonathan Brassow
  2009-12-18 22:28 ` Mike Snitzer
  1 sibling, 0 replies; 3+ messages in thread
From: Jonathan Brassow @ 2009-12-16 19:25 UTC (permalink / raw)
  To: device-mapper development

ACK  (Reviewed-by)

  brassow

On Dec 15, 2009, at 9:49 PM, Mike Snitzer wrote:

> Eliminate 1 4-byte hole in 'struct dm_io_memory' by moving 'offset'
> above the 'ptr' to which it applies (size reduced from 24 to 16  
> bytes).
> And by association, 1 4 byte hole is eliminated in 'struct
> dm_io_request' (size reduced from 56 to 48 bytes).
>
> Eliminate all (3 4-byte) holes (and one cache-line) in 'struct
> dm_snapshot' by moving 'pending_pool' after 'pending_exceptions_count'
> and moving 'merge_failed' lower (size reduced from 648 to 632 bytes).
>
> Signed-off-by: Mike Snitzer <snitzer@redhat.com>
> ---
> drivers/md/dm-snap.c  |   18 +++++++++---------
> include/linux/dm-io.h |    4 ++--
> 2 files changed, 11 insertions(+), 11 deletions(-)
>
> diff --git a/drivers/md/dm-snap.c b/drivers/md/dm-snap.c
> index ee8eb28..0435442 100644
> --- a/drivers/md/dm-snap.c
> +++ b/drivers/md/dm-snap.c
> @@ -83,10 +83,10 @@ struct dm_snapshot {
> 	/* Whether or not owning mapped_device is suspended */
> 	int suspended;
>
> -	mempool_t *pending_pool;
> -
> 	atomic_t pending_exceptions_count;
>
> +	mempool_t *pending_pool;
> +
> 	struct dm_exception_table pending;
> 	struct dm_exception_table complete;
>
> @@ -110,6 +110,13 @@ struct dm_snapshot {
> 	spinlock_t tracked_chunk_lock;
> 	struct hlist_head tracked_chunk_hash[DM_TRACKED_CHUNK_HASH_SIZE];
>
> +	/* Wait for events based on state_bits */
> +	unsigned long state_bits;
> +
> +	/* Range of chunks currently being merged. */
> +	chunk_t first_merging_chunk;
> +	int num_merging_chunks;
> +
> 	/*
> 	 * The merge operation failed if this flag is set.
> 	 * Failure modes are handled as follows:
> @@ -125,13 +132,6 @@ struct dm_snapshot {
> 	 */
> 	int merge_failed;
>
> -	/* Wait for events based on state_bits */
> -	unsigned long state_bits;
> -
> -	/* Range of chunks currently being merged. */
> -	chunk_t first_merging_chunk;
> -	int num_merging_chunks;
> -
> 	/*
> 	 * Incoming bios that overlap with chunks being merged must wait
> 	 * for them to be committed.
> diff --git a/include/linux/dm-io.h b/include/linux/dm-io.h
> index b6bf17e..5c9186b 100644
> --- a/include/linux/dm-io.h
> +++ b/include/linux/dm-io.h
> @@ -37,14 +37,14 @@ enum dm_io_mem_type {
> struct dm_io_memory {
> 	enum dm_io_mem_type type;
>
> +	unsigned offset;
> +
> 	union {
> 		struct page_list *pl;
> 		struct bio_vec *bvec;
> 		void *vma;
> 		void *addr;
> 	} ptr;
> -
> -	unsigned offset;
> };
>
> struct dm_io_notify {
>
> --
> dm-devel mailing list
> dm-devel@redhat.com
> https://www.redhat.com/mailman/listinfo/dm-devel

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

* Re: dm: eliminate some holes in data structures
  2009-12-16  3:49 [PATCH] dm: eliminate some holes in data structures Mike Snitzer
  2009-12-16 19:25 ` Jonathan Brassow
@ 2009-12-18 22:28 ` Mike Snitzer
  1 sibling, 0 replies; 3+ messages in thread
From: Mike Snitzer @ 2009-12-18 22:28 UTC (permalink / raw)
  To: dm-devel

On Tue, Dec 15 2009 at 10:49pm -0500,
Mike Snitzer <snitzer@redhat.com> wrote:

> Eliminate 1 4-byte hole in 'struct dm_io_memory' by moving 'offset'
> above the 'ptr' to which it applies (size reduced from 24 to 16 bytes).
> And by association, 1 4 byte hole is eliminated in 'struct
> dm_io_request' (size reduced from 56 to 48 bytes).
> 
> Eliminate all (3 4-byte) holes (and one cache-line) in 'struct
> dm_snapshot' by moving 'pending_pool' after 'pending_exceptions_count'
> and moving 'merge_failed' lower (size reduced from 648 to 632 bytes).

As it happens, I had compiled with CONFIG_DEBUG_SPINLOCK et al.  That
explains why dm_snapshot was so large.  If I use a "production" .config
I need the following incremental patch to eliminate all 6 4-byte holes
in 'struct dm_snapshot' (reduces size from 392 to 368 bytes):

diff --git a/drivers/md/dm-snap.c b/drivers/md/dm-snap.c
index 0435442..ab9822e 100644
--- a/drivers/md/dm-snap.c
+++ b/drivers/md/dm-snap.c
@@ -96,6 +96,11 @@ struct dm_snapshot {
 	 */
 	spinlock_t pe_lock;
 
+	/* Chunks with outstanding reads */
+	spinlock_t tracked_chunk_lock;
+	mempool_t *tracked_chunk_pool;
+	struct hlist_head tracked_chunk_hash[DM_TRACKED_CHUNK_HASH_SIZE];
+
 	/* The on disk metadata handler */
 	struct dm_exception_store *store;
 
@@ -105,11 +110,6 @@ struct dm_snapshot {
 	struct bio_list queued_bios;
 	struct work_struct queued_bios_work;
 
-	/* Chunks with outstanding reads */
-	mempool_t *tracked_chunk_pool;
-	spinlock_t tracked_chunk_lock;
-	struct hlist_head tracked_chunk_hash[DM_TRACKED_CHUNK_HASH_SIZE];
-
 	/* Wait for events based on state_bits */
 	unsigned long state_bits;
 

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

end of thread, other threads:[~2009-12-18 22:28 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-12-16  3:49 [PATCH] dm: eliminate some holes in data structures Mike Snitzer
2009-12-16 19:25 ` Jonathan Brassow
2009-12-18 22:28 ` Mike Snitzer

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.