git: 7e5574f9e5d9 - main - sched_unpin(): assert that curthread was pinned

From: Konstantin Belousov <kib_at_FreeBSD.org>
Date: Wed, 26 Jun 2024 07:04:37 UTC
The branch main has been updated by kib:

URL: https://cgit.FreeBSD.org/src/commit/?id=7e5574f9e5d9df749ffc49657717527cfa93f6b4

commit 7e5574f9e5d9df749ffc49657717527cfa93f6b4
Author:     Konstantin Belousov <kib@FreeBSD.org>
AuthorDate: 2024-06-25 20:08:22 +0000
Commit:     Konstantin Belousov <kib@FreeBSD.org>
CommitDate: 2024-06-26 07:04:10 +0000

    sched_unpin(): assert that curthread was pinned
    
    Reviewed by:    emaste, imp, markj, olce
    Sponsored by:   The FreeBSD Foundation
    MFC after:      1 week
    Differential revision:  https://reviews.freebsd.org/D45736
---
 sys/sys/sched.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/sys/sys/sched.h b/sys/sys/sched.h
index fd84b987d9b1..f017863270b4 100644
--- a/sys/sys/sched.h
+++ b/sys/sys/sched.h
@@ -180,6 +180,7 @@ static __inline void
 sched_unpin(void)
 {
 	atomic_interrupt_fence();
+	MPASS(curthread->td_pinned > 0);
 	curthread->td_pinned--;
 }