Dipankar Sarma 529bf6be5c [PATCH] fix file counting
I have benchmarked this on an x86_64 NUMA system and see no significant
performance difference on kernbench.  Tested on both x86_64 and powerpc.

The way we do file struct accounting is not very suitable for batched
freeing.  For scalability reasons, file accounting was
constructor/destructor based.  This meant that nr_files was decremented
only when the object was removed from the slab cache.  This is susceptible
to slab fragmentation.  With RCU based file structure, consequent batched
freeing and a test program like Serge's, we just speed this up and end up
with a very fragmented slab -

llm22:~ # cat /proc/sys/fs/file-nr
587730  0       758844

At the same time, I see only a 2000+ objects in filp cache.  The following
patch I fixes this problem.

This patch changes the file counting by removing the filp_count_lock.
Instead we use a separate percpu counter, nr_files, for now and all
accesses to it are through get_nr_files() api.  In the sysctl handler for
nr_files, we populate files_stat.nr_files before returning to user.

Counting files as an when they are created and destroyed (as opposed to
inside slab) allows us to correctly count open files with RCU.

Signed-off-by: Dipankar Sarma <dipankar@in.ibm.com>
Cc: "Paul E. McKenney" <paulmck@us.ibm.com>
Cc: "David S. Miller" <davem@davemloft.net>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-03-08 14:14:01 -08:00
..
2006-01-08 20:14:02 -08:00
2006-02-22 09:32:46 +00:00
2006-01-18 19:20:24 -08:00
2006-01-13 16:29:56 -08:00
2006-01-13 09:12:21 -08:00
2006-02-03 08:32:00 -08:00
2006-02-11 21:41:11 -08:00
2006-01-08 20:14:02 -08:00
2006-01-14 18:27:10 -08:00
2006-01-18 19:20:29 -08:00
2006-03-08 14:14:01 -08:00
2006-03-08 14:14:01 -08:00
2006-01-14 18:27:09 -08:00
2006-02-01 08:53:13 -08:00
2006-02-08 01:03:52 -05:00
2006-02-10 08:13:12 -08:00
2006-02-22 09:39:02 -08:00
2006-01-18 19:20:29 -08:00
2006-01-14 18:27:12 -08:00
2006-02-09 16:43:38 -08:00
2006-03-08 14:14:01 -08:00
2006-01-15 02:12:54 +01:00
2006-03-08 14:14:01 -08:00
2006-01-10 08:01:42 -08:00
2006-01-08 20:14:02 -08:00
2006-01-14 18:27:13 -08:00
2006-02-07 20:56:35 -05:00
2006-01-12 14:06:31 -08:00
2006-02-24 14:31:39 -08:00
2006-02-11 21:41:11 -08:00
2006-01-12 14:06:38 -08:00
2006-01-18 19:20:17 -08:00
2006-02-10 08:13:12 -08:00
2006-01-10 08:01:59 -08:00
2006-02-10 08:13:12 -08:00
2006-02-01 08:53:13 -08:00
2006-01-10 08:01:57 -08:00