Article View: muc.lists.netbsd.source-changes
Article #7Re: CVS commit: src/sys/dev/usb
From: Taylor R Campbell
Date: Fri, 23 Oct 2026 16:37
Date: Fri, 23 Oct 2026 16:37
41 lines
3496 bytes
3496 bytes
> Date: Fri, 23 Oct 2026 09:07:24 -0700
> From: Jason Thorpe <thorpej@me.com>
>
> > On Oct 23, 2026, at 8:33 AM, Taylor R Campbell <riastradh@NetBSD.org> wrote:
> >
> > Maybe PR_ZERO should be an option to pool_cache_init rather than to
> > pool_cache_get? (And pool_cache_get should assert that it is _not_
> > set. Also pool_cache_init can assert that ctor/dtor is mutually
> > exclusive with PR_ZERO.)
>
> Alternatively, there could be a magic constructor function value that could specify zero-on-allocate, since PR_ZERO and having a constructor are really mutually-exclusive.
>
> int
> pool_cache_ctor_zero(void *arg __unused, void *obj __unused, int flags __unused)
> {
> return 0;
> }
>
> …then in pool_cache_get_paddr(), before “object” is successfully returned:
>
> If (__predict_false(pc->pc_ctor == pool_cache_ctor_zero) {
> memset(object, 0, pp->pp_pool->pr_reqsize);
> }
>
> Could even specify a magic destructor if you want to zero-on-free (e.g. security-sensitive uses).
I think a flag is clearer than a magic ctor/dtor. The point here is
to change the behaviour of pool_cache_get (or pool_cache_put), but the
ctor/dtor explicitly _do not generally_ run on pool_cache_get/put (a
common misunderstanding I have seen, and had myself in the past).
Using them for this role seems likely to be even more confusing.
--
Posted automagically by a mail2news gateway at muc.de e.V.
Please direct questions, flames, donations, etc. to news-admin@muc.de
Technical Details
Message-ID:
<20261023163739.BA36A84D84@mail.netbsd.org>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!2.eu.feeder.erje.net!feeder.erje.net!news2.arglkargh.de!news.karotte.org!news.space.net!news.muc.de!.POSTED.news.muc.de!not-for-mailReferences:
<74B6EB23-3B52-402A-BF60-6640A4412FBB@me.com>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!2.eu.feeder.erje.net!feeder.erje.net!news2.arglkargh.de!news.karotte.org!news.space.net!news.muc.de!.POSTED.news.muc.de!not-for-mail From: Taylor R Campbell <riastradh@NetBSD.org> Newsgroups: muc.lists.netbsd.source-changes Subject: Re: CVS commit: src/sys/dev/usb Date: Fri, 23 Oct 2026 16:37:38 +0000 Organization: Newsgate at muc.de e.V. Sender: source-changes-d-owner@NetBSD.org Approved: news-admin@muc.de Distribution: world Message-ID: <20261023163739.BA36A84D84@mail.netbsd.org> References: <74B6EB23-3B52-402A-BF60-6640A4412FBB@me.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: news.muc.de; posting-host="news.muc.de:193.149.48.2"; logging-data="49757"; mail-complaints-to="news-admin@muc.de" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=netbsd.org; s=20240131; t=1792773462; bh=V65khpZK1TsFXzUvnuu/WyWOy27oBsSmjE5qzOs8ix4=; h=To:CC:In-reply-to:Subject:Date:From:List-Id:List-Unsubscribe; b=AJOyUA4iEVPmAhSyP/Qdr4lkgyp5W6H7VgK/XekwlPWFooUCHGUbk8jgHY8q9AC8s M/95pnsGIqRXKZJ4TuwGxKVkIXKl5TgIUMEg+v6qx1r2GyEto7eQHYTGUXJnl2iPUP FaIk2lo7vxTr48RL2eqb4W7zdkIvua3yaymWSoc0= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=netbsd.org; s=20240131; t=1792773459; bh=V65khpZK1TsFXzUvnuu/WyWOy27oBsSmjE5qzOs8ix4=; h=To:CC:In-reply-to:Subject:Date:From; b=MyrWhLpjWQTeMMoScByrh/MEwx9oRt+hy8Sll5oZZF31R0aj2waSC4yK9/o413KAb X1t+FhpwhBXiQ33SBHaX0LFHfeM3EfH2DJsdr/GK0Mca67ccXJYiFXTYMLL4WLqp5s tOakXn+9c7dAsC5C+LhreR8OXrzdGOa9lNbSCTnE= In-reply-to: <74B6EB23-3B52-402A-BF60-6640A4412FBB@me.com> (thorpej@me.com) Precedence: bulk X-Newsgate-Id: f02c70b8849f+ X-No-Archive: Yes