在 2024/10/5 9:41, Jens Axboe 写道:
On 10/4/24 7:26 PM, Zhu Yanjun wrote:
? 2024/10/5 0:31, Bart Van Assche ??:
On 10/4/24 5:40 AM, Zhu Yanjun wrote:
So I add a jiffies (u64) value into the name.
I don't think that embedding the value of the jiffies counter in the kmem cache names is sufficient to make cache names unique. That sounds like a fragile approach to me.
Sorry. I can not get you. Why jiffies counter is not sufficient to
make cache names unique? And why is it a fragile approach?
1 jiffy is an eternity, what happens if someone calls
kmem_cache_create() twice in that window?
Got it. Thanks a lot.
Zhu Yanjun
I read your latest commit. In your commit, the ida is used to make
cache names unique. It is a good approach if it can fix this problem.
That seems over-engineered. Seems to me that either these things should
share a slab cache (why do they need one each, if they are the same
sized object?!). And if they really do need one, surely something ala:
static atomic_long_t slab_index;
sprintf(slab_name, "foo-%ld", atomic_inc_return(&slab_index));
would be all you need.
--
Best Regards,
Yanjun.Zhu