Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 13 May 2015 08:04:50 +0000 (UTC)
From:      Hiren Panchasara <hiren@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org
Subject:   svn commit: r282832 - stable/10/sys/net
Message-ID:  <201505130804.t4D84oCO021574@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: hiren
Date: Wed May 13 08:04:50 2015
New Revision: 282832
URL: https://svnweb.freebsd.org/changeset/base/282832

Log:
  MFC r281984:
  
  Currently there is no easy way to specify net.isr.maxthreads = all cpus. We need
  to specify exact number of cpus in loader.conf which get annoying when you have
  mix of machines which don't have equal number of total cpus. I propose "-1" as
  that value. When loader.conf has net.isr.maxthreads = -1, netisr will use all
  available cpus.
  
  Sponsored by:	Limelight Networks

Modified:
  stable/10/sys/net/netisr.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/net/netisr.c
==============================================================================
--- stable/10/sys/net/netisr.c	Wed May 13 07:39:16 2015	(r282831)
+++ stable/10/sys/net/netisr.c	Wed May 13 08:04:50 2015	(r282832)
@@ -156,10 +156,13 @@ SYSCTL_PROC(_net_isr, OID_AUTO, dispatch
 /*
  * Allow the administrator to limit the number of threads (CPUs) to use for
  * netisr.  We don't check netisr_maxthreads before creating the thread for
- * CPU 0, so in practice we ignore values <= 1.  This must be set at boot.
- * We will create at most one thread per CPU.
+ * CPU 0. This must be set at boot. We will create at most one thread per CPU.
+ * By default we initialize this to 1 which would assign just 1 cpu (cpu0) and
+ * therefore only 1 workstream. If set to -1, netisr would use all cpus
+ * (mp_ncpus) and therefore would have those many workstreams. One workstream
+ * per thread (CPU).
  */
-static int	netisr_maxthreads = -1;		/* Max number of threads. */
+static int	netisr_maxthreads = 1;		/* Max number of threads. */
 TUNABLE_INT("net.isr.maxthreads", &netisr_maxthreads);
 SYSCTL_INT(_net_isr, OID_AUTO, maxthreads, CTLFLAG_RDTUN,
     &netisr_maxthreads, 0,
@@ -1128,8 +1131,10 @@ netisr_init(void *arg)
 	KASSERT(curcpu == 0, ("%s: not on CPU 0", __func__));
 
 	NETISR_LOCK_INIT();
-	if (netisr_maxthreads < 1)
-		netisr_maxthreads = 1;
+	if (netisr_maxthreads == 0 || netisr_maxthreads < -1 )
+		netisr_maxthreads = 1;		/* default behavior */
+	else if (netisr_maxthreads == -1)
+		netisr_maxthreads = mp_ncpus;	/* use max cpus */
 	if (netisr_maxthreads > mp_ncpus) {
 		printf("netisr_init: forcing maxthreads from %d to %d\n",
 		    netisr_maxthreads, mp_ncpus);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201505130804.t4D84oCO021574>