Page MenuHomeFreeBSD

vm_page: Use atomic loads for cmpset loops
AcceptedPublic

Authored by markj on Fri, Oct 4, 3:07 PM.

Details

Reviewers
alc
kib
dougm
Summary

Make sure that the compiler loads the initial value value only once.
Because atomic_fcmpset is used to load the value for subsequent
iterations, this is probably not needed, but we should not rely on that.

I verified that code generated for an amd64 GENERIC kernel does not
change.

Diff Detail

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

Event Timeline

This revision is now accepted and ready to land.Fri, Oct 4, 3:31 PM
sys/vm/vm_page.c
5274

What about here?

sys/vm/vm_page.c
5274

I don't see any need to here, since the value is not used before it's passed to atomic_fcmpset. Or, in the last case in this function, it's loaded only once.