Page MenuHomeFreeBSD

Implement unr64
ClosedPublic

Authored by mjg on Nov 20 2018, 3:24 AM.
Tags
None
Referenced Files
F105793881: D18054.diff
Fri, Dec 20, 7:08 PM
Unknown Object (File)
Oct 2 2024, 12:44 PM
Unknown Object (File)
Oct 2 2024, 3:33 AM
Unknown Object (File)
Oct 1 2024, 8:58 PM
Unknown Object (File)
Sep 21 2024, 5:17 AM
Unknown Object (File)
Sep 20 2024, 6:36 AM
Unknown Object (File)
Sep 17 2024, 3:22 AM
Unknown Object (File)
Sep 15 2024, 9:02 PM
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.