From owner-svn-src-all@freebsd.org Mon Dec 3 20:58:18 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8E35B130B941; Mon, 3 Dec 2018 20:58:18 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail104.syd.optusnet.com.au (mail104.syd.optusnet.com.au [211.29.132.246]) by mx1.freebsd.org (Postfix) with ESMTP id 889FC6EB2C; Mon, 3 Dec 2018 20:58:16 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from [192.168.0.102] (c110-21-101-228.carlnfd1.nsw.optusnet.com.au [110.21.101.228]) by mail104.syd.optusnet.com.au (Postfix) with ESMTPS id BE68143FEB4; Tue, 4 Dec 2018 07:58:14 +1100 (AEDT) Date: Tue, 4 Dec 2018 07:58:13 +1100 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Ian Lepore cc: Justin Hibbits , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r341103 - head/sys/powerpc/include In-Reply-To: <1543865260.1860.190.camel@freebsd.org> Message-ID: <20181204064443.F3470@besplex.bde.org> References: <201811280248.wAS2miqW055485@repo.freebsd.org> <20181128151148.X1660@besplex.bde.org> <20181203102007.4021aa32@ralga.knownspace> <20181204043712.F3059@besplex.bde.org> <1543865260.1860.190.camel@freebsd.org> MIME-Version: 1.0 X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.2 cv=DZtnkrlW c=1 sm=1 tr=0 a=PalzARQSbocsUSjMRkwAPg==:117 a=PalzARQSbocsUSjMRkwAPg==:17 a=nlC_4_pT8q9DhB4Ho9EA:9 a=X60SueohGfhK4wzaWbEA:9 a=TwM0Mj6SzhmnrwvA:21 a=_tgWLagAo8SVkydJ:21 a=45ClL6m2LaAA:10 X-Rspamd-Queue-Id: 889FC6EB2C X-Spamd-Result: default: False [-3.76 / 15.00]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; R_SPF_ALLOW(-0.20)[+ip4:211.29.132.0/23]; FREEMAIL_FROM(0.00)[optusnet.com.au]; MIME_GOOD(-0.10)[multipart/mixed,text/plain]; TO_MATCH_ENVRCPT_ALL(0.00)[]; DMARC_NA(0.00)[optusnet.com.au]; RCPT_COUNT_FIVE(0.00)[5]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; IP_SCORE(-1.51)[ipnet: 211.28.0.0/14(-4.16), asn: 4804(-3.33), country: AU(-0.04)]; MX_GOOD(-0.01)[cached: extmail.optusnet.com.au]; CTYPE_MIXED_BOGUS(1.00)[]; NEURAL_HAM_SHORT(-0.94)[-0.939,0]; RCVD_NO_TLS_LAST(0.10)[]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(0.00)[]; FREEMAIL_ENVFROM(0.00)[optusnet.com.au]; ASN(0.00)[asn:4804, ipnet:211.28.0.0/14, country:AU]; RCVD_COUNT_TWO(0.00)[2]; RCVD_IN_DNSWL_LOW(-0.10)[246.132.29.211.list.dnswl.org : 127.0.5.1] X-Rspamd-Server: mx1.freebsd.org Content-Type: TEXT/PLAIN; charset=X-UNKNOWN; format=flowed Content-Transfer-Encoding: QUOTED-PRINTABLE X-Content-Filtered-By: Mailman/MimeDel 2.1.29 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 03 Dec 2018 20:58:18 -0000 On Mon, 3 Dec 2018, Ian Lepore wrote: > On Tue, 2018-12-04 at 05:56 +1100, Bruce Evans wrote: >> On Mon, 3 Dec 2018, Justin Hibbits wrote: >> >> [...] >> >> Please look at removing VM_KMEM_SIZE_SCALE completely.=A0 I'm now trying= to >> convince kib that it is bogus for all arches, but only know exactly what >> happens on x86. > ... > I know we had problems with the default scaling on armv7 at $work when > we tried to embed a large (150mb) mdrootfs into our kernel for a system > with 2gb ram. I had to chase down the meaning of the scale variable > (and I certainly could have misunderstood it to any degree), but here's > what I wrote about it after fiddling and finding a value that worked > for us. This was for early incarnations of 11-stable. i386 can now fit a 2GB malloc-backed disk in 2.7GB of RAM and its 4GB kva. This is sort of the opposite packing (allocate the md disk later). This requires a few more tweaks: - change the scale to 1. The bogus scale of 3 restricts kmem to 2.7GB/3 =3D 900MB - change vm.kmem_size to a few hundred MB above the desired md disk size. vm_kmem_size defaults to 1.7GB (was 420MB with 1GB kva). This leaves almost 2.3GB for non-kmem allocations, only 300-400MB is needed. I change some of these allocations, but the more interesting ones are in kmem. > # Tuning required to make the kernel work with a large > # embedded filesystem... > #=A0 > # Allocate one page of kmem_arena KVA for every > # VM_KMEM_SIZE_SCALE pages of ram.=A0=A0The default scale is 3, > # and with a huge (>100MB) embedded mdroot that doesn't leave > # enough virtual address space to allocate enough kernel > # stacks, mbufs, and other resources that come out of KVA. > options=A0=09VM_KMEM_SIZE_SCALE=3D5 You should probably use vm.kmem_size for this (VM_KMEM_SIZE_SCALE=3D5 can b= e done using a tunable too). But this is a hack. The large md allocation shows that some of resource calculations are wrong. kmem uses vm_cnt.v_page_count (pages) for the main resource size in most cases. The page count is variable and has already been reduced, but the kva limits are constants. 150MB is not very large compared with the memory size, so the reduction in the default kmem size based on page count is not large. The default kmem size might be larger than VM_KMEM_SIZE_MAX, as on i386 wit= h 1GB kva. Then the default is actually VM_KMEM_SIZE_MAX, but this is far to= o large after the md disk steals 150MB of kva. My version was originally to fix a related problem with PAE for i386. The page tables can be very large (448MB for 16GB RAM just for the main page table metadata). When the kva size is 1GB, not accounting for this throws all allocation sizes off by a factor of 2, and it is hard to fit everything in the remaining ~512MB even with non-sloppy calculations. When the kva size is 4GB as in -current, the error factor is closer to 1, so sloppy calculations have a chance of working. The md disk needs the same treatment. I think it can only be embedded in the kernel text+data+bss+etc. That is easy to handle, but I didn't notice the problem since my kernels are relatively small. Bruce From owner-svn-src-all@freebsd.org Mon Dec 3 21:07:11 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B1637130BD99; Mon, 3 Dec 2018 21:07:11 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4A0696F31D; Mon, 3 Dec 2018 21:07:11 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2A1B21B52F; Mon, 3 Dec 2018 21:07:11 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id wB3L7Ahn016453; Mon, 3 Dec 2018 21:07:10 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB3L7A44016452; Mon, 3 Dec 2018 21:07:10 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201812032107.wB3L7A44016452@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Mon, 3 Dec 2018 21:07:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r341443 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 341443 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 4A0696F31D X-Spamd-Result: default: False [-0.12 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.38)[-0.376,0]; NEURAL_SPAM_LONG(0.00)[0.005,0]; NEURAL_SPAM_SHORT(0.25)[0.250,0] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 03 Dec 2018 21:07:11 -0000 Author: markj Date: Mon Dec 3 21:07:10 2018 New Revision: 341443 URL: https://svnweb.freebsd.org/changeset/base/341443 Log: Add a missing definition for the !COMPAT_FREEBSD32 case. Reported by: jenkins MFC with: r341442 Sponsored by: The FreeBSD Foundation Modified: head/sys/kern/sys_process.c Modified: head/sys/kern/sys_process.c ============================================================================== --- head/sys/kern/sys_process.c Mon Dec 3 20:54:17 2018 (r341442) +++ head/sys/kern/sys_process.c Mon Dec 3 21:07:10 2018 (r341443) @@ -551,6 +551,7 @@ struct ptrace_args { copyout(k ## 32, u, s ## 32) : \ copyout(k, u, s) #else +#define BZERO(a, s) bzero(a, s) #define COPYIN(u, k, s) copyin(u, k, s) #define COPYOUT(k, u, s) copyout(k, u, s) #endif