git: cbbce42345c5 - main - epair: unbind prior to returning to userspace

From: Kristof Provost <kp_at_FreeBSD.org>
Date: Sat, 07 May 2022 19:58:13 UTC
The branch main has been updated by kp:

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

commit cbbce42345c51536d7dc63643f47a3cbf87d647e
Author:     Kristof Provost <kp@FreeBSD.org>
AuthorDate: 2022-05-07 15:15:34 +0000
Commit:     Kristof Provost <kp@FreeBSD.org>
CommitDate: 2022-05-07 16:17:33 +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
---
 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 e9b056ef2bd6..21e50b5171aa 100644
--- a/sys/net/if_epair.c
+++ b/sys/net/if_epair.c
@@ -826,6 +826,9 @@ epair_mod_init(void)
 
 		epair_tasks.tasks++;
 	}
+	thread_lock(curthread);
+	sched_unbind(curthread);
+	thread_unlock(curthread);
 #else
 	snprintf(name, sizeof(name), "epair_task");