Date: Thu, 18 Feb 2016 08:08:12 +0000 From: "sepherosa_gmail.com (Sepherosa Ziehau)" <phabric-noreply@FreeBSD.org> To: freebsd-net@freebsd.org Subject: [Differential] [Request, 33 lines] D5316: hyperv/hn: Add option to bind TX taskqueues to the specified CPU Message-ID: <differential-rev-PHID-DREV-y635bkwldqas7qzbgsje-req@FreeBSD.org>
next in thread | raw e-mail | index | archive | help
--b1_c0dbfdfdbd7cd3f51fdeaf46d1b46b46 Content-Type: text/plain; charset = "utf-8" Content-Transfer-Encoding: 8bit sepherosa_gmail.com created this revision. sepherosa_gmail.com added reviewers: network, adrian, delphij, royger, decui_microsoft.com, honzhan_microsoft.com, howard0su_gmail.com. sepherosa_gmail.com added subscribers: freebsd-net-list, freebsd-virtualization-list. REVISION DETAIL https://reviews.freebsd.org/D5316 AFFECTED FILES sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c CHANGE DETAILS diff --git a/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c b/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c --- a/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c +++ b/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c @@ -269,6 +269,10 @@ SYSCTL_INT(_hw_hn, OID_AUTO, use_txdesc_bufring, CTLFLAG_RD, &hn_use_txdesc_bufring, 0, "Use buf_ring for TX descriptors"); +static int hn_bind_tx_taskq = -1; +SYSCTL_INT(_hw_hn, OID_AUTO, bind_tx_taskq, CTLFLAG_RDTUN, + &hn_bind_tx_taskq, 0, "Bind TX taskqueue to the specified cpu"); + /* * Forward declarations */ @@ -383,8 +387,20 @@ if (hn_tx_taskq == NULL) { sc->hn_tx_taskq = taskqueue_create("hn_tx", M_WAITOK, taskqueue_thread_enqueue, &sc->hn_tx_taskq); - taskqueue_start_threads(&sc->hn_tx_taskq, 1, PI_NET, "%s tx", - device_get_nameunit(dev)); + if (hn_bind_tx_taskq >= 0) { + int cpu = hn_bind_tx_taskq; + cpuset_t cpu_set; + + if (cpu > mp_ncpus - 1) + cpu = mp_ncpus - 1; + CPU_SETOF(cpu, &cpu_set); + taskqueue_start_threads_cpuset(&sc->hn_tx_taskq, 1, + PI_NET, &cpu_set, "%s tx", + device_get_nameunit(dev)); + } else { + taskqueue_start_threads(&sc->hn_tx_taskq, 1, PI_NET, + "%s tx", device_get_nameunit(dev)); + } } else { sc->hn_tx_taskq = hn_tx_taskq; } @@ -2409,7 +2425,18 @@ hn_tx_taskq = taskqueue_create("hn_tx", M_WAITOK, taskqueue_thread_enqueue, &hn_tx_taskq); - taskqueue_start_threads(&hn_tx_taskq, 1, PI_NET, "hn tx"); + if (hn_bind_tx_taskq >= 0) { + int cpu = hn_bind_tx_taskq; + cpuset_t cpu_set; + + if (cpu > mp_ncpus - 1) + cpu = mp_ncpus - 1; + CPU_SETOF(cpu, &cpu_set); + taskqueue_start_threads_cpuset(&hn_tx_taskq, 1, PI_NET, + &cpu_set, "hn tx"); + } else { + taskqueue_start_threads(&hn_tx_taskq, 1, PI_NET, "hn tx"); + } } SYSINIT(hn_txtq_create, SI_SUB_DRIVERS, SI_ORDER_FIRST, hn_tx_taskq_create, NULL); EMAIL PREFERENCES https://reviews.freebsd.org/settings/panel/emailpreferences/ To: sepherosa_gmail.com, network, adrian, delphij, royger, decui_microsoft.com, honzhan_microsoft.com, howard0su_gmail.com Cc: freebsd-virtualization-list, freebsd-net-list --b1_c0dbfdfdbd7cd3f51fdeaf46d1b46b46 Content-Type: text/x-patch; charset=utf-8; name="D5316.13407.patch" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="D5316.13407.patch" ZGlmZiAtLWdpdCBhL3N5cy9kZXYvaHlwZXJ2L25ldHZzYy9odl9uZXR2c2NfZHJ2X2ZyZWVic2Qu YyBiL3N5cy9kZXYvaHlwZXJ2L25ldHZzYy9odl9uZXR2c2NfZHJ2X2ZyZWVic2QuYwotLS0gYS9z eXMvZGV2L2h5cGVydi9uZXR2c2MvaHZfb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X3R4 X3Rhc2txLCAxLCBQSV9ORVQsICJobiB0eCIpOworCX0KIH0KIFNZU0lOSVQoaG5fdHh0cV9jcmVh dGUsIFNJX1NVQl9EUklWRVJTLCBTSV9PUkRFUl9GSVJTVCwKICAgICBobl90eF90YXNrcV9jcmVh dGUsIE5VTEwpOwoK --b1_c0dbfdfdbd7cd3f51fdeaf46d1b46b46--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?differential-rev-PHID-DREV-y635bkwldqas7qzbgsje-req>