Re: [PATCH RFC 0/7] rcu: v2 Inlinable preemptible rcu_read_lock() and rcu_read_unlock()

From: Linus Torvalds
Date: Sat Apr 14 2012 - 12:28:49 EST


On Sat, Apr 14, 2012 at 9:19 AM, Paul E. McKenney
<paulmck@xxxxxxxxxxxxxxxxxx> wrote:
>
> It also compiles this:
>
>        void rcu_read_unlock_code(void)
>        {
>                rcu_read_unlock();
>        }
>
> to this:
>
>        000000e0 <rcu_read_unlock_code>:
>          e0:   64 a1 00 00 00 00       mov    %fs:0x0,%eax
>          e6:   83 f8 01                cmp    $0x1,%eax
>          e9:   74 0d                   je     f8 <rcu_read_unlock_code+0x18>
>          eb:   64 ff 0d 00 00 00 00    decl   %fs:0x0
>          f2:   c3                      ret
>          f3:   90                      nop
>          f4:   8d 74 26 00             lea    0x0(%esi,%eiz,1),%esi
>          f8:   64 c7 05 00 00 00 00    movl   $0x80000000,%fs:0x0
>          ff:   00 00 00 80
>         103:   64 a1 00 00 00 00       mov    %fs:0x0,%eax
>         109:   85 c0                   test   %eax,%eax
>         10b:   75 0c                   jne    119 <rcu_read_unlock_code+0x39>
>         10d:   64 c7 05 00 00 00 00    movl   $0x0,%fs:0x0
>         114:   00 00 00 00
>         118:   c3                      ret
>         119:   8d b4 26 00 00 00 00    lea    0x0(%esi,%eiz,1),%esi
>         120:   e8 fc ff ff ff          call   121 <rcu_read_unlock_code+0x41>
>         125:   eb e6                   jmp    10d <rcu_read_unlock_code+0x2d>
>
> It is therefore not at all clear to me that the final patch in this
> series is worthwhile.

Yeah, the read-unlock does not seem to be worth inlining as-is. As
mentioned earlier, it tends to be the rcu_read_lock() that we really
want to inline anyway (not just because it's small, but also because
the call clobbers registers, and that has other bad interaction).

Linus
--
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/