From owner-freebsd-jail@freebsd.org Thu Nov 7 08:43:58 2019 Return-Path: Delivered-To: freebsd-jail@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7CAD71ACAB6 for ; Thu, 7 Nov 2019 08:43:58 +0000 (UTC) (envelope-from SRS0=hUrZ=Y7=quip.cz=000.fbsd@elsa.codelab.cz) Received: from elsa.codelab.cz (elsa.codelab.cz [94.124.105.4]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 477xlK2Vfjz4K33 for ; Thu, 7 Nov 2019 08:43:56 +0000 (UTC) (envelope-from SRS0=hUrZ=Y7=quip.cz=000.fbsd@elsa.codelab.cz) Received: from elsa.codelab.cz (localhost [127.0.0.1]) by elsa.codelab.cz (Postfix) with ESMTP id F26C02840C; Thu, 7 Nov 2019 09:43:53 +0100 (CET) Received: from illbsd.quip.test (ip-62-24-92-232.net.upcbroadband.cz [62.24.92.232]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by elsa.codelab.cz (Postfix) with ESMTPSA id 2A20028411; Thu, 7 Nov 2019 09:43:53 +0100 (CET) Subject: Re: Jail resource limits? To: Greg Lewis , freebsd-jail@freebsd.org References: <20191107044331.GA12545@misty.eyesbeyond.com> From: Miroslav Lachman <000.fbsd@quip.cz> Message-ID: <80f22ba1-1f52-bf50-eb79-80d3ed5a45c1@quip.cz> Date: Thu, 7 Nov 2019 09:43:52 +0100 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:52.0) Gecko/20100101 Firefox/52.0 SeaMonkey/2.49.3 MIME-Version: 1.0 In-Reply-To: <20191107044331.GA12545@misty.eyesbeyond.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 477xlK2Vfjz4K33 X-Spamd-Bar: +++++ Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=none (mx1.freebsd.org: domain of SRS0=hUrZ=Y7=quip.cz=000.fbsd@elsa.codelab.cz has no SPF policy when checking 94.124.105.4) smtp.mailfrom=SRS0=hUrZ=Y7=quip.cz=000.fbsd@elsa.codelab.cz X-Spamd-Result: default: False [5.08 / 15.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; RCVD_TLS_LAST(0.00)[]; MIME_GOOD(-0.10)[text/plain]; MIME_TRACE(0.00)[0:+]; DMARC_NA(0.00)[quip.cz]; AUTH_NA(1.00)[]; NEURAL_SPAM_MEDIUM(0.99)[0.989,0]; RCVD_COUNT_THREE(0.00)[3]; TO_MATCH_ENVRCPT_SOME(0.00)[]; IP_SCORE(0.90)[ip: (0.42), ipnet: 94.124.104.0/21(0.21), asn: 42000(3.76), country: CZ(0.09)]; RCPT_COUNT_TWO(0.00)[2]; RCVD_IN_DNSWL_NONE(0.00)[4.105.124.94.list.dnswl.org : 127.0.10.0]; NEURAL_SPAM_LONG(1.00)[0.999,0]; R_SPF_NA(0.00)[]; FORGED_SENDER(0.30)[000.fbsd@quip.cz,SRS0=hUrZ=Y7=quip.cz=000.fbsd@elsa.codelab.cz]; R_DKIM_NA(0.00)[]; SUBJECT_ENDS_QUESTION(1.00)[]; ASN(0.00)[asn:42000, ipnet:94.124.104.0/21, country:CZ]; FROM_NEQ_ENVFROM(0.00)[000.fbsd@quip.cz,SRS0=hUrZ=Y7=quip.cz=000.fbsd@elsa.codelab.cz]; MID_RHS_MATCH_FROM(0.00)[] X-BeenThere: freebsd-jail@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Discussion about FreeBSD jail\(8\)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Nov 2019 08:43:58 -0000 Greg Lewis wrote on 11/07/2019 05:43: > Hi all, > > I've been playing with limiting FreeBSD jail resources with both cpuset and > rctl and I wondered if anyone knew of a way to tell from inside the jail > what these limits are? > > E.g. let's say I use cpuset to limit a jail to CPU0 and rctl to limit a jail > to only using up to 4G of memory. Can I then tell from a process running > inside the jail that these limits are in place? I tried dumping out > sysctl -a and couldn't see anything that seemed to match up with the limits > I put in place. I haven't yet tried writing some code to call cpuset(2) > to see if that works. > > The reason I'm asking is that some software may make decisions based on the > resources available and I'd like to have a way to accurately determine > those resource limits for jailed processes. cpuset called inside a jail will return available cores # cpuset -g pid -1 mask: 2, 3 I don't think it is possible to query rctl limits. Maybe somebody else knows better. Miroslav Lachman