Page MenuHomeFreeBSD

Use SMR to provide safe unlocked lookup for pctries from SMR zones
ClosedPublic

Authored by cem on Jul 22 2020, 10:43 PM.

Details

Summary

Adapt r358130, for the almost identical vm_radix, to the pctrie subsystem.
Like that change, the tree is kept correct for readers with store barriers
and careful ordering. Existing locks serialize writers.

Add a PCTRIE_DEFINE_SMR() wrapper that takes an additional smr_t parameter
and instantiates a FOO_PCTRIE_LOOKUP_UNLOCKED() function, in addition to the
usual definitions created by PCTRIE_DEFINE().

Interface consumers will be introduced in later commits.

Diff Detail

Repository
rS FreeBSD src repository
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

cem requested review of this revision.Jul 22 2020, 10:43 PM
cem created this revision.

What exactly prevents vm_radix from using this code instead of having duplication? The node structures have identical layout.

sys/kern/subr_pctrie.c
107 ↗(On Diff #74824)

I think the comment from vm_radix_node_get() should be duplicated as well.

711 ↗(On Diff #74824)

Wouldn't child be a better name than tmp? Ditto below.

What exactly prevents vm_radix from using this code instead of having duplication? The node structures have identical layout.

I don't know; this predates me. Jeff probably has a better idea. Looks like vm_radix dates to a 2009 GSoC / 2011 Attilio r226645. pctrie dates to 2013 Jeff r250551.

Has pindex_t always been uint64_t, or was it 32-bit on 32-bit platforms in the past? pctrie.h is a 64-bit index only API.

sys/kern/subr_pctrie.c
107 ↗(On Diff #74824)

Sure, will do.

711 ↗(On Diff #74824)

tmp matches vm_radix_remove(). As the codebases are mostly complete duplicates, I'd prefer to keep these in sync.

cem marked an inline comment as done.

Replicate vm_radix_node_get comment to pctrie_node_get.

In D25781#571011, @cem wrote:

What exactly prevents vm_radix from using this code instead of having duplication? The node structures have identical layout.

I don't know; this predates me. Jeff probably has a better idea. Looks like vm_radix dates to a 2009 GSoC / 2011 Attilio r226645. pctrie dates to 2013 Jeff r250551.

Has pindex_t always been uint64_t, or was it 32-bit on 32-bit platforms in the past? pctrie.h is a 64-bit index only API.

I think pindex_t has always been 64 bits wide, at least since vm_radix.c and this code were committed.

This revision is now accepted and ready to land.Jul 24 2020, 2:43 PM