From owner-freebsd-net@FreeBSD.ORG Sat Sep 7 03:26:46 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 71980CDE for ; Sat, 7 Sep 2013 03:26:46 +0000 (UTC) (envelope-from imp@bsdimp.com) Received: from mail-ie0-f169.google.com (mail-ie0-f169.google.com [209.85.223.169]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 3CBB526AB for ; Sat, 7 Sep 2013 03:26:45 +0000 (UTC) Received: by mail-ie0-f169.google.com with SMTP id tp5so8868972ieb.28 for ; Fri, 06 Sep 2013 20:26:39 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:subject:mime-version:content-type:from :in-reply-to:date:cc:content-transfer-encoding:message-id:references :to; bh=6UMneV7NVC5314i60mzzVrs/Dl+/UKHPXiU07SakrDg=; b=U0/uWdfOqegMRToML7eDC+dRBXxEIYfXu+otCXlsyWbUY0cbeDeB1ZpgeyZdSMjrl1 mISRhQ78x0sLt4Zn3T1/gK23B0kB0saaSxlXGw4/UpBZ5Quq4WoexU3O5nEOBWKQfbYD ISIDPifHJQylim/AexyNPldAY0vF79dxufaU7v+1zkqMDcfjOp9YBCbBwfnt5TJOjitd ieSp9rAWhXKr0ks8H9u4+QGwyp05Zc3BJSaZTumxb9P/iS/v1NFYz47/OcuhDuWUg0zR xEwYQ+d1WNHMTedax8wgeyXXommDUXCFwH9w8qn5eY9XkouPlvUfHemLlN/DTj/usVvT w8wg== X-Gm-Message-State: ALoCoQm+3qH1Z7s/usj/H7NuX9DZA5M4ISlSHBj1uqU389BQsLDhY+6cUdTsYnkGi8kpRZRu0Lzt X-Received: by 10.50.6.71 with SMTP id y7mr832664igy.8.1378524399754; Fri, 06 Sep 2013 20:26:39 -0700 (PDT) Received: from 53.imp.bsdimp.com (50-78-194-198-static.hfc.comcastbusiness.net. [50.78.194.198]) by mx.google.com with ESMTPSA id yt10sm1370121igb.9.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 06 Sep 2013 20:26:38 -0700 (PDT) Sender: Warner Losh Subject: Re: mbuf autotuning effect Mime-Version: 1.0 (Apple Message framework v1085) Content-Type: text/plain; charset=us-ascii From: Warner Losh In-Reply-To: Date: Fri, 6 Sep 2013 21:26:37 -0600 Content-Transfer-Encoding: quoted-printable Message-Id: <9CBFAD35-D651-4E28-BEBB-DC3717F38567@bsdimp.com> References: To: Adrian Chadd X-Mailer: Apple Mail (2.1085) Cc: "freebsd-net@freebsd.org" , hiren panchasara , "freebsd-mips@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: Sat, 07 Sep 2013 03:26:46 -0000 On Sep 6, 2013, at 7:11 PM, Adrian Chadd wrote: > Yeah, why is VM_KMEM_SIZE only 12mbyte for MIPS? That's a little low = for a > platform that has a direct map that's slightly larger than 12mb :) >=20 > Warner? Juli? All architectures have it at 12MB, except sparc64 where it is 16MB. This = can be changed with the options VM_KMEM_SIZE=3Dxxxxx in the config file. So my guess as to why this is the case: cut and paste worked, so nobody = changed it after that. # Still need to reads hiren's email to comprehend it... Warner >=20 >=20 > -adrian >=20 >=20 >=20 > On 6 September 2013 16:36, hiren panchasara = wrote: >=20 >> We are seeing an interesting thing on a mips board with 32MB ram. >>=20 >> We run out of mbuf very easily and looking at numbers it seems we are = only >> getting 6mb of maxmbufmem. >>=20 >> # sysctl -a | grep hw | grep mem >> hw.physmem: 33554432 >> hw.usermem: 21774336 >> hw.realmem: 33554432 >> # >> # sysctl -a | grep maxmbuf >> kern.ipc.maxmbufmem: 6291456 >>=20 >> I believe that number is very low for a board with 32mb of ram. >>=20 >> Looking at the code: >>=20 >> sys/kern/kern_mbuf.c : tunable_mbinit() >>=20 >> 124 realmem =3D qmin((quad_t)physmem * PAGE_SIZE, = vm_kmem_size); >> 125 maxmbufmem =3D realmem / 2; >> 126 TUNABLE_QUAD_FETCH("kern.ipc.maxmbufmem", &maxmbufmem); >> 127 if (maxmbufmem > realmem / 4 * 3) >> 128 maxmbufmem =3D realmem / 4 * 3; >>=20 >> So, realmem plays important role in determining maxmbufmem. >>=20 >> physmem =3D 32mb >> PAGE_SIZE =3D 4096 >>=20 >> vm_kmem_size is calculated inside sys/kern/kern_malloc.c : kmeminit() >>=20 >> 705 vm_kmem_size =3D VM_KMEM_SIZE + nmbclusters * PAGE_SIZE; >> 706 mem_size =3D cnt.v_page_count; >> 707 >> 708 #if defined(VM_KMEM_SIZE_SCALE) >> 709 vm_kmem_size_scale =3D VM_KMEM_SIZE_SCALE; >> 710 #endif >> 711 TUNABLE_INT_FETCH("vm.kmem_size_scale", = &vm_kmem_size_scale); >> 712 if (vm_kmem_size_scale > 0 && >> 713 (mem_size / vm_kmem_size_scale) > (vm_kmem_size / >> PAGE_SIZE)) >> 714 vm_kmem_size =3D (mem_size / vm_kmem_size_scale) = * >> PAGE_SIZE; >>=20 >> here, >> VM_KMEM_SIZE =3D 12*1024*1024 >> nmbclusters =3D 0 (initially) >> PAGE_SIZE =3D 4096 >> # sysctl -a | grep v_page_count >> vm.stats.vm.v_page_count: 7035 >>=20 >> and VM_KMEM_SIZE_SCALE =3D 3 for mips. >>=20 >> So, vm_kmem_size =3D 12mb. >>=20 >> Going back to tunable_mbinit(), >> we get realmem =3D 12mb. >> and masmbufmem =3D 6mb. >>=20 >>=20 >> Wanted to see if I am following the code correctly and how autotuning >> should work here. >>=20 >> cheers, >> Hiren >> _______________________________________________ >> freebsd-net@freebsd.org mailing list >> http://lists.freebsd.org/mailman/listinfo/freebsd-net >> To unsubscribe, send any mail to = "freebsd-net-unsubscribe@freebsd.org" >>=20 > _______________________________________________ > freebsd-mips@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-mips > To unsubscribe, send any mail to = "freebsd-mips-unsubscribe@freebsd.org"