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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20070211002020.GA6849@redhat.com>
Date:	Sat, 10 Feb 2007 19:20:20 -0500
From:	Dave Jones <davej@...hat.com>
To:	William Cohen <wcohen@...hat.com>
Cc:	linux-kernel@...r.kernel.org,
	Linus Torvalds <torvalds@...ux-foundation.org>,
	Andrew Morton <akpm@...ux-foundation.org>
Subject: Re: Size of 2.6.20 task_struct on x86_64 machines

On Thu, Feb 08, 2007 at 11:14:13AM -0500, William Cohen wrote:
 > This past week I was playing around with that pahole tool
 > (http://oops.ghostprotocols.net:81/acme/dwarves/) and looking at the
 > size of various struct in the kernel. I was surprised by the size of
 > the task_struct on x86_64, approaching 4K.  I looked through the
 > fields in task_struct and found that a number of them were declared as
 > "unsigned long" rather than "unsigned int" despite them appearing okay
 > as 32-bit sized fields. On x86_64 "unsigned long" ends up being 8
 > bytes in size and forces 8 byte alignment. Is there a reason there
 > a reason they are "unsigned long"?
 > 
 > The patch below drops the size of the struct from 3808 bytes (60
 > 64-byte cachelines) to 3760 bytes (59 64-byte cachelines). A couple
 > other fields in the task struct take a signficant amount of space:
 > 
 > struct thread_struct       thread;               688
 > struct held_lock           held_locks[30];       1680
 > 
 > CONFIG_LOCKDEP is turned on in the .config

I sent this .. http://lkml.org/lkml/2007/1/2/299
last month which shrinks task struct by 480 bytes when lockdep
is enabled. Ingo acked it, but then it fell on the floor.

Here it is again..

		Dave

Shrink the held_lock struct by using bitfields.
This shrinks task_struct on lockdep enabled kernels by 480 bytes.

Signed-off-by: Dave Jones <davej@...hat.com>

diff --git a/include/linux/lockdep.h b/include/linux/lockdep.h
index ea097dd..ba81cce 100644
--- a/include/linux/lockdep.h
+++ b/include/linux/lockdep.h
@@ -175,11 +175,11 @@ struct held_lock {
 	 * The following field is used to detect when we cross into an
 	 * interrupt context:
 	 */
-	int				irq_context;
-	int				trylock;
-	int				read;
-	int				check;
-	int				hardirqs_off;
+	unsigned char irq_context:1;
+	unsigned char trylock:1;
+	unsigned char read:2;
+	unsigned char check:1;
+	unsigned char hardirqs_off:1;
 };
 
 /*

-- 
http://www.codemonkey.org.uk
-
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