From nobody Tue Jun 27 06:56:25 2023 X-Original-To: freebsd-virtualization@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Qqwj46s0hz4kMbY; Tue, 27 Jun 2023 07:05:44 +0000 (UTC) (envelope-from freebsd-rwg@gndrsh.dnsmgr.net) Received: from gndrsh.dnsmgr.net (br1.CN84in.dnsmgr.net [69.59.192.140]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4Qqwj33wHtz4JCG; Tue, 27 Jun 2023 07:05:43 +0000 (UTC) (envelope-from freebsd-rwg@gndrsh.dnsmgr.net) Authentication-Results: mx1.freebsd.org; dkim=none; spf=none (mx1.freebsd.org: domain of freebsd-rwg@gndrsh.dnsmgr.net has no SPF policy when checking 69.59.192.140) smtp.mailfrom=freebsd-rwg@gndrsh.dnsmgr.net; dmarc=none Received: from gndrsh.dnsmgr.net (localhost [127.0.0.1]) by gndrsh.dnsmgr.net (8.13.3/8.13.3) with ESMTP id 35R6uPTr061317; Mon, 26 Jun 2023 23:56:25 -0700 (PDT) (envelope-from freebsd-rwg@gndrsh.dnsmgr.net) Received: (from freebsd-rwg@localhost) by gndrsh.dnsmgr.net (8.13.3/8.13.3/Submit) id 35R6uPWS061316; Mon, 26 Jun 2023 23:56:25 -0700 (PDT) (envelope-from freebsd-rwg) From: "Rodney W. Grimes" Message-Id: <202306270656.35R6uPWS061316@gndrsh.dnsmgr.net> Subject: Re: bhyve: how to keep the host from starving the guest In-Reply-To: To: Aryeh Friedman Date: Mon, 26 Jun 2023 23:56:25 -0700 (PDT) CC: Vitaliy Gusev , FreeBSD virtualization , FreeBSD Mailing List X-Mailer: ELM [version 2.4ME+ PL121h (25)] List-Id: Discussion List-Archive: https://lists.freebsd.org/archives/freebsd-virtualization List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-virtualization@freebsd.org X-BeenThere: freebsd-virtualization@freebsd.org MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII X-Spamd-Result: default: False [-2.05 / 15.00]; NEURAL_HAM_LONG(-1.00)[-1.000]; AUTH_NA(1.00)[]; NEURAL_HAM_SHORT(-1.00)[-0.998]; NEURAL_HAM_MEDIUM(-0.95)[-0.948]; MIME_GOOD(-0.10)[text/plain]; MLMMJ_DEST(0.00)[freebsd-questions@FreeBSD.org,freebsd-virtualization@FreeBSD.org]; FREEMAIL_TO(0.00)[gmail.com]; RCVD_TLS_LAST(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:13868, ipnet:69.59.192.0/19, country:US]; TO_DN_ALL(0.00)[]; RCVD_COUNT_THREE(0.00)[3]; FREEMAIL_CC(0.00)[gmail.com,FreeBSD.org]; FROM_HAS_DN(0.00)[]; ARC_NA(0.00)[]; TO_MATCH_ENVRCPT_SOME(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; DMARC_NA(0.00)[dnsmgr.net]; TAGGED_RCPT(0.00)[]; R_SPF_NA(0.00)[no SPF record]; MID_RHS_MATCH_FROM(0.00)[] X-Rspamd-Queue-Id: 4Qqwj33wHtz4JCG X-Spamd-Bar: -- X-ThisMailContainsUnwantedMimeParts: N > On Mon, Jun 26, 2023 at 7:50?AM Vitaliy Gusev wrote: > > > > Hi Aryeh, > > > > Have you wired a guest memory with bhyve's -S option? > > > > -S Wire guest memory > > > > > > Anyway, OS does not have another choice than kill a process to free some memory > > when RAM+swap is fully used (assume kernel already scanned Inactive memory). > > > > As recommendation: > > > > Look at an another memory consumers like ZFS, another processes > > Increase swap > > Tune vm.overcommit sysctl. See tuning(7) for details. > > > > > > So in short, there is no good way to run applications that fully use 10 GB > > memory on a systems with just 1 GB RAM + 1 GB swap. You should have > > enough resources to do that. > > You completely mischaracterize the situation I want to reserve 16GB or > 24GB for the VM and the other 8 are for the host (and the host > alone).. I have already used the -S flag since it is required by > passthru > > Also the memory is successfully reserved accoring to top(1) but yet it > still runs out (i.e. it shows 19GB are wired). Are you running ZFS? Have you restriced the memory that ZFS can consume so that it does not run the system out of memory? I suggest adding something like: vfs.zfs.arc_max=4294967296 to /boot/loader.conf To restrict ZFS to using 4G of your 8G of memory you have reserved for the host. > -- > Aryeh M. Friedman, Lead Developer, http://www.PetiteCloud.org > > > -- Rod Grimes rgrimes@freebsd.org