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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20180827231503.26899-9-adobriyan@gmail.com>
Date:   Tue, 28 Aug 2018 02:14:59 +0300
From:   Alexey Dobriyan <adobriyan@...il.com>
To:     akpm@...ux-foundation.org
Cc:     linux-kernel@...r.kernel.org, Alexey Dobriyan <adobriyan@...il.com>
Subject: [PATCH 09/13] proc: convert dentry flushing on exit to _print_integer()

Benchmark fork+exit+waitpid 2^16 times:

	6.579161299 seconds time elapsed ( +-  0.24% )
	6.482729157 seconds time elapsed ( +-  0.42% )

	-1.5%

Dentry flushing is very small part of exit(2), effects should be more
visible on a tiny 1-page process which doesn't uses libc.

Signed-off-by: Alexey Dobriyan <adobriyan@...il.com>
---
 fs/proc/base.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/fs/proc/base.c b/fs/proc/base.c
index 17666bd61ac8..79d2f7d72ad1 100644
--- a/fs/proc/base.c
+++ b/fs/proc/base.c
@@ -3022,11 +3022,11 @@ static const struct inode_operations proc_tgid_base_inode_operations = {
 static void proc_flush_task_mnt(struct vfsmount *mnt, pid_t pid, pid_t tgid)
 {
 	struct dentry *dentry, *leader, *dir;
-	char buf[10 + 1];
+	char buf[10];
 	struct qstr name;
 
-	name.name = buf;
-	name.len = snprintf(buf, sizeof(buf), "%u", pid);
+	name.name = _print_integer_u32(buf + sizeof(buf), pid);
+	name.len = buf + sizeof(buf) - (char *)name.name;
 	/* no ->d_hash() rejects on procfs */
 	dentry = d_hash_and_lookup(mnt->mnt_root, &name);
 	if (dentry) {
@@ -3037,8 +3037,8 @@ static void proc_flush_task_mnt(struct vfsmount *mnt, pid_t pid, pid_t tgid)
 	if (pid == tgid)
 		return;
 
-	name.name = buf;
-	name.len = snprintf(buf, sizeof(buf), "%u", tgid);
+	name.name = _print_integer_u32(buf + sizeof(buf), tgid);
+	name.len = buf + sizeof(buf) - (char *)name.name;
 	leader = d_hash_and_lookup(mnt->mnt_root, &name);
 	if (!leader)
 		goto out;
@@ -3049,8 +3049,8 @@ static void proc_flush_task_mnt(struct vfsmount *mnt, pid_t pid, pid_t tgid)
 	if (!dir)
 		goto out_put_leader;
 
-	name.name = buf;
-	name.len = snprintf(buf, sizeof(buf), "%u", pid);
+	name.name = _print_integer_u32(buf + sizeof(buf), pid);
+	name.len = buf + sizeof(buf) - (char *)name.name;
 	dentry = d_hash_and_lookup(dir, &name);
 	if (dentry) {
 		d_invalidate(dentry);
-- 
2.16.4

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ