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-prev] [day] [month] [year] [list]
Message-ID: <169479133040.27769.13340324338034270661.tip-bot2@tip-bot2>
Date:   Fri, 15 Sep 2023 15:22:10 -0000
From:   "tip-bot2 for Uros Bizjak" <tip-bot2@...utronix.de>
To:     linux-tip-commits@...r.kernel.org
Cc:     Uros Bizjak <ubizjak@...il.com>, Ingo Molnar <mingo@...nel.org>,
        x86@...nel.org, linux-kernel@...r.kernel.org
Subject: [tip: sched/core] sched/core: Use do-while instead of for loop in
 set_nr_if_polling()

The following commit has been merged into the sched/core branch of tip:

Commit-ID:     4ff34ad3d39377d9f6953f3606ccf611ce636767
Gitweb:        https://git.kernel.org/tip/4ff34ad3d39377d9f6953f3606ccf611ce636767
Author:        Uros Bizjak <ubizjak@...il.com>
AuthorDate:    Tue, 28 Feb 2023 17:14:26 +01:00
Committer:     Ingo Molnar <mingo@...nel.org>
CommitterDate: Fri, 15 Sep 2023 17:18:02 +02:00

sched/core: Use do-while instead of for loop in set_nr_if_polling()

Use equivalent do-while loop instead of infinite for loop.

There are no asm code changes.

Signed-off-by: Uros Bizjak <ubizjak@...il.com>
Signed-off-by: Ingo Molnar <mingo@...nel.org>
Link: https://lore.kernel.org/r/20230228161426.4508-1-ubizjak@gmail.com
---
 kernel/sched/core.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index 76662d8..f39482d 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -919,14 +919,13 @@ static bool set_nr_if_polling(struct task_struct *p)
 	struct thread_info *ti = task_thread_info(p);
 	typeof(ti->flags) val = READ_ONCE(ti->flags);
 
-	for (;;) {
+	do {
 		if (!(val & _TIF_POLLING_NRFLAG))
 			return false;
 		if (val & _TIF_NEED_RESCHED)
 			return true;
-		if (try_cmpxchg(&ti->flags, &val, val | _TIF_NEED_RESCHED))
-			break;
-	}
+	} while (!try_cmpxchg(&ti->flags, &val, val | _TIF_NEED_RESCHED));
+
 	return true;
 }
 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ