The former is intended for use in vmspace_exit(). The latter is to
encourage use of explicit loads rather than relying on the volatile
qualifier. This works better with kernel sanitizers, which can
intercept atomic(9) calls, and makes tricky lockless code easier to read
by not forcing the reader to remember which variables are declared
volatile.
Details
- Reviewers
kib mjg mmel - Group Reviewers
manpages - Commits
- rS367333: refcount(9): Add refcount_release_if_last() and refcount_load()
Diff Detail
- Repository
- rS FreeBSD src repository - subversion
- Lint
Lint Not Applicable - Unit
Tests Not Applicable
Event Timeline
I remember trying to add something of the sort and running into a conflict with linuxkpi. Have you compiled the entire kernel + modules with it? There is definitely a refcount_* namespace conflict, but I don't remember if they have read or load.
Also there are not that many consumers of the refcount API. Perhaps we can commit this as the first step, when patch every refcount* user to stop immediate reats and finally add a refcount_t type and convert everyone in one go. I can provide diffs for vfs and all the struct file handling. Step of that sort is necessary and the earlier the better.
I did compile and boot GENERIC. I think you are thinking of refcount_read().
Also there are not that many consumers of the refcount API. Perhaps we can commit this as the first step, when patch every refcount* user to stop immediate reats and finally add a refcount_t type and convert everyone in one go. I can provide diffs for vfs and all the struct file handling. Step of that sort is necessary and the earlier the better.
Yes I would eventually like to have a refcount_t. My aim here is to convert vmspace's custom reference counter to use refcount(9), and there are several naked loads of vm_refcnt. The next step would be to start converting refcount(9) consumers to use refcount_load() and MFC as much as possible before making any KPI changes.
sys/sys/refcount.h | ||
---|---|---|
183 ↗ | (On Diff #79076) | Ah right, n is unsigned. |
Well the question is what about the clash then. It is a problem in waiting, but it does not have to be immediately addressed.
Tested on ARM and ARM64
sys/sys/refcount.h | ||
---|---|---|
183 ↗ | (On Diff #79082) | n is not used in format string |