public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Maneesh Soni <maneesh@in.ibm.com>
To: LKML <linux-kernel@vger.kernel.org>
Cc: Greg KH <greg@kroah.com>,
	Al Viro <viro@parcelfarce.linux.theplanet.co.uk>,
	Patrick Mochel <mochel@digitalimplant.org>,
	Dipankar Sarma <dipankar@in.ibm.com>
Subject: [RFC 0/5] sysfs backing store (leaves only)
Date: Mon, 29 Dec 2003 15:02:13 +0530	[thread overview]
Message-ID: <20031229093213.GA1649@in.ibm.com> (raw)


Hi all,

The following patch set(mailed separately) implements a backing store 
mechanism for sysfs filesystem but only for leaf entires. In the previous 
attempt I tried to do backing store for all the entires in sysfs (directories 
& regular files) but that prototype had problems related to coherency between 
sysfs tree and VFS based dentry tree and solution for which will probably need 
VFS layer changes.

In leaves only backing store, attribute files, text or binary, are created on 
demand and there is no need to pin the dentries & inodes corresponding to 
such sysfs files. Generally there are around 60-70% leaf entries in sysfs
tree. Non-regular files (directories and symlinks) are pinned as usual. This
helps in solving the coherency problem as we can use the parent inode's (or
directory's) i_sem while creating, removing or walking files present in 
a given directory.

There are no changes in the way sysfs or kobjects are used. All interfaces
are same and function as without this patch.

Please review the patch set following this posting. I have also collected 
following numbers in support of the backing store.

Test1
-----
Following test shows how dentries are created on demand and are pruned 
whenever there is a memory pressure. 

- after boot
[root@llm04 root]# cat /proc/sys/fs/dentry-state
6900    5783    45      0       0       0

[root@llm04 root]# mount -t sysfs none /sys
[root@llm04 root]# cat /proc/sys/fs/dentry-state
6902    5784    45      0       0       0

[root@llm04 root]# tree /sys | tail -1
848 directories, 2171 files
[root@llm04 root]# cat /proc/sys/fs/dentry-state
9081    7968    45      0       0       0

Ran some memory stress test (mmapstress01 from ltp-full-20031106)
and parallely watching dentry statistics. 

[root@llm04 tmp]# ./mmapstress01 -p 4 -f 1000000000
write error: No space left on device
mmapstress01    1  FAIL  :  Test failed

[root@llm04 root]# while true; do cat /proc/sys/fs/dentry-state; sleep 2; done
9087    7974    45      0       0       0
9089    7976    45      0       0       0
9091    7977    45      0       0       0
9091    7977    45      0       0       0
9091    7977    45      0       0       0
9091    7977    45      0       0       0
9091    7897    45      0       0       0
9091    7879    45      0       0       0
6977    5844    45      0       0       0   <===== dcache pruning started here
6423    5293    45      0       0       0
6422    5294    45      0       0       0
6422    5294    45      0       0       0
6422    5294    45      0       0       0

As the numbers are collected from /proc/sys/fs/dentry-state, they are for 
entire system. But because during measurement there were file creation/removal 
in sysfs tree only, I think we can consider most of them correspond to sysfs.
The test was done on a 4-way SMP box with 512 MB RAM.


Test 2
------
One more test I did was trying to create 4000 scsi_debug disks and observe the 
lowmem statistics on a 2-way SMP box with 4.5 GB RAM.

After creating 4000 debug disks we have the following stats: 
(Please bear that I couldn't actually create 4000 disks because of error I was 
getting regarding scsi generic device (minor number exceeded 255) but I was 
able to create lots of sysfs entries more than 50 thousand.

With backing store patch
========================
		/proc/sys/fs/dentry-state 			LowFree 
no sysfs 	22903   4132    45      0       0       0 	780664 kB
mount 		22904   4133    45      0       0       0 	780600 kB

cat /sys/block/sdk/queue/nr_requests
128
		22905   4134    45      0       0       0 	780600 kB

tree /sys | tail -1
18557 directories, 48510 files
		71410   52639   45      0       0       0 	749040 kB

umount -f /sys/
		22905   4134    45      0       0       0 	780088 kB


Without backing store 
=====================
		/proc/sys/fs/dentry-state; 			LowFree 
no sysfs	71395   4114    45      0       0       0;	 767412 kB
mount sysfs	71396   4115    45      0       0       0;       767476 kB

cat /sys/block/sdk/queue/nr_requests
128
		71396   4115    45      0       0       0;        767540 kB

tree /sys  |tail -1
18557 directories, 48510 files
		71396   4115    45      0       0       0;        767340 kB

umount -f /sys
		71397   4116    45      0       0       0;        767340 kB

As we can see there is no change in Lowmem stats without patch when we
mount or unmount sysfs. Where as with backing store patch we can save approx. 
30 MB of lowmem in when sysfs files are not in use. 

-- 
Maneesh Soni
Linux Technology Center, 
IBM Software Lab, Bangalore, India
email: maneesh@in.ibm.com
Phone: 91-80-5044999 Fax: 91-80-5268553
T/L : 9243696

             reply	other threads:[~2003-12-29  9:34 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-12-29  9:32 Maneesh Soni [this message]
2003-12-29  9:33 ` [RFC 1/5] sysfs backing store (leaves only) - sysfs-leaves-mount.patch Maneesh Soni
2003-12-29  9:34   ` [RFC 1/5] sysfs backing store (leaves only) - sysfs-leaves-dir.patch Maneesh Soni
2003-12-29  9:35     ` [RFC 3/5] sysfs backing store (leaves only) - sysfs-leaves-file.patch Maneesh Soni
2003-12-29  9:35       ` [RFC 4/5] sysfs backing store (leaves only) - sysfs-leaves-bin.patch Maneesh Soni
2003-12-29  9:36         ` [RFC 5/5] sysfs backing store (leaves only) - sysfs-leaves-misc.patch Maneesh Soni
2004-01-02  6:45     ` [RFC 2/5] sysfs backing store (leaves only) - sysfs-leaves-dir.patch 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=20031229093213.GA1649@in.ibm.com \
    --to=maneesh@in.ibm.com \
    --cc=dipankar@in.ibm.com \
    --cc=greg@kroah.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mochel@digitalimplant.org \
    --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