From nobody Sat Dec 24 11:09:54 2022 X-Original-To: freebsd-jail@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 4NfLtW1sxRz1J544 for ; Sat, 24 Dec 2022 11:10:11 +0000 (UTC) (envelope-from melifaro@ipfw.ru) Received: from forward500b.mail.yandex.net (forward500b.mail.yandex.net [IPv6:2a02:6b8:c02:900:1:45:d181:d500]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4NfLtV6Zdhz45KM for ; Sat, 24 Dec 2022 11:10:10 +0000 (UTC) (envelope-from melifaro@ipfw.ru) Authentication-Results: mx1.freebsd.org; none Received: from sas2-cc22fd2335f8.qloud-c.yandex.net (sas2-cc22fd2335f8.qloud-c.yandex.net [IPv6:2a02:6b8:c08:6c82:0:640:cc22:fd23]) by forward500b.mail.yandex.net (Yandex) with ESMTP id B9F725E7B5; Sat, 24 Dec 2022 14:10:06 +0300 (MSK) Received: by sas2-cc22fd2335f8.qloud-c.yandex.net (smtp/Yandex) with ESMTPSA id 4AKHpT8YOqM1-RuYq2oCL; Sat, 24 Dec 2022 14:10:06 +0300 X-Yandex-Fwd: 1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ipfw.ru; s=mail; t=1671880206; bh=XjsRFPa9nPDZKpe61+ezOmKGeNL9+Y6rC6FWnBnKctI=; h=Message-Id:To:Date:References:Cc:In-Reply-To:From:Subject; b=rxBr/bPI4A6C4i63/gojbK7yrpea7aGUM0MVnD45M51p4LysBPcBopFIpNwI3/XUv 6GXZ6Zrq3BRANNV8WMv24ljMpcutQ5BWdfCZ03DJj1JfuA00CuA+RAPcgchABQ8fTE 7+95fsFU8uNi7urCCNSO47XX4Hb0Z1h/epHfWlwU= Content-Type: text/plain; charset=utf-8 List-Id: Discussion about FreeBSD jail(8) List-Archive: https://lists.freebsd.org/archives/freebsd-jail List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-jail@freebsd.org Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3731.200.110.1.12\)) Subject: Re: Is it possible to employ epoch to simplify managing prison lifecycle From: "Alexander V. Chernikov" In-Reply-To: Date: Sat, 24 Dec 2022 11:09:54 +0000 Cc: Zhenlei Huang , freebsd-jail@freebsd.org Content-Transfer-Encoding: quoted-printable Message-Id: References: <9BD54A54-A809-4D3E-BCBA-639E6C61FE37@FreeBSD.org> <4E70D6D2-4E80-4AAD-BB3C-9295F586D1FF@ipfw.ru> To: Mateusz Guzik X-Mailer: Apple Mail (2.3731.200.110.1.12) X-Rspamd-Queue-Id: 4NfLtV6Zdhz45KM X-Spamd-Bar: ---- X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[]; TAGGED_RCPT(0.00)[]; ASN(0.00)[asn:208722, ipnet:2a02:6b8::/32, country:FI] X-Rspamd-Pre-Result: action=no action; module=replies; Message is reply to one we originated X-ThisMailContainsUnwantedMimeParts: N > On 23 Dec 2022, at 15:27, Mateusz Guzik wrote: >=20 > On 12/23/22, Alexander V. Chernikov wrote: >>=20 >>=20 >>> On 16 Dec 2022, at 16:29, Mateusz Guzik wrote: >>>=20 >>> On 12/16/22, Zhenlei Huang wrote: >>>> Hi, >>>>=20 >>>> While hacking `sys/kern/kern_jail.c` I got lost. >>>>=20 >>>> There're lots of ref / unref and flags to prevent visit invalid = prison >>>> while >>>> concurrent modification is possible and some refs looks weird. >>>>=20 >>>> Is it possible to employ epoch(9) to simplify managing of prison >>>> lifecycle >>>> ? >>>>=20 >>>=20 >>> Some of the ref/unref cycles are probably avoidable to begin with, = but >>> ultimately the thing to do here is to employ per-cpu reference >>> counting, if at all needed. >>>=20 >>> I have a wip patch to provide such a mechanism, it may or may not = land >>> this month. >> That would be nice. I=E2=80=99d love to convert nextops refcounting = to that one. >> Do you envision similar semantics as Linux percpu_ref? I mean, does = one need >> to explicitly mark =E2=80=9Cnot in active use=E2=80=9D stage? >=20 > There *something* needed to disable per-cpu operation, otherwise how > can you ever know if the count is 0, apart from going over all cpus > every time, which defeats the point. Ack, sounds reasonable. Happy to test the KPI once it=E2=80=99s = available. >=20 > More specifically, I have a on/off switch for said per-cpu op. This is > modeled after what I did for counters in vfs, see vfs_ref et al. >=20 > --=20 > Mateusz Guzik >=20