linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [Fake patch] Make sysfs_dirent.s_type an unsigned short
@ 2004-12-03  3:56 Adam J. Richter
  2004-12-03 23:29 ` Greg KH
  2004-12-30 13:34 ` Maneesh Soni
  0 siblings, 2 replies; 3+ messages in thread
From: Adam J. Richter @ 2004-12-03  3:56 UTC (permalink / raw)
  To: maneesh; +Cc: akpm, chrisw, greg, linux-kernel, viro

	Here is a fake patch against my heavily hacked sysfs tree
to change sysfs_dirent.s_type from an int to an unsigned short.
It appears next to another unsigned short (s_mode), so it should
save 4 bytes per sysfs node.

	Note that this patch will not apply to a pristine 2.6.10-rc2-bk15
tree, because I've moved the declaration of struct sysfs_dirent
from include/linux/sysfs.h to fs/sysfs/sysfs.h in a previous patch.

	By the way, I have to sheepishly admit that somehow I previously
underestimated the size of struct sysfs_dirent.  Only now
with s_children and s_count removed and s_type shortened to 16 bits
does sysfs_dirent occupy 32 bytes, according to /proc/slabinfo.
This does not effect my previous statements about how much memory
is saved by each of the patches that I've posted.  It just means
the original amount of memory being used was more.

                    __     ______________
Adam J. Richter        \ /
adam@yggdrasil.com      | g g d r a s i l

--- linux.prev/fs/sysfs/sysfs.h	2004-12-03 11:51:19.000000000 +0800
+++ linux/fs/sysfs/sysfs.h	2004-12-03 00:51:44.000000000 +0800
@@ -13,7 +13,7 @@
 struct sysfs_dirent {
 	struct list_head	s_sibling;
 	void 			* s_element;
-	int			s_type;
+	unsigned short		s_type;
 	umode_t			s_mode;
 	struct dentry		* s_dentry;
 };

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

* Re: [Fake patch] Make sysfs_dirent.s_type an unsigned short
  2004-12-03  3:56 [Fake patch] Make sysfs_dirent.s_type an unsigned short Adam J. Richter
@ 2004-12-03 23:29 ` Greg KH
  2004-12-30 13:34 ` Maneesh Soni
  1 sibling, 0 replies; 3+ messages in thread
From: Greg KH @ 2004-12-03 23:29 UTC (permalink / raw)
  To: Adam J. Richter; +Cc: maneesh, akpm, chrisw, linux-kernel, viro

On Thu, Dec 02, 2004 at 07:56:28PM -0800, Adam J. Richter wrote:
> 	Here is a fake patch against my heavily hacked sysfs tree
> to change sysfs_dirent.s_type from an int to an unsigned short.
> It appears next to another unsigned short (s_mode), so it should
> save 4 bytes per sysfs node.

Note, Maneesh is currently moving across continents so he's going to be
away from email for a while.  I'm queuing up most of these changes to go
in after 2.6.10 is out, as most of them look good.

thanks,

greg k-h

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

* Re: [Fake patch] Make sysfs_dirent.s_type an unsigned short
  2004-12-03  3:56 [Fake patch] Make sysfs_dirent.s_type an unsigned short Adam J. Richter
  2004-12-03 23:29 ` Greg KH
@ 2004-12-30 13:34 ` Maneesh Soni
  1 sibling, 0 replies; 3+ messages in thread
From: Maneesh Soni @ 2004-12-30 13:34 UTC (permalink / raw)
  To: Adam J. Richter; +Cc: akpm, chrisw, greg, linux-kernel, viro

On Fri, Dec 03, 2004 at 04:08:58AM +0000, Adam J. Richter wrote:
> 	Here is a fake patch against my heavily hacked sysfs tree
> to change sysfs_dirent.s_type from an int to an unsigned short.
> It appears next to another unsigned short (s_mode), so it should
> save 4 bytes per sysfs node.
> 
> 	Note that this patch will not apply to a pristine 2.6.10-rc2-bk15
> tree, because I've moved the declaration of struct sysfs_dirent
> from include/linux/sysfs.h to fs/sysfs/sysfs.h in a previous patch.
> 
> 	By the way, I have to sheepishly admit that somehow I previously
> underestimated the size of struct sysfs_dirent.  Only now
> with s_children and s_count removed and s_type shortened to 16 bits
> does sysfs_dirent occupy 32 bytes, according to /proc/slabinfo.
> This does not effect my previous statements about how much memory
> is saved by each of the patches that I've posted.  It just means
> the original amount of memory being used was more.
> 

Looks sane.

Thanks
Maneesh

> --- linux.prev/fs/sysfs/sysfs.h	2004-12-03 11:51:19.000000000 +0800
> +++ linux/fs/sysfs/sysfs.h	2004-12-03 00:51:44.000000000 +0800
> @@ -13,7 +13,7 @@
>  struct sysfs_dirent {
>  	struct list_head	s_sibling;
>  	void 			* s_element;
> -	int			s_type;
> +	unsigned short		s_type;
>  	umode_t			s_mode;
>  	struct dentry		* s_dentry;
>  };
> -

-- 
Maneesh Soni
Linux Technology Center, 
IBM India Software Labs,
Bangalore, India
email: maneesh@in.ibm.com
Phone: 91-80-25044990

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

end of thread, other threads:[~2004-12-30 13:39 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-12-03  3:56 [Fake patch] Make sysfs_dirent.s_type an unsigned short Adam J. Richter
2004-12-03 23:29 ` Greg KH
2004-12-30 13:34 ` Maneesh Soni

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).