Re: [RFC][PATCH] fs: optimize inotify/fsnotify code for unwatched files

From: Dave Hansen
Date: Fri Jun 19 2015 - 20:39:27 EST


On 06/19/2015 04:33 PM, Andi Kleen wrote:
>> > I *think* we can avoid taking the srcu_read_lock() for the
>> > common case where there are no actual marks on the file
>> > being modified *or* the vfsmount.
> What is so expensive in it? Just the memory barrier in it?

The profiling doesn't hit on the mfence directly, but I assume that the
overhead is coming from there. The "mov 0x8(%rdi),%rcx" is identical
before and after the barrier, but it appears much more expensive
_after_. That makes no sense unless the barrier is the thing causing it.

Here's how the annotation mode of 'perf top' breaks it down:

> â ffffffff810fb480 <load0>:
> â nop
> â mov (%rdi),%rax
> 0.58 â push %rbp
> â incl %gs:0x7ef0f488(%rip)
> 1.73 â mov %rsp,%rbp
> â and $0x1,%eax
> â movslq %eax,%rdx
> 0.58 â mov 0x8(%rdi),%rcx
> â incq %gs:(%rcx,%rdx,8)
> â mfence
> 69.94 â add $0x2,%rdx
> 7.51 â mov 0x8(%rdi),%rcx
> 4.05 â incq %gs:(%rcx,%rdx,8)
> 13.87 â decl %gs:0x7ef0f45f(%rip)
> â pop %rbp
> 1.73 â â retq
>

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
Please read the FAQ at http://www.tux.org/lkml/