Messages in this thread | | | Subject | Re: [PATCH =-v3 07/21] fanotify: fastpath to ignore certain in core inodes | From | Peter Zijlstra <> | Date | Wed, 12 Nov 2008 23:38:44 +0100 |
| |
On Wed, 2008-11-12 at 11:11 -0500, Eric Paris wrote: > +#ifdef CONFIG_FANOTIFY > + struct list_head fastpath_entries; /* fanotify fastpath entries protected by group */ > + rwlock_t fastpath_rwlock; /* protect the fastpath entries list */ > +#endif
Are you really sure those rwlocks actually gain you performance?
rwlocks are really bad, the critical section must be short because its non-preemptable, but both the lock and unlock are atomic ops that can (and usually will) bounce cachelines. So you often get into the situation where your performance is limited by the cacheline bouncing.
There's also a starvation case in there, where the cacheline is so hot on one package/node that another package/node doesn't get it.
Regular spinlocks are usually faster in those cases (and on those archs that have ticket locks avoid the starvation case too).
And for those cases where the read side is long enough to not be dominated by the cacheline bouncing, RCU is usually the best way out.
| |