Re: [PATCH =-v3 07/21] fanotify: fastpath to ignore certain incore inodes

From: Peter Zijlstra
Date: Wed Nov 12 2008 - 17:39:47 EST


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.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/