Page MenuHomeFreeBSD

Add function to OSD to get values without taking the lock.
ClosedPublic

Authored by stevek on Apr 4 2024, 12:18 AM.
Tags
None
Referenced Files
Unknown Object (File)
Tue, Oct 29, 4:55 AM
Unknown Object (File)
Oct 9 2024, 1:32 AM
Unknown Object (File)
Oct 5 2024, 11:01 AM
Unknown Object (File)
Oct 2 2024, 9:15 AM
Unknown Object (File)
Sep 30 2024, 10:06 PM
Unknown Object (File)
Sep 27 2024, 10:34 AM
Unknown Object (File)
Sep 15 2024, 2:52 PM
Unknown Object (File)
Sep 14 2024, 9:33 PM
Subscribers

Details

Summary

There are some cases of OSD use where the value is only initialized once
at a point where successive access of the value can be done so safely
without the need to take the lock.

Obtained from: Juniper Networks, Inc.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped
Build Status
Buildable 57717
Build 54605: arc lint + arc unit

Event Timeline

Some uses of OSD may do so in a way where the value is only set once at a point where successive get of the value can be done so safely without the need to take the lock.

I think this sentence is not quite right. :)

sys/kern/kern_osd.c
281

osd_get_unlocked() would be more consistent with this kind of pattern elsewhere in the tree.

291

Changed from _nolock to _unlocked in naming and updated commit log message.

sys/kern/kern_osd.c
291

Assuming you just didn't see it, I think this suggestion should still be applied. Or is there some reason not to?

sys/kern/kern_osd.c
291

I probably would not be necessary in the cases that I have seen where unlocked access makes sense. However, I suppose one could do this for some of the potential cases, but wouldn't atomic_store_ptr be necessary also in the osd_set_reserved() function if doing so?

sys/kern/kern_osd.c
291

It's not strictly necessary. Adding the atomic qualifier here 1) helpers readers understand that this isn't a normal, synchronized memory access, 2) provides more information to concurrency sanitizers to help avoid reporting false positives.

I think it would make sense to modify osd_set_reserved() too.

Use atomic to read OSD slot data

This revision is now accepted and ready to land.May 17 2024, 2:27 PM