git: 08135bd1fa6e - stable/13 - epair: unbind prior to returning to userspace

From: Kristof Provost <kp_at_FreeBSD.org>
Date: Sat, 14 May 2022 21:27:18 UTC
The branch stable/13 has been updated by kp:

URL: https://cgit.FreeBSD.org/src/commit/?id=08135bd1fa6e57b3d9737dd6f58a5c71b5d3d6df

commit 08135bd1fa6e57b3d9737dd6f58a5c71b5d3d6df
Author:     Kristof Provost <kp@FreeBSD.org>
AuthorDate: 2022-05-07 15:15:34 +0000
Commit:     Kristof Provost <kp@FreeBSD.org>
CommitDate: 2022-05-14 09:10:47 +0000

    epair: unbind prior to returning to userspace
    
    If 'options RSS' is set we bind the epair tasks to different CPUs. We
    must take care to not keep the current thread bound to the last CPU when
    we return to userspace.
    
    MFC after:      1 week
    Sponsored by:   Orange Business Services
    
    (cherry picked from commit cbbce42345c51536d7dc63643f47a3cbf87d647e)
---
 sys/net/if_epair.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/sys/net/if_epair.c b/sys/net/if_epair.c
index 2fe052f57486..e7257f5fa551 100644
--- a/sys/net/if_epair.c
+++ b/sys/net/if_epair.c
@@ -822,6 +822,9 @@ epair_mod_init()
 
 		epair_tasks.tasks++;
 	}
+	thread_lock(curthread);
+	sched_unbind(curthread);
+	thread_unlock(curthread);
 #else
 	snprintf(name, sizeof(name), "epair_task");