Calls to vop_bypass pass the same argument,, but type casted to something else. Thus by replacing NULL routines with vop_bypass we avoid a runtime check.
Details
Details
Diff Detail
Diff Detail
- Repository
- rS FreeBSD src repository - subversion
- Lint
Lint Not Applicable - Unit
Tests Not Applicable
Event Timeline
Comment Actions
@@ -2078,14 +1985,11 @@ KTR_START4(KTR_VOP, "VOP", "VOP_LOCK1", (uintptr_t)a, "vp:0x%jX", (uintptr_t)a->a_vp, "flags:0x%jX", a->a_flags, "file:0x%jX", a->a_ file, "line:0x%jX", a->a_line); vop_lock_pre(a); - if (__predict_true(!SDT_PROBES_ENABLED() && vop->vop_lock1 != NULL)) { + if (!SDT_PROBES_ENABLED()) { rc = vop->vop_lock1(a); } else { SDT_PROBE2(vfs, vop, vop_lock1, entry, a->a_vp, a); - if (vop->vop_lock1 != NULL) - rc = vop->vop_lock1(a); - else - rc = vop->vop_bypass(&a->a_gen); + rc = vop->vop_lock1(a); SDT_PROBE3(vfs, vop, vop_lock1, return, a->a_vp, a, rc); } if (rc == 0) {
assembly-wise the expected case
orig:
0xffffffff8094dbd0 <+0>: push %rbp 0xffffffff8094dbd1 <+1>: mov %rsp,%rbp 0xffffffff8094dbd4 <+4>: push %r14 0xffffffff8094dbd6 <+6>: push %rbx 0xffffffff8094dbd7 <+7>: mov %rsi,%r14 0xffffffff8094dbda <+10>: mov %rdi,%rbx 0xffffffff8094dbdd <+13>: cmpb $0x0,0x2b3432(%rip) # 0xffffffff80c01016 <sdt_probes_enabled> 0xffffffff8094dbe4 <+20>: jne 0xffffffff8094dbfb <VOP_LOCK1_APV+43> 0xffffffff8094dbe6 <+22>: mov 0x108(%rbx),%rax 0xffffffff8094dbed <+29>: test %rax,%rax 0xffffffff8094dbf0 <+32>: je 0xffffffff8094dbfb <VOP_LOCK1_APV+43> 0xffffffff8094dbf2 <+34>: mov %r14,%rdi 0xffffffff8094dbf5 <+37>: pop %rbx 0xffffffff8094dbf6 <+38>: pop %r14 0xffffffff8094dbf8 <+40>: pop %rbp 0xffffffff8094dbf9 <+41>: jmpq *%rax 0xffffffff8094dbfb <+43>: cmpb $0x0,0x2b3414(%rip) # 0xffffffff80c01016 <sdt_probes_enabled> 0xffffffff8094dc02 <+50>: jne 0xffffffff8094dc2c <VOP_LOCK1_APV+92> 0xffffffff8094dc04 <+52>: mov 0x108(%rbx),%rax 0xffffffff8094dc0b <+59>: mov %r14,%rdi 0xffffffff8094dc0e <+62>: test %rax,%rax 0xffffffff8094dc11 <+65>: je 0xffffffff8094dc17 <VOP_LOCK1_APV+71> 0xffffffff8094dc13 <+67>: callq *%rax 0xffffffff8094dc15 <+69>: jmp 0xffffffff8094dc1a <VOP_LOCK1_APV+74> 0xffffffff8094dc17 <+71>: callq *0x8(%rbx) 0xffffffff8094dc1a <+74>: mov %eax,%ebx 0xffffffff8094dc1c <+76>: cmpb $0x0,0x2b33f3(%rip) # 0xffffffff80c01016 <sdt_probes_enabled> 0xffffffff8094dc23 <+83>: jne 0xffffffff8094dc4f <VOP_LOCK1_APV+127> 0xffffffff8094dc25 <+85>: mov %ebx,%eax 0xffffffff8094dc27 <+87>: pop %rbx 0xffffffff8094dc28 <+88>: pop %r14 0xffffffff8094dc2a <+90>: pop %rbp 0xffffffff8094dc2b <+91>: retq
patched:
0xffffffff8094de50 <+0>: push %rbp 0xffffffff8094de51 <+1>: mov %rsp,%rbp 0xffffffff8094de54 <+4>: push %r14 0xffffffff8094de56 <+6>: push %rbx 0xffffffff8094de57 <+7>: mov %rsi,%rbx 0xffffffff8094de5a <+10>: mov %rdi,%rax 0xffffffff8094de5d <+13>: cmpb $0x0,0x2b31b2(%rip) # 0xffffffff80c01016 <sdt_probes_enabled> 0xffffffff8094de64 <+20>: jne 0xffffffff8094de73 <VOP_LOCK1_APV+35> 0xffffffff8094de66 <+22>: mov %rbx,%rdi 0xffffffff8094de69 <+25>: pop %rbx 0xffffffff8094de6a <+26>: pop %r14 0xffffffff8094de6c <+28>: pop %rbp 0xffffffff8094de6d <+29>: jmpq *0x108(%rax) 0xffffffff8094de73 <+35>: cmpb $0x0,0x2b319c(%rip) # 0xffffffff80c01016 <sdt_probes_enabled> 0xffffffff8094de7a <+42>: jne 0xffffffff8094de99 <VOP_LOCK1_APV+73> 0xffffffff8094de7c <+44>: mov %rbx,%rdi 0xffffffff8094de7f <+47>: callq *0x108(%rax) 0xffffffff8094de85 <+53>: mov %eax,%r14d 0xffffffff8094de88 <+56>: cmpb $0x0,0x2b3187(%rip) # 0xffffffff80c01016 <sdt_probes_enabled> 0xffffffff8094de8f <+63>: jne 0xffffffff8094dec2 <VOP_LOCK1_APV+114> 0xffffffff8094de91 <+65>: mov %r14d,%eax 0xffffffff8094de94 <+68>: pop %rbx 0xffffffff8094de95 <+69>: pop %r14 0xffffffff8094de97 <+71>: pop %rbp 0xffffffff8094de98 <+72>: retq