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: <5319159bd74f4c4c9979c748b216b2f8@kioxia.com>
Date: Tue, 26 Mar 2024 10:29:31 +0000
From: tada keisuke <keisuke1.tada@...xia.com>
To: "song@...nel.org" <song@...nel.org>,
        "yukuai3@...wei.com"
	<yukuai3@...wei.com>
CC: "linux-raid@...r.kernel.org" <linux-raid@...r.kernel.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: [PATCH 04/11] md: minimize execution of zero check for nr_pending

This patch depends on patch 02.

The Faulty flag is required for the if statement to be true.
A rdev in Faulty state does not issue I/O commands.
So, nr_pending is also not increased.
Therefore, decrement and zero check of nr_pending can be separated and still be consistent.

Signed-off-by: Keisuke TADA <keisuke1.tada@...xia.com>
Signed-off-by: Toshifumi OHTAKE <toshifumi.ootake@...xia.com>
---
 drivers/md/md.h | 14 ++++++--------
 1 file changed, 6 insertions(+), 8 deletions(-)

diff --git a/drivers/md/md.h b/drivers/md/md.h
index b990be0981bc..ed7e36212d58 100644
--- a/drivers/md/md.h
+++ b/drivers/md/md.h
@@ -236,11 +236,6 @@ static inline unsigned int nr_pending_read(struct md_rdev *rdev)
 	return atomic_read(&rdev->nr_pending);
 }
 
-static inline bool nr_pending_dec_and_test(struct md_rdev *rdev)
-{
-	return atomic_dec_and_test(&rdev->nr_pending);
-}
-
 static inline int is_badblock(struct md_rdev *rdev, sector_t s, int sectors,
 			      sector_t *first_bad, int *bad_sectors)
 {
@@ -875,9 +870,12 @@ static inline bool is_rdev_broken(struct md_rdev *rdev)
 static inline void rdev_dec_pending(struct md_rdev *rdev, struct mddev *mddev)
 {
 	int faulty = test_bit(Faulty, &rdev->flags);
-	if (nr_pending_dec_and_test(rdev) && faulty) {
-		set_bit(MD_RECOVERY_NEEDED, &mddev->recovery);
-		md_wakeup_thread(mddev->thread);
+	nr_pending_dec(rdev);
+	if (faulty) {
+		if (nr_pending_is_zero(rdev)) {
+			set_bit(MD_RECOVERY_NEEDED, &mddev->recovery);
+			md_wakeup_thread(mddev->thread);
+		}
 	}
 }
 
-- 
2.34.1


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ