From owner-freebsd-net@FreeBSD.ORG Thu Aug 23 20:13:49 2012 Return-Path: Delivered-To: freebsd-net@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 8E6F01065670 for ; Thu, 23 Aug 2012 20:13:49 +0000 (UTC) (envelope-from nparhar@gmail.com) Received: from mail-pb0-f54.google.com (mail-pb0-f54.google.com [209.85.160.54]) by mx1.freebsd.org (Postfix) with ESMTP id 5C6C58FC19 for ; Thu, 23 Aug 2012 20:13:48 +0000 (UTC) Received: by pbbrp2 with SMTP id rp2so2178543pbb.13 for ; Thu, 23 Aug 2012 13:13:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:message-id:date:from:user-agent:mime-version:to:subject :content-type; bh=TZX4rlpgM903F09V5I24K74eM8gLeuuyKYoz7LtyPAA=; b=kEwD7YkeIRBoLWnoRmXB9Od5s4WoGfBuY0u7WCxLTEWvvEWhKryXM8WbeRxDFswGFy mJRx7hH7KUomSyWec18KRG0Ukv6s+uiXgrj3GNU1CnrweDi5uoMgV9FfQBG3XBVQ5tb/ 1TZ2TBfI7Jra5dcVR+Bc3UC7ScmeB0zSTP4V12IpIM91sbVEjtXUl2UNfbO+V+94YJhV ROlSKjBXN6kXkaveYvGYF49e4W8BPXrdnCho/A4J6e+4IVzmB3hvHK9hmUebdnsjhyCQ /4BCE6vc3M/W06BDlGrcyYoK0zBWufQgb0VK1/Dmv2cjV+e4fMtsmIC5J0Pge7At51Q/ a3Vw== Received: by 10.68.212.161 with SMTP id nl1mr7422801pbc.84.1345752822669; Thu, 23 Aug 2012 13:13:42 -0700 (PDT) Received: from [10.192.166.0] (stargate.chelsio.com. [67.207.112.58]) by mx.google.com with ESMTPS id uu10sm6658415pbc.2.2012.08.23.13.13.40 (version=SSLv3 cipher=OTHER); Thu, 23 Aug 2012 13:13:41 -0700 (PDT) Sender: Navdeep Parhar Message-ID: <50368EF3.4050600@FreeBSD.org> Date: Thu, 23 Aug 2012 13:13:39 -0700 From: Navdeep Parhar User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:14.0) Gecko/20120821 Thunderbird/14.0 MIME-Version: 1.0 To: freebsd-net@freebsd.org Content-Type: multipart/mixed; boundary="------------020407010101070509020805" Subject: [PATCH] Allow nmbjumboX to be set via kernel tunables. X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 Aug 2012 20:13:49 -0000 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--