sdimitro commented on this pull request.
> + * which otherwise would be skipped for entries in the dbuf cache.
+ */
+void
+arc_buf_access(arc_buf_t *buf)
+{
+ mutex_enter(&buf->b_evict_lock);
+ arc_buf_hdr_t *hdr = buf->b_hdr;
+
+ /*
+ * Avoid taking the hash_lock when possible as an optimization.
+ * The header must be checked again under the hash_lock in order
+ * to handle the case where it is concurrently being released.
+ */
+ if (hdr->b_l1hdr.b_state == arc_anon || HDR_EMPTY(hdr)) {
+ mutex_exit(&buf->b_evict_lock);
+ return;
Looking at the original commit by Brian someone else raised the same question
in the PR and Brian's reply was the following:
```
behlendorf on Dec 28, 2017 Owner
In my local testing I did add an additional kstat here in order to determine if
including this additional check was worthwhile. Keep in mind this check could
be dropped entirely since it's safe to rely on the one under the mutex. Based
on my test results 99.99+% of the released headers were caught here without the
need to take the hash lock, so I opted to keep it as an optimization to
minimize any potential lock contention. After determining that I was only
really interested in how many slipped through since that was the exceptional
case. So the value is only bumped in the second conditional.
```
At least a comment here explaining the above rationale would be appropriate
IMHO.
--
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/openzfs/openzfs/pull/606#discussion_r187174770
------------------------------------------
openzfs: openzfs-developer
Permalink:
https://openzfs.topicbox.com/groups/developer/discussions/T9235f754de980785-M23492e0526f7af044544faa0
Delivery options: https://openzfs.topicbox.com/groups