linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Adam J. Richter" <adam@yggdrasil.com>
To: maneesh@in.ibm.com
Cc: akpm@osdl.org, chrisw@osdl.org, greg@kroah.com,
	linux-kernel@vger.kernel.org,
	viro@parcelfarce.linux.theplanet.co.uk
Subject: [Fake patch] Make sysfs_dirent.s_type an unsigned short
Date: Thu, 2 Dec 2004 19:56:28 -0800	[thread overview]
Message-ID: <200412030356.iB33uSg03460@adam.yggdrasil.com> (raw)

	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;
 };

             reply	other threads:[~2004-12-03  4:06 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-12-03  3:56 Adam J. Richter [this message]
2004-12-03 23:29 ` [Fake patch] Make sysfs_dirent.s_type an unsigned short Greg KH
2004-12-30 13:34 ` Maneesh Soni

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200412030356.iB33uSg03460@adam.yggdrasil.com \
    --to=adam@yggdrasil.com \
    --cc=akpm@osdl.org \
    --cc=chrisw@osdl.org \
    --cc=greg@kroah.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maneesh@in.ibm.com \
    --cc=viro@parcelfarce.linux.theplanet.co.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).