Date: Wed, 18 Jun 2025 02:13:16 GMT From: Olivier Certner <olce@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: git: de78657a3aef - main - runq: runq_check(): Re-implement on top of runq_findq() Message-ID: <202506180213.55I2DGdV024198@gitrepo.freebsd.org>
next in thread | raw e-mail | index | archive | help
The branch main has been updated by olce: URL: https://cgit.FreeBSD.org/src/commit/?id=de78657a3aef3c2efbcbdf9ea73a95283c91fab0 commit de78657a3aef3c2efbcbdf9ea73a95283c91fab0 Author: Olivier Certner <olce@FreeBSD.org> AuthorDate: 2024-02-29 18:10:58 +0000 Commit: Olivier Certner <olce@FreeBSD.org> CommitDate: 2025-06-18 02:07:59 +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 --- 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?202506180213.55I2DGdV024198>