Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 4 Dec 2018 07:58:13 +1100 (EST)
From:      Bruce Evans <brde@optusnet.com.au>
To:        Ian Lepore <ian@freebsd.org>
Cc:        Justin Hibbits <jhibbits@freebsd.org>, src-committers@freebsd.org,  svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   Re: svn commit: r341103 - head/sys/powerpc/include
Message-ID:  <20181204064443.F3470@besplex.bde.org>
In-Reply-To: <1543865260.1860.190.camel@freebsd.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>

next in thread | previous in thread | raw e-mail | index | archive | help
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: <owner-svn-src-all@freebsd.org>
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 <markj@FreeBSD.org>
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 &quot;
 user&quot; and &quot; projects&quot; \)" <svn-src-all.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-all>,
 <mailto:svn-src-all-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-all/>;
List-Post: <mailto:svn-src-all@freebsd.org>
List-Help: <mailto:svn-src-all-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-all>,
 <mailto:svn-src-all-request@freebsd.org?subject=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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20181204064443.F3470>