From: Cade Richard <cade.richard@gmail.com>
To: kvm@vger.kernel.org, kvm-riscv@lists.infradead.org
Cc: andrew.jones@linux.dev, atishp@rivosinc.com,
cade.richard@berkeley.edu, jamestiotio@gmail.com
Subject: [kvm-unit-tests PATCH] Changed cpumask_next to wrap instead of terminating after nr_cpus.
Date: Sun, 25 Aug 2024 22:40:38 -0700 [thread overview]
Message-ID: <20240826054038.11584-1-cade.richard@berkeley.edu> (raw)
Changed cpumask_next() to wrap instead of terminating after nr_cpus.
Signed-off-by: Cade Richard <cade.richard@berkeley.edu>
---
lib/cpumask.h | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/lib/cpumask.h b/lib/cpumask.h
index be191923..5105c3bd 100644
--- a/lib/cpumask.h
+++ b/lib/cpumask.h
@@ -109,8 +109,10 @@ static inline void cpumask_copy(cpumask_t *dst, const cpumask_t *src)
static inline int cpumask_next(int cpu, const cpumask_t *mask)
{
- while (++cpu < nr_cpus && !cpumask_test_cpu(cpu, mask))
- ;
+ do {
+ if (++cpu > nr_cpus)
+ cpu = 0;
+ } while (!cpumask_test_cpu(cpu, mask));
return cpu;
}
--
2.43.0
next reply other threads:[~2024-08-26 5:40 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-26 5:40 Cade Richard [this message]
2024-08-27 15:21 ` [kvm-unit-tests PATCH] Changed cpumask_next to wrap instead of terminating after nr_cpus Andrew Jones
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240826054038.11584-1-cade.richard@berkeley.edu \
--to=cade.richard@gmail.com \
--cc=andrew.jones@linux.dev \
--cc=atishp@rivosinc.com \
--cc=cade.richard@berkeley.edu \
--cc=jamestiotio@gmail.com \
--cc=kvm-riscv@lists.infradead.org \
--cc=kvm@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox