linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [Question] The necessity of transaction ID in SLUB.
@ 2021-11-21 14:11 Wonhyuk Yang
  2021-11-22  9:25 ` Christoph Lameter
  0 siblings, 1 reply; 8+ messages in thread
From: Wonhyuk Yang @ 2021-11-21 14:11 UTC (permalink / raw)
  To: linux-mm; +Cc: Christoph Lameter, Joonsoo Kim

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.


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2021-11-24  0:08 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-21 14:11 [Question] The necessity of transaction ID in SLUB Wonhyuk Yang
2021-11-22  9:25 ` Christoph Lameter
2021-11-23  3:32   ` Wonhyuk Yang
2021-11-23  9:38     ` Christoph Lameter
2021-11-23 12:18       ` Wonhyuk Yang
2021-11-23 12:30         ` Wonhyuk Yang
2021-11-23 13:54         ` Christoph Lameter
2021-11-23 23:59         ` Wonhyuk Yang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox