Christoph Hellwig a écrit : > On Thu, Aug 25, 2005 at 11:17:23AM +0200, Eric Dumazet wrote: > >>>But that's not true. You need to write you own sysctl handler for it, >>>probably worth adding a generic atomic_t sysctl handler while you're >>>at it. >>> >> >>I checked linux-2.6.13-rc7 tree, and atomic_read() is just a wrapper to >>read v->counter. > > > That doesn't matter. atomic_t is an opaqueue type and you must use the > atomic_* interfaces to access it. OK, here is a new clean patch that address this problem (nothing assumed about atomics) This patch removes filp_count_lock spinlock, used to protect files_stat.nr_files. Introduce an atomic_t atomic_nr_files to keep the exact count, and mirror its value into nr_files. Forcing atomic_nr_files to be in the same cache line than nr_files makes sure we dont dirty two cache lines. There is still a locked memory operation on SMP, but it saves an sti/cli pair. Thank you Signed-off-by: Eric Dumazet