Il 14/07/2013 12:23, liu ping fan ha scritto: >> if the refcount ops are frequent enough, I strongly suspect cacheline >> bouncing has a bigger effect than the memory barriers. >> > When out of biglock, object_ref/unref to pin the Device will be quite > often, and can it be marked "frequent"? Or how can we say something is > frequent?
I didn't say it is not frequent. I said I suspect (it _is_ just a suspicion, not the result of a benchmark, but at least I said so...) that "cacheline bouncing has a bigger effect than the memory barriers" and thus the API would not have such a dramatic impact. >> Third, it is making the API completely unorthogonal, and "tend to be >> exceptions" is not a justification. >> >> The justification here could be, rather than the performance, having to >> remember how to use atomic_fetch_dec in the unref side. I don't really >> buy that, but if you really care, do something like >> >> #define atomic_ref(ptr, field) >> #define atomic_unref(ptr, field, releasefn) >> >> i.e. define a new interface similar to kref_get/kref_put and, since you >> are at it, optimize it. >> > Thanks, a abstract layer for refct is what I need. If someone cares enough to review your patch (which _must_ come with documentation), that's fine for me. I don't think it's worthwhile, but others may disagree. Paolo