Page MenuHomeFreeBSD

Implement unr64
ClosedPublic

Authored by mjg on Nov 20 2018, 3:24 AM.
Tags
None
Referenced Files
Unknown Object (File)
Mon, Sep 29, 8:43 AM
Unknown Object (File)
Sep 3 2025, 2:15 PM
Unknown Object (File)
Sep 3 2025, 4:25 AM
Unknown Object (File)
Aug 20 2025, 1:06 AM
Unknown Object (File)
Aug 15 2025, 12:55 PM
Unknown Object (File)
Aug 2 2025, 8:46 PM
Unknown Object (File)
Jul 28 2025, 10:28 PM
Unknown Object (File)
Jul 28 2025, 8:13 AM
Subscribers

Details

Summary

Important users of unr like tmpfs or pipes can get away with just ever-increasing counters, making the overhead of managing the state for 32 bit counters a pessimization.

The patch changes it to an atomic variable. This can be further sped up by making the counts variable "allocate" ranges and store them per-cpu.

To that end, the code mimics the 32-bit variant by having a struct.

Architectures which failed to build with 64-bit atomics use a mutex-protected routine.

tmpfs conversion will be done later.
pipe conversion will be committed separately. pipes get stated a lot, removing the benefit of lazy allocation in the first place, thus the code allocates unconditionally

Test Plan

tinderbox

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

mjg edited the summary of this revision. (Show Details)

I think this is fine, but note that it would make it highly likely for compat11 binaries (where ino numbers are 32bit) to see non-unique pipe inode numbers due to truncation.

sys/sys/systm.h
526 ↗(On Diff #50622)

Can we provide some define in machine/atomic.h, like __ATOMIC_NO_64_OPS, and test this symbol instead of #ifdefing specific arches ?

This revision is now accepted and ready to land.Nov 20 2018, 9:44 AM
This revision was automatically updated to reflect the committed changes.