git: 4dc1b17dbb9f - main - ktls: Improve handling of the bind_threads tunable a bit

Mark Johnston markj at FreeBSD.org
Wed Jan 20 02:33:27 UTC 2021


The branch main has been updated by markj:

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

commit 4dc1b17dbb9fc8d51699037d8e2b550b9329b934
Author:     Mark Johnston <markj at FreeBSD.org>
AuthorDate: 2021-01-20 02:32:33 +0000
Commit:     Mark Johnston <markj at FreeBSD.org>
CommitDate: 2021-01-20 02:32:33 +0000

    ktls: Improve handling of the bind_threads tunable a bit
    
    - Only check for empty domains if we actually tried to configure domain
      affinity in the first place.  Otherwise setting bind_threads=1 will
      always cause the sysctl value to be reported as zero.  This is
      harmless since the threads end up being bound, but it's confusing.
    - Try to improve the sysctl description a bit.
    
    Reviewed by:    gallatin, jhb
    Submitted by:   Klara, Inc.
    Sponsored by:   Ampere Computing
    Differential Revision:  https://reviews.freebsd.org/D28161
---
 sys/kern/uipc_ktls.c | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/sys/kern/uipc_ktls.c b/sys/kern/uipc_ktls.c
index e430afdabc23..72c228e80199 100644
--- a/sys/kern/uipc_ktls.c
+++ b/sys/kern/uipc_ktls.c
@@ -113,7 +113,7 @@ static int ktls_bind_threads;
 #endif
 SYSCTL_INT(_kern_ipc_tls, OID_AUTO, bind_threads, CTLFLAG_RDTUN,
     &ktls_bind_threads, 0,
-    "Bind crypto threads to cores or domains at boot");
+    "Bind crypto threads to cores (1) or cores and domains (2) at boot");
 
 static u_int ktls_maxlen = 16384;
 SYSCTL_UINT(_kern_ipc_tls, OID_AUTO, maxlen, CTLFLAG_RWTUN,
@@ -435,10 +435,12 @@ ktls_init(void *dummy __unused)
 	 * If we somehow have an empty domain, fall back to choosing
 	 * among all KTLS threads.
 	 */
-	for (i = 0; i < vm_ndomains; i++) {
-		if (ktls_domains[i].count == 0) {
-			ktls_bind_threads = 0;
-			break;
+	if (ktls_bind_threads > 1) {
+		for (i = 0; i < vm_ndomains; i++) {
+			if (ktls_domains[i].count == 0) {
+				ktls_bind_threads = 1;
+				break;
+			}
 		}
 	}
 


More information about the dev-commits-src-all mailing list