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>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20200313031017.71090-1-ling.ma.program@gmail.com>
Date:   Fri, 13 Mar 2020 11:10:17 +0800
From:   ling.ma.program@...il.com
To:     linux-kernel@...r.kernel.org
Cc:     ling.ml@...fin.com
Subject: [RFC PATCH] locks:Remove spinlock in unshare_files

From: Ma Ling <ling.ml@...fin.com>

Processor support atomic operation for long/int/short/char type,
we use the feature to avoid spinlock, which cost hundreds cycles.

Appreciate your comments
Ling

Signed-off-by: Ma Ling <ling.ml@...fin.com>
---
 kernel/fork.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/kernel/fork.c b/kernel/fork.c
index 60a1295..fe54600 100644
--- a/kernel/fork.c
+++ b/kernel/fork.c
@@ -3041,9 +3041,7 @@ int unshare_files(struct files_struct **displaced)
 		return error;
 	}
 	*displaced = task->files;
-	task_lock(task);
-	task->files = copy;
-	task_unlock(task);
+	WRITE_ONCE(task->files, copy);
 	return 0;
 }
 
-- 
1.8.3.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ