Date: Tue, 27 Feb 2024 09:00:19 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: aeff15b392e6 - main - sched: Simplify sched_lend_user_prio_cond() Message-ID: <202402270900.41R90J0H004688@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=aeff15b392e68f5f193fff3bb01728b965cacc3a commit aeff15b392e68f5f193fff3bb01728b965cacc3a Author: Olivier Certner <olce@FreeBSD.org> AuthorDate: 2024-02-09 18:03:22 +0000 Commit: Olivier Certner <olce@FreeBSD.org> CommitDate: 2024-02-27 08:59:48 +0000 sched: Simplify sched_lend_user_prio_cond() If 'td_lend_user_pri' has the expected value, there is no need to check the fields that sched_lend_user_prio() modifies, they either are already good or soon will be ('td->td_lend_user_pri' has just been changed by a concurrent update). Reviewed by: kib Approved by: emaste (mentor) MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D44050 --- sys/kern/sched_4bsd.c | 12 +++--------- sys/kern/sched_ule.c | 10 ++-------- 2 files changed, 5 insertions(+), 17 deletions(-) diff --git a/sys/kern/sched_4bsd.c b/sys/kern/sched_4bsd.c index f0fffeb08e2d..ff1e57746404 100644 --- a/sys/kern/sched_4bsd.c +++ b/sys/kern/sched_4bsd.c @@ -981,15 +981,9 @@ void sched_lend_user_prio_cond(struct thread *td, u_char prio) { - if (td->td_lend_user_pri != prio) - goto lend; - if (td->td_user_pri != min(prio, td->td_base_user_pri)) - goto lend; - if (td->td_priority != td->td_user_pri) - goto lend; - return; - -lend: + if (td->td_lend_user_pri == prio) + return; + thread_lock(td); sched_lend_user_prio(td, prio); thread_unlock(td); diff --git a/sys/kern/sched_ule.c b/sys/kern/sched_ule.c index c0d085fcf906..502802047cd4 100644 --- a/sys/kern/sched_ule.c +++ b/sys/kern/sched_ule.c @@ -2007,15 +2007,9 @@ void sched_lend_user_prio_cond(struct thread *td, u_char prio) { - if (td->td_lend_user_pri != prio) - goto lend; - if (td->td_user_pri != min(prio, td->td_base_user_pri)) - goto lend; - if (td->td_priority != td->td_user_pri) - goto lend; - return; + if (td->td_lend_user_pri == prio) + return; -lend: thread_lock(td); sched_lend_user_prio(td, prio); thread_unlock(td);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202402270900.41R90J0H004688>