lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-Id: <20250424064832.347177-1-guanwentao@uniontech.com>
Date: Thu, 24 Apr 2025 14:48:32 +0800
From: Wentao Guan <guanwentao@...ontech.com>
To: brauner@...nel.org,
	linux-fsdevel@...r.kernel.org
Cc: viro@...iv.linux.org.uk,
	linux-kernel@...r.kernel.org,
	wangyuli@...ontech.com,
	zhanjun@...ontech.com,
	niecheng1@...ontech.com,
	Wentao Guan <guanwentao@...ontech.com>
Subject: [PATCH] fs/locks: optimize locks_remove_posix

Found by reading the gdb disassemble func,
remove the three lines in the hot path,
and locks_init_lock init them by memset0:
lock.fl_start = 0;
lock.fl_ops = NULL;
lock.fl_lmops = NULL;

Tested in unixbench syscall mircobench mark,
and perf locks_remove_posix from 1.32% to 1%.
Improve the syscall bench from 1858 to 1873.
call path:
99.08% main
- 17.07% __close
...
- 4.85% __arm64_sys_close
- 2.74% filp_flush
- 1.00$ locks_remove_posix

Signed-off-by: Wentao Guan <guanwentao@...ontech.com>
---
 fs/locks.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/fs/locks.c b/fs/locks.c
index 44715c43460a1..14b6ee5e82ed4 100644
--- a/fs/locks.c
+++ b/fs/locks.c
@@ -2554,13 +2554,10 @@ void locks_remove_posix(struct file *filp, fl_owner_t owner)
 	locks_init_lock(&lock);
 	lock.fl_type = F_UNLCK;
 	lock.fl_flags = FL_POSIX | FL_CLOSE;
-	lock.fl_start = 0;
 	lock.fl_end = OFFSET_MAX;
 	lock.fl_owner = owner;
 	lock.fl_pid = current->tgid;
 	lock.fl_file = filp;
-	lock.fl_ops = NULL;
-	lock.fl_lmops = NULL;
 
 	error = vfs_lock_file(filp, F_SETLK, &lock, NULL);
 
-- 
2.20.1


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ