git: 41559beb0005 - main - LinuxKPI: Fix typo in cond_resched_lock

From: Vladimir Kondratyev <wulf_at_FreeBSD.org>
Date: Tue, 17 May 2022 12:11:33 UTC
The branch main has been updated by wulf:

URL: https://cgit.FreeBSD.org/src/commit/?id=41559beb000555770cff1e1b3ef0275157aeb608

commit 41559beb000555770cff1e1b3ef0275157aeb608
Author:     Vladimir Kondratyev <wulf@FreeBSD.org>
AuthorDate: 2022-05-17 12:10:20 +0000
Commit:     Vladimir Kondratyev <wulf@FreeBSD.org>
CommitDate: 2022-05-17 12:10:20 +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
---
 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 aa4bdbc65c5b..1409df0a4b26 100644
--- a/sys/compat/linuxkpi/common/include/linux/sched.h
+++ b/sys/compat/linuxkpi/common/include/linux/sched.h
@@ -134,9 +134,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);
 }