Skip to contentSkip to conversation

fix VFS nr_files accounting

PATCH In review Randy Dunlap 3 participants 3 messages Jul 3, 2006 – Jul 4, 2006

Subsystems (5)
Networking VFS RCU Proc sysctl +1 more subsystems
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 fix VFS nr_files accounting

lkml discussion: http://thread.gmane.org/gmane.linux.kernel/385438/focus=385478

Already in -mm?

From: Dipankar Sarma <[email protected]>

Ubuntu patch location:
http://www.kernel.org/git/?p=linux/kernel/git/bcollins/ubuntu-dapper.git;a=commitdiff;h=5ce2ed3a63172c6ce0b97069e449960c2d538623

---
 fs/dcache.c              |    2 -
 fs/file_table.c          |   86 +++++++++++++++++------------------------------
 include/linux/file.h     |    2 +
 include/linux/fs.h       |    1 
 include/linux/rcupdate.h |    6 ---
 kernel/rcupdate.c        |   49 +++++++++++++-------------
 kernel/sysctl.c          |    5 --
 net/unix/af_unix.c       |    2 -
 8 files changed, 62 insertions(+), 91 deletions(-)
fs/dcache.c +1 -1
@@ -1765,7 +1765,7 @@ void __init vfs_caches_init(unsigned lon
 			SLAB_HWCACHE_ALIGN|SLAB_PANIC, NULL, NULL);
 
 	filp_cachep = kmem_cache_create("filp", sizeof(struct file), 0,
-			SLAB_HWCACHE_ALIGN|SLAB_PANIC, NULL, NULL);
+			SLAB_HWCACHE_ALIGN|SLAB_PANIC, filp_ctor, filp_dtor);
 
 	dcache_init(mempages);
 	inode_init(mempages);
fs/file_table.c +32 -54

134 lines not on this page · raw message

include/linux/file.h +2 -0
@@ -80,6 +80,8 @@ extern void put_filp(struct file *);
 extern int get_unused_fd(void);
 extern void FASTCALL(put_unused_fd(unsigned int fd));
 struct kmem_cache;
+extern void filp_ctor(void * objp, struct kmem_cache *cachep, unsigned long cflags);
+extern void filp_dtor(void * objp, struct kmem_cache *cachep, unsigned long dflags);
 
 extern struct file ** alloc_fd_array(int);
 extern void free_fd_array(struct file **, int);
include/linux/fs.h +0 -1
@@ -34,7 +34,6 @@ struct files_stat_struct {
 	int max_files;		/* tunable */
 };
 extern struct files_stat_struct files_stat;
-extern int get_max_files(void);
 
 struct inodes_stat_t {
 	int nr_inodes;
include/linux/rcupdate.h +1 -5
@@ -98,17 +98,13 @@ struct rcu_data {
 	long  	       	batch;           /* Batch # for current RCU batch */
 	struct rcu_head *nxtlist;
 	struct rcu_head **nxttail;
-	long            qlen; 	 	 /* # of queued callbacks */
+	long            count; /* # of queued items */
 	struct rcu_head *curlist;
 	struct rcu_head **curtail;
 	struct rcu_head *donelist;
 	struct rcu_head **donetail;
-	long		blimit;		 /* Upper limit on a processed batch */
 	int cpu;
 	struct rcu_head barrier;
-#ifdef CONFIG_SMP
-	long		last_rs_qlen;	 /* qlen during the last resched */
-#endif
 };
 
 DECLARE_PER_CPU(struct rcu_data, rcu_data);
kernel/rcupdate.c +24 -25

104 lines not on this page · raw message

kernel/sysctl.c +1 -4
@@ -49,9 +49,6 @@
 #include <asm/uaccess.h>
 #include <asm/processor.h>
 
-extern int proc_nr_files(ctl_table *table, int write, struct file *filp,
-                     void __user *buffer, size_t *lenp, loff_t *ppos);
-
 #if defined(CONFIG_SYSCTL)
 
 /* External variables not in a header file. */
@@ -971,7 +968,7 @@ static ctl_table fs_table[] = {
 		.data		= &files_stat,
 		.maxlen		= 3*sizeof(int),
 		.mode		= 0444,
-		.proc_handler	= &proc_nr_files,
+		.proc_handler	= &proc_dointvec,
 	},
 	{
 		.ctl_name	= FS_MAXFILE,
net/unix/af_unix.c +1 -1
@@ -570,7 +570,7 @@ static struct sock * unix_create1(struct
 	struct sock *sk = NULL;
 	struct unix_sock *u;
 
-	if (atomic_read(&unix_nr_socks) >= 2*get_max_files())
+	if (atomic_read(&unix_nr_socks) >= 2*files_stat.max_files)
 		goto out;
 
 	sk = sk_alloc(PF_UNIX, GFP_KERNEL, &unix_proto, 1);
#1 lore raw
Quoted 10 lines · On Mon, 03 Jul 2006 13:46:57 -0700 Randy Dunlap <[email protected]> wrote:

lkml discussion: http://thread.gmane.org/gmane.linux.kernel/385438/focus=385478

Already in -mm?

From: Dipankar Sarma <[email protected]>

Ubuntu patch location:
http://www.kernel.org/git/?p=linux/kernel/git/bcollins/ubuntu-dapper.git;a=commitdiff;h=5ce2ed3a63172c6ce0b97069e449960c2d538623

hm. This is actually a reversion of 529bf6be5c04f2e869d07bfdb122e9fd98ade714, so it presumably reintroduces the problem discussed in that lkml thread.

Ben, what's the story here?

Thanks.

#2 lore raw
Quoted 14 lines · Andrew Morton
Quoted 10 lines · On Mon, 03 Jul 2006 13:46:57 -0700 Randy Dunlap <[email protected]> wrote:

lkml discussion: http://thread.gmane.org/gmane.linux.kernel/385438/focus=385478

Already in -mm?

From: Dipankar Sarma <[email protected]>

Ubuntu patch location:
http://www.kernel.org/git/?p=linux/kernel/git/bcollins/ubuntu-dapper.git;a=commitdiff;h=5ce2ed3a63172c6ce0b97069e449960c2d538623

Quoted 5 lines

hm. This is actually a reversion of 529bf6be5c04f2e869d07bfdb122e9fd98ade714, so it presumably reintroduces the problem discussed in that lkml thread.

Ben, what's the story here?

This was pulled in to try to fix some problems we were seeing on sparc64. However, this backported patch broke other architectures (I think x86_64 wouldn't even boot), so was reverted.

I can't remember any more details than that.

Signature · 4 lines
Ubuntu     - http://www.ubuntu.com/
Debian     - http://www.debian.org/
Linux 1394 - http://www.linux1394.org/
SwissDisk  - http://www.swissdisk.com/