lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Date:	Fri, 13 Aug 2010 11:40:42 +0200
From:	Andrea Righi <arighi@...eler.com>
To:	Nick Piggin <npiggin@...nel.dk>
Cc:	Andrew Morton <akpm@...ux-foundation.org>,
	linux-kernel@...r.kernel.org
Subject: [PATCH] brd: removed unused brd_device attributes

Save some bytes removing unused attributes of struct brd_device.

Before:
[arighi@...ux: linux-2.6]$ pahole --cacheline 32 -C brd_device drivers/block/brd.o
struct brd_device {
	int                        brd_number;           /*     0     4 */
	int                        brd_refcnt;           /*     4     4 */
	loff_t                     brd_offset;           /*     8     8 */
	loff_t                     brd_sizelimit;        /*    16     8 */
	unsigned int               brd_blocksize;        /*    24     4 */

	/* XXX 4 bytes hole, try to pack */

	/* --- cacheline 1 boundary (32 bytes) --- */
	struct request_queue *     brd_queue;            /*    32     8 */
	struct gendisk *           brd_disk;             /*    40     8 */
	struct list_head           brd_list;             /*    48    16 */
	/* --- cacheline 2 boundary (64 bytes) --- */
	spinlock_t                 brd_lock;             /*    64     4 */

	/* XXX 4 bytes hole, try to pack */

	struct radix_tree_root     brd_pages;            /*    72    16 */

	/* size: 88, cachelines: 3 */
	/* sum members: 80, holes: 2, sum holes: 8 */
	/* last cacheline: 24 bytes */
};

After:
[arighi@...ux: linux-2.6]$ pahole --cacheline 32 -C brd_device drivers/block/brd.o
struct brd_device {
	struct list_head           brd_list;             /*     0    16 */
	struct request_queue *     brd_queue;            /*    16     8 */
	struct gendisk *           brd_disk;             /*    24     8 */
	/* --- cacheline 1 boundary (32 bytes) --- */
	struct radix_tree_root     brd_pages;            /*    32    16 */
	spinlock_t                 brd_lock;             /*    48     4 */
	int                        brd_number;           /*    52     4 */

	/* size: 56, cachelines: 2 */
	/* last cacheline: 24 bytes */
};

Signed-off-by: Andrea Righi <arighi@...eler.com>
---
 drivers/block/brd.c |   17 +++++++----------
 1 files changed, 7 insertions(+), 10 deletions(-)

diff --git a/drivers/block/brd.c b/drivers/block/brd.c
index 1c7f637..5044f8c 100644
--- a/drivers/block/brd.c
+++ b/drivers/block/brd.c
@@ -34,22 +34,19 @@
  * device).
  */
 struct brd_device {
-	int		brd_number;
-	int		brd_refcnt;
-	loff_t		brd_offset;
-	loff_t		brd_sizelimit;
-	unsigned	brd_blocksize;
-
-	struct request_queue	*brd_queue;
-	struct gendisk		*brd_disk;
-	struct list_head	brd_list;
 
 	/*
 	 * Backing store of pages and lock to protect it. This is the contents
 	 * of the block device.
 	 */
-	spinlock_t		brd_lock;
+	struct list_head	brd_list;
+
+	struct request_queue	*brd_queue;
+	struct gendisk		*brd_disk;
 	struct radix_tree_root	brd_pages;
+	/* Protect access to the radix tree */
+	spinlock_t		brd_lock;
+	int brd_number;
 };
 
 /*
-- 
1.7.0.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ