From owner-freebsd-net@FreeBSD.ORG Fri Sep 6 19:14:22 2013 Return-Path: Delivered-To: freebsd-net@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 9EB74314 for ; Fri, 6 Sep 2013 19:14:22 +0000 (UTC) (envelope-from nparhar@gmail.com) Received: from mail-pa0-x22d.google.com (mail-pa0-x22d.google.com [IPv6:2607:f8b0:400e:c03::22d]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 775F42848 for ; Fri, 6 Sep 2013 19:14:22 +0000 (UTC) Received: by mail-pa0-f45.google.com with SMTP id bg4so3725317pad.32 for ; Fri, 06 Sep 2013 12:14:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:content-type:content-transfer-encoding; bh=Uvp2u7LULS0oZyUMjiTMRjyqJrIEXIWEL/wSDO0K3aY=; b=cKECF1SxlmvnyJ55G26L0mPvCj9ixxX6P1q7nRn1ZuG7RPMyyU3lO+RNTZyeRSZxVe fsK9N/MviVG4mipXYdZ8p4ncyrMLVtpsc9+5jqLOrZDz2AbGxFowU8S1BeXkbcPzUw/J zCs9Vz5awAD9pOpAJj489mQc2duRfXgT6KyV02gd5pOaF4ozU0tu2n0kU3VhFacxZ19E /KyIskcVLHj6PBuJQro46qKvRikEVyglWzrLaGNj3LvJvHh/pg+FOCde/LErnwrxR/pI SADu9MuRMXEB89aZWna3+r8BjhjzGuArWUFVKcUp+AHMO2SAJnCfmPwUzzluTQKrztgu ingg== X-Received: by 10.68.96.130 with SMTP id ds2mr4589547pbb.99.1378494862152; Fri, 06 Sep 2013 12:14:22 -0700 (PDT) Received: from [10.192.166.0] (stargate.chelsio.com. [67.207.112.58]) by mx.google.com with ESMTPSA id om2sm5501951pbc.30.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 06 Sep 2013 12:14:21 -0700 (PDT) Message-ID: <522A298B.30106@gmail.com> Date: Fri, 06 Sep 2013 12:14:19 -0700 From: Navdeep Parhar User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:17.0) Gecko/20130819 Thunderbird/17.0.8 MIME-Version: 1.0 To: hiren panchasara Subject: Re: mbuf autotuning changes References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: "freebsd-net@freebsd.org" X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Sep 2013 19:14:22 -0000 On 09/06/13 12:10, hiren panchasara wrote: > tunable_mbinit() in kern_mbuf.c looks like this: > > 119 /* > 120 * The default limit for all mbuf related memory is 1/2 of all > 121 * available kernel memory (physical or kmem). > 122 * At most it can be 3/4 of available kernel memory. > 123 */ > 124 realmem = qmin((quad_t)physmem * PAGE_SIZE, > 125 vm_map_max(kmem_map) - vm_map_min(kmem_map)); > 126 maxmbufmem = realmem / 2; > 127 TUNABLE_QUAD_FETCH("kern.ipc.maxmbufmem", &maxmbufmem); > 128 if (maxmbufmem > realmem / 4 * 3) > 129 maxmbufmem = realmem / 4 * 3; > > If I am reading the code correctly, we loose the value on line 126 when we > do FETCH on line 127. > > And after line 127, if we havent specified kern.ipc.maxmbufmem (in > loader.conf - I guess...), we set that value to 0. > > And because of that the if condition on line 128 is almost always false? > > What am I missing here? All the TUNABLE_FOO_FETCH leave the data alone if the tunable isn't actually in the environment. For this specific case, see the the implementation of getenv_quad(). Navdeep