[PATCH] Allow nmbjumboX to be set via kernel tunables.
Navdeep Parhar
np at FreeBSD.org
Thu Aug 23 20:13:49 UTC 2012
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);
-------------- next part --------------
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);
More information about the freebsd-net
mailing list