tech-kern archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: Passive serialization support in the pool allocator
> Date: Tue, 21 Dec 2021 18:19:56 -0800
> From: Jason Thorpe <thorpej%me.com@localhost>
>
> An #ifdef that Taylor added in the new DRM code was bugging me,
> because a similar situation already existed in the NetBSD kernel,
> whereby the type stability of a object's backing memory (the iam
> existentium case being LWPs) was required for a passively-serialized
> weak reference to work. The LWP pool cache had a hack to handle it,
> and the hack was propagated to the new DRM code under an ``#ifdef
> __NetBSD_''.
>
> I initially fixed this by adding a ``pre-destruct'' callback that
> could be optionally set for a pool cache, but after further
> discussion, it seemed like having direct knowledge of passive
> serialization synchronization points in the allocator was a better
> solution, so here is a diff that implements it for you review.
>
> https://www.netbsd.org/~thorpej/pool-pser-diff.txt
Thanks, I think this API is better.
It will be important to emphasize in the man page that this guarantees
a pserialize_perform/xc_barrier(0)/RCU grace period between
pool_cache_put and calling the dtor before returning the pages to the
backing store -- _not_ between pool_cache_put and the next
pool_cache_get that yields the object returned by pool_cache_put for
reuse.
Same with pool_put and calling the pool allocator's free function --
_not_ pool_put and pool_get.
Might also be worth noting that PR_PSERIALIZE implies pool_put and
pool_cache_put are allowed only in sleepable thread context --
absolutely not in soft interrupt context, let alone hard interrupt
context.
Home |
Main Index |
Thread Index |
Old Index