Page MenuHomeFreeBSD

Implement unr64
ClosedPublic

Authored by mjg on Nov 20 2018, 3:24 AM.
Tags
None
Referenced Files
Unknown Object (File)
Sun, Apr 13, 4:26 AM
Unknown Object (File)
Sun, Mar 30, 7:00 AM
Unknown Object (File)
Mar 7 2025, 5:37 PM
Unknown Object (File)
Feb 10 2025, 1:16 AM
Unknown Object (File)
Feb 4 2025, 2:18 AM
Unknown Object (File)
Jan 29 2025, 4:18 AM
Unknown Object (File)
Jan 2 2025, 1:38 AM
Unknown Object (File)
Dec 30 2024, 3:36 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

Lint
Lint Skipped
Unit
Tests Skipped
Build Status
Buildable 20906

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

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.