From nobody Thu Jan 13 20:00:14 2022 X-Original-To: dev-commits-src-all@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 2A182194785E; Thu, 13 Jan 2022 20:00:25 +0000 (UTC) (envelope-from ken@kdm.org) Received: from mithlond.kdm.org (mithlond.kdm.org [96.89.93.250]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mithlond.kdm.org", Issuer "mithlond.kdm.org" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4JZZzY0Vrkz4jSq; Thu, 13 Jan 2022 20:00:25 +0000 (UTC) (envelope-from ken@kdm.org) Received: from mithlond.kdm.org (localhost [127.0.0.1]) by mithlond.kdm.org (8.15.2/8.14.9) with ESMTPS id 20DK0EIc054190 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Thu, 13 Jan 2022 15:00:15 -0500 (EST) (envelope-from ken@mithlond.kdm.org) Received: (from ken@localhost) by mithlond.kdm.org (8.15.2/8.15.2/Submit) id 20DK0ENq054189; Thu, 13 Jan 2022 15:00:14 -0500 (EST) (envelope-from ken) Date: Thu, 13 Jan 2022 15:00:14 -0500 From: "Kenneth D. Merry" To: Gleb Smirnoff Cc: src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Subject: Re: git: ca2a7262df5e - main - Free UMA zones when a pass(4) instance goes away. Message-ID: <20220113200013.GA53673@mithlond.kdm.org> References: <202201131556.20DFud7f088871@gitrepo.freebsd.org> List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.23 (2014-03-12) X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.4.3 (mithlond.kdm.org [127.0.0.1]); Thu, 13 Jan 2022 15:00:15 -0500 (EST) X-Spam-Status: No, score=-2.7 required=5.0 tests=ALL_TRUSTED,BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS autolearn=no autolearn_force=no version=3.4.1 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on mithlond.kdm.org X-Rspamd-Queue-Id: 4JZZzY0Vrkz4jSq X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-ThisMailContainsUnwantedMimeParts: N On Thu, Jan 13, 2022 at 10:49:08 -0800, Gleb Smirnoff wrote: > Kenneth, > > On Thu, Jan 13, 2022 at 03:56:39PM +0000, Kenneth D. Merry wrote: > K> commit ca2a7262df5ec5fd07d4ac61738947f48c9cd7f2 > K> Author: Kenneth D. Merry > K> AuthorDate: 2022-01-13 15:50:40 +0000 > K> Commit: Kenneth D. Merry > K> CommitDate: 2022-01-13 15:54:56 +0000 > K> > K> Free UMA zones when a pass(4) instance goes away. > K> > K> If the UMA zones are not freed, we get warnings about re-using the > K> sysctl variables associated with the UMA zones, and we're leaking > K> the other memory associated with the zone structures. e.g.: > K> > K> sysctl_warn_reuse: can't re-use a leaf (vm.uma.pass44.size)! > K> sysctl_warn_reuse: can't re-use a leaf (vm.uma.pass44.flags)! > K> sysctl_warn_reuse: can't re-use a leaf (vm.uma.pass44.bucket_size)! > K> sysctl_warn_reuse: can't re-use a leaf (vm.uma.pass44.bucket_size_max)! > K> sysctl_warn_reuse: can't re-use a leaf (vm.uma.pass44.keg.name)! > K> sysctl_warn_reuse: can't re-use a leaf (vm.uma.pass44.keg.rsize)! > K> sysctl_warn_reuse: can't re-use a leaf (vm.uma.pass44.keg.ppera)! > K> sysctl_warn_reuse: can't re-use a leaf (vm.uma.pass44.keg.ipers)! > K> > K> Also, correctly clear the PASS_FLAG_ZONE_INPROG flag in > K> passcreatezone(). The way it was previously done, it would have > K> had set the flag and cleared all other flags that were set at > K> that point. > > Definitely not my area, but I wonder why would we create a zone per > device? Why not a global zone in the driver? Good question. The primary reason is just that I didn't think about doing it that way. Most everything else in the CAM peripheral drivers is done on a per-instance basis. That said, having separate zones does make it a little easier/clearer to track down memory leaks. The zones are created on the first call to the CAMIOQUEUE ioctl for that instance. 99% of users won't have the zone created, because they haven't used an application that would touch it. The only application in the tree that uses it is camdd(8), when you use the pass I/O method. BTW, the original reason for the asynchronous pass(4) interface was an application at Spectra that sends SCSI passthrough commands to all of the disks in a system (you could have hundreds or perhaps a thousand) simultaneously. Rather than using an application thread per drive, or a thread pool, this allows using one thread, and using kqueue(2)/kevent(2) to get I/O completion notifications. We could change it to use a global zone for I/O requests and another for request buffer memory, but I don't see a pressing reason to do it right now. Ken -- Kenneth Merry ken@FreeBSD.ORG