Mateusz Guzik
23e4903364
fs: predict no error in close()
Vast majority of the time the system call returns 0.
Letting the compiler know shortens the routine (119 -> 116) and the fast
path.
Disasm starting at the call to __fput_sync():
before:
<+55>: call 0xffffffff816b0da0 <__fput_sync>
<+60>: lea 0x201(%rbx),%eax
<+66>: cmp $0x1,%eax
<+69>: jbe 0xffffffff816ab707 <__x64_sys_close+103>
<+71>: mov %ebx,%edx
<+73>: movslq %ebx,%rax
<+76>: and $0xfffffffd,%edx
<+79>: cmp $0xfffffdfc,%edx
<+85>: mov $0xfffffffffffffffc,%rdx
<+92>: cmove %rdx,%rax
<+96>: pop %rbx
<+97>: pop %rbp
<+98>: jmp 0xffffffff82242fa0 <__x86_return_thunk>
<+103>: mov $0xfffffffffffffffc,%rax
<+110>: jmp 0xffffffff816ab700 <__x64_sys_close+96>
<+112>: mov $0xfffffffffffffff7,%rax
<+119>: jmp 0xffffffff816ab700 <__x64_sys_close+96>
after:
<+56>: call 0xffffffff816b0da0 <__fput_sync>
<+61>: xor %eax,%eax
<+63>: test %ebp,%ebp
<+65>: jne 0xffffffff816ab6ea <__x64_sys_close+74>
<+67>: pop %rbx
<+68>: pop %rbp
<+69>: jmp 0xffffffff82242fa0 <__x86_return_thunk> # the jmp out
<+74>: lea 0x201(%rbp),%edx
<+80>: mov $0xfffffffffffffffc,%rax
<+87>: cmp $0x1,%edx
<+90>: jbe 0xffffffff816ab6e3 <__x64_sys_close+67>
<+92>: mov %ebp,%edx
<+94>: and $0xfffffffd,%edx
<+97>: cmp $0xfffffdfc,%edx
<+103>: cmovne %rbp,%rax
<+107>: jmp 0xffffffff816ab6e3 <__x64_sys_close+67>
<+109>: mov $0xfffffffffffffff7,%rax
<+116>: jmp 0xffffffff816ab6e3 <__x64_sys_close+67>
Signed-off-by: Mateusz Guzik <mjguzik@gmail.com>
Link: https://lore.kernel.org/r/20250301104356.246031-1-mjguzik@gmail.com
Signed-off-by: Christian Brauner <brauner@kernel.org>
2025-03-05 18:25:36 +01:00
..
2025-01-30 09:13:35 -08:00
2024-10-08 14:41:53 +02:00
2024-10-08 14:41:53 +02:00
2025-01-30 09:13:35 -08:00
2024-10-28 13:16:56 +01:00
2025-02-01 15:07:56 -08:00
2024-09-18 11:44:43 +02:00
2024-08-07 11:33:21 +02:00
2025-01-26 18:36:23 -08:00
2025-01-28 13:48:37 +01:00
2025-01-31 10:30:34 -08:00
2025-01-30 09:13:35 -08:00
2024-11-14 07:45:20 +01:00
2024-07-15 11:14:59 -07:00
2025-01-27 19:25:23 -05:00
2025-01-30 08:22:31 +01:00
2025-01-28 13:48:37 +01:00
2024-12-19 13:11:24 -06:00
2025-01-27 19:25:23 -05:00
2025-01-22 13:28:17 +01:00
2024-10-15 15:58:36 +02:00
2025-02-01 15:07:56 -08:00
2025-01-30 09:13:35 -08:00
2024-11-15 11:34:57 +01:00
2024-09-16 09:14:02 +02:00
2025-01-30 09:13:35 -08:00
2025-01-27 20:58:58 -08:00
2025-01-27 19:25:24 -05:00
2024-11-06 10:42:06 +01:00
2025-01-30 09:13:35 -08:00
2025-01-30 09:13:35 -08:00
2025-01-30 09:13:35 -08:00
2024-11-18 09:35:30 -08:00
2025-01-31 09:33:54 -08:00
2024-10-08 14:41:53 +02:00
2025-01-25 20:22:30 -08:00
2025-01-26 18:36:23 -08:00
2024-12-05 13:52:37 +01:00
2025-01-22 19:55:08 -08:00
2024-12-05 12:31:40 +01:00
2025-01-27 19:25:23 -05:00
2025-02-01 15:07:56 -08:00
2025-01-28 13:48:37 +01:00
2024-08-07 11:33:36 +02:00
2025-01-20 09:29:11 -08:00
2025-01-30 09:13:35 -08:00
2025-01-21 11:34:43 -05:00
2025-01-28 14:23:46 -08:00
2025-02-01 03:53:26 -08:00
2024-10-02 17:23:23 -04:00
2025-01-28 13:48:37 +01:00
2024-12-30 11:37:40 +03:00
2025-02-01 03:53:24 -08:00
2024-08-07 11:33:21 +02:00
2025-01-31 09:40:31 -08:00
2025-02-01 15:07:56 -08:00
2025-01-30 09:13:35 -08:00
2025-01-20 13:37:14 -08:00
2024-12-03 10:40:36 +01:00
2025-01-28 13:48:37 +01:00
2024-08-21 22:32:58 +02:00
2025-02-01 11:30:41 -08:00
2025-01-24 22:47:22 -08:00
2025-01-09 10:43:58 +01:00
2024-08-07 11:33:36 +02:00
2024-07-22 18:25:47 -07:00
2025-01-27 19:25:23 -05:00
2025-01-18 15:31:35 +01:00
2024-11-26 22:54:24 +01:00
2024-11-12 19:02:12 -05:00
2024-12-11 14:11:23 -08:00
2025-01-30 09:13:35 -08:00
2025-01-28 13:48:37 +01:00
2025-01-28 13:48:37 +01:00
2024-10-02 12:02:15 -07:00
2025-01-28 13:48:37 +01:00
2025-01-27 19:25:45 -05:00
2024-10-10 10:20:51 +02:00
2024-12-02 11:25:09 +01:00
2024-12-11 17:45:18 +01:00
2024-12-11 17:45:18 +01:00
2025-01-10 08:49:05 -08:00
2025-01-20 13:27:58 -08:00
2024-08-07 11:26:54 -07:00
2024-11-23 09:58:07 -08:00
2024-10-22 11:16:57 +02:00
2024-10-17 18:38:49 +01:00
2025-01-28 13:48:37 +01:00
2024-10-07 13:51:47 +02:00
2025-01-30 09:13:35 -08:00
2024-08-19 13:45:02 +02:00
2024-07-24 20:59:29 +02:00
2024-11-03 01:28:06 -05:00
2025-01-28 13:48:37 +01:00
2025-01-28 13:48:37 +01:00
2024-12-09 11:34:29 +01:00
2024-12-17 09:16:11 +01:00
2025-02-01 15:07:56 -08:00
2025-01-20 09:40:49 -08:00
2024-12-22 11:29:52 +01:00
2024-12-21 01:36:17 -05:00
2024-11-13 14:08:34 +01:00
2024-11-03 01:28:06 -05:00
2025-01-28 13:48:37 +01:00
2024-11-18 14:54:10 -08:00
2024-11-03 01:28:06 -05:00
2024-10-21 16:29:38 +02:00
2024-11-03 01:28:06 -05:00
2025-01-30 09:13:35 -08:00
2025-01-28 13:48:37 +01:00
2024-10-21 16:29:38 +02:00
2024-09-24 15:29:42 -07:00
2025-01-09 16:58:54 +01:00
2024-10-28 13:26:54 +01:00
2025-01-30 09:13:35 -08:00
2025-01-28 13:48:37 +01:00
2025-01-09 16:58:52 +01:00
2025-03-05 18:25:36 +01:00
2024-12-22 11:03:10 +01:00
2025-01-28 13:48:37 +01:00
2024-12-22 11:29:52 +01:00
2024-10-22 11:16:59 +02:00
2024-06-28 14:36:43 +02:00
2024-11-18 12:24:06 -08:00
2024-11-03 01:28:06 -05:00
2024-11-03 01:28:07 -05:00
2025-01-13 16:24:16 +01:00
2024-10-22 11:16:57 +02:00
2024-11-03 01:28:06 -05:00
2025-01-25 20:22:31 -08:00
2025-01-09 16:23:17 +01:00
2024-11-03 01:28:06 -05:00
2025-01-25 20:22:23 -08:00
2024-11-03 01:28:06 -05:00
2025-01-28 13:48:37 +01:00
2024-11-19 16:35:06 -08:00
2025-01-28 13:48:37 +01:00
2024-11-03 01:28:06 -05:00
2024-11-06 13:00:01 -05:00