Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 23 Aug 2012 13:13:39 -0700
From:      Navdeep Parhar <np@FreeBSD.org>
To:        freebsd-net@freebsd.org
Subject:   [PATCH] Allow nmbjumboX to be set via kernel tunables.
Message-ID:  <50368EF3.4050600@FreeBSD.org>

next in thread | raw e-mail | index | archive | help
This is a multi-part message in MIME format.
--------------020407010101070509020805
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

Here is a patch that allows each of nmbjumboXX to be set via tunables at 
boot-time, independent of nmbclusters.  It is useful to be able to set 
them this way and avoid problems like the one reported in kern/170713 here:

http://www.freebsd.org/cgi/query-pr.cgi?pr=170713

What do you think?  If there are no objections I'll test and commit this 
in two weeks.  If people agree I'll commit it right away.

Regards,
Navdeep

diff -r dca9027569a2 sys/kern/kern_mbuf.c
--- a/sys/kern/kern_mbuf.c	Thu Aug 23 12:00:12 2012 -0700
+++ b/sys/kern/kern_mbuf.c	Thu Aug 23 12:26:09 2012 -0700
@@ -110,14 +110,23 @@
  static void
  tunable_mbinit(void *dummy)
  {
-	TUNABLE_INT_FETCH("kern.ipc.nmbclusters", &nmbclusters);

  	/* This has to be done before VM init. */
+	TUNABLE_INT_FETCH("kern.ipc.nmbclusters", &nmbclusters);
  	if (nmbclusters == 0)
  		nmbclusters = 1024 + maxusers * 64;
-	nmbjumbop = nmbclusters / 2;
-	nmbjumbo9 = nmbjumbop / 2;
-	nmbjumbo16 = nmbjumbo9 / 2;
+
+	TUNABLE_INT_FETCH("kern.ipc.nmbjumbop", &nmbjumbop);
+	if (nmbjumbop == 0)
+		nmbjumbop = nmbclusters / 2;
+
+	TUNABLE_INT_FETCH("kern.ipc.nmbjumbo9", &nmbjumbo9);
+	if (nmbjumbo9 == 0)
+		nmbjumbo9 = nmbclusters / 4;
+
+	TUNABLE_INT_FETCH("kern.ipc.nmbjumbo16", &nmbjumbo16);
+	if (nmbjumbo16 == 0)
+		nmbjumbo16 = nmbclusters / 8;
  }
  SYSINIT(tunable_mbinit, SI_SUB_TUNABLES, SI_ORDER_MIDDLE, 
tunable_mbinit, NULL);


--------------020407010101070509020805
Content-Type: text/plain; charset=us-ascii;
 name="nmb.diff"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
 filename="nmb.diff"

diff -r dca9027569a2 sys/kern/kern_mbuf.c
--- a/sys/kern/kern_mbuf.c	Thu Aug 23 12:00:12 2012 -0700
+++ b/sys/kern/kern_mbuf.c	Thu Aug 23 13:10:31 2012 -0700
@@ -110,14 +110,23 @@
 static void
 tunable_mbinit(void *dummy)
 {
-	TUNABLE_INT_FETCH("kern.ipc.nmbclusters", &nmbclusters);
 
 	/* This has to be done before VM init. */
+	TUNABLE_INT_FETCH("kern.ipc.nmbclusters", &nmbclusters);
 	if (nmbclusters == 0)
 		nmbclusters = 1024 + maxusers * 64;
-	nmbjumbop = nmbclusters / 2;
-	nmbjumbo9 = nmbjumbop / 2;
-	nmbjumbo16 = nmbjumbo9 / 2;
+
+	TUNABLE_INT_FETCH("kern.ipc.nmbjumbop", &nmbjumbop);
+	if (nmbjumbop == 0)
+		nmbjumbop = nmbclusters / 2;
+
+	TUNABLE_INT_FETCH("kern.ipc.nmbjumbo9", &nmbjumbo9);
+	if (nmbjumbo9 == 0)
+		nmbjumbo9 = nmbclusters / 4;
+
+	TUNABLE_INT_FETCH("kern.ipc.nmbjumbo16", &nmbjumbo16);
+	if (nmbjumbo16 == 0)
+		nmbjumbo16 = nmbclusters / 8;
 }
 SYSINIT(tunable_mbinit, SI_SUB_TUNABLES, SI_ORDER_MIDDLE, tunable_mbinit, NULL);
 

--------------020407010101070509020805--



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