[Question] The necessity of transaction ID in SLUB.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi all,

I have a question about the necessity of slub's transaction id.
I found that it was Introduced by quite old commit 8a5ec0ba42c4
("Lockless (and preemptless) fastpaths for slub"). And this
concept is still being used.

By using the transaction ID, we can verify that there is no
update and it isn't running on other cpu. But it seems like
that we can do these things by comparing c->cpu_slab->freelist.

Let's assume we don't use transaction id.

If other slub events occurred, c->cpu_slab->freelist will be
different generally. But even if other slub events occurred,
c->cpu_slab->freelist can be the same.

There is 2 cases,

1) c->cpu_slab->page is unfrozen and frozen by another cpu. (is it possible?)
2) c->cpu_slab->freelist == NULL

In the first case, cpu_slab structure can be different. But updating
freelist isn't a problem.

In the second case, slab alloc's fast-path doesn't have to care
about it. Because it will call __slab_alloc instead of cmpxchg
In the slab free's fast-path, c->cpu_slab->freelist can be NULL.
So we have to check whether slab page is changed by other
events. We can do this by checking the cpu_slab's page
like below.

this_cpu_cmpxchg_double(
s->cpu_slab->freelist, s->cpu_slab->page,
object, page, next_object,
s->cpu_slab->page)

I feel that I missed something important. Please let me know if
I missed something.

Thanks.




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux