git: 99421af3d911 - stable/13 - LinuxKPI: Fix typo in cond_resched_lock

From: Vladimir Kondratyev <wulf_at_FreeBSD.org>
Date: Wed, 01 Jun 2022 21:51:47 UTC
The branch stable/13 has been updated by wulf:

URL: https://cgit.FreeBSD.org/src/commit/?id=99421af3d9119d937f3481a8a71671592be6a355

commit 99421af3d9119d937f3481a8a71671592be6a355
Author:     Vladimir Kondratyev <wulf@FreeBSD.org>
AuthorDate: 2022-05-17 12:10:20 +0000
Commit:     Vladimir Kondratyev <wulf@FreeBSD.org>
CommitDate: 2022-06-01 21:50:13 +0000

    LinuxKPI: Fix typo in cond_resched_lock
    
    Lock must be released rather than acquired around mi_switch call.
    
    MFC after:      1 week
    Reviewed by:    hselasky, manu
    Differential Revision:  https://reviews.freebsd.org/D35048
    
    (cherry picked from commit 41559beb000555770cff1e1b3ef0275157aeb608)
---
 sys/compat/linuxkpi/common/include/linux/sched.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/sys/compat/linuxkpi/common/include/linux/sched.h b/sys/compat/linuxkpi/common/include/linux/sched.h
index 4ad95446301f..8201cb743535 100644
--- a/sys/compat/linuxkpi/common/include/linux/sched.h
+++ b/sys/compat/linuxkpi/common/include/linux/sched.h
@@ -133,9 +133,9 @@ cond_resched_lock(spinlock_t *lock)
 
 	if (need_resched() == 0)
 		return (0);
-	spin_lock(lock);
-	cond_resched();
 	spin_unlock(lock);
+	cond_resched();
+	spin_lock(lock);
 	return (1);
 }