Date: Mon, 28 Jul 2025 13:31:17 GMT From: Olivier Certner <olce@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org Subject: git: bfd59136bece - stable/14 - runq: runq_check(): Re-implement on top of runq_findq() Message-ID: <202507281331.56SDVH3U080159@gitrepo.freebsd.org>
next in thread | raw e-mail | index | archive | help
The branch stable/14 has been updated by olce: URL: https://cgit.FreeBSD.org/src/commit/?id=bfd59136bece048f2c4646d6e7a1ba48a3ce7a36 commit bfd59136bece048f2c4646d6e7a1ba48a3ce7a36 Author: Olivier Certner <olce@FreeBSD.org> AuthorDate: 2024-02-29 18:10:58 +0000 Commit: Olivier Certner <olce@FreeBSD.org> CommitDate: 2025-07-28 13:28:10 +0000 runq: runq_check(): Re-implement on top of runq_findq() Remove one more loop and duplicated code, with the benefit of less instruction cache pollution at the expense of a few cycles more for the function calls and computing 'idx' (however, this gives a better diagnostic message). Reviewed by: kib MFC after: 1 month Event: Kitchener-Waterloo Hackathon 202506 Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D45387 (cherry picked from commit de78657a3aef3c2efbcbdf9ea73a95283c91fab0) --- sys/kern/kern_switch.c | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/sys/kern/kern_switch.c b/sys/kern/kern_switch.c index a321aecc55fb..59925c10c30d 100644 --- a/sys/kern/kern_switch.c +++ b/sys/kern/kern_switch.c @@ -445,17 +445,15 @@ runq_findq(struct runq *const rq) bool runq_not_empty(struct runq *rq) { - struct rq_status *rqs; + int idx; - rqs = &rq->rq_status; - for (int i = 0; i < RQSW_NB; i++) - if (rqs->rq_sw[i] != 0) { - CTR2(KTR_RUNQ, "runq_not_empty: bits=%#x i=%d", - rqs->rq_sw[i], i); - return (true); - } - CTR0(KTR_RUNQ, "runq_not_empty: empty"); + idx = runq_findq(rq); + if (idx != -1) { + CTR1(KTR_RUNQ, "runq_not_empty: idx=%d", idx); + return (true); + } + CTR0(KTR_RUNQ, "runq_not_empty: empty"); return (false); }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202507281331.56SDVH3U080159>