From: Wonhyuk Yang <vvghjk1234@gmail.com>
To: linux-mm@kvack.org
Cc: Christoph Lameter <cl@linux.com>, Joonsoo Kim <iamjoonsoo.kim@lge.com>
Subject: [Question] The necessity of transaction ID in SLUB.
Date: Sun, 21 Nov 2021 23:11:11 +0900 [thread overview]
Message-ID: <CAEcHRTpdMX=dqTwNrw7wjdK_GhZ4gwkqtOYeMnNxt_JXr-eG6w@mail.gmail.com> (raw)
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.
next reply other threads:[~2021-11-21 14:11 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-11-21 14:11 Wonhyuk Yang [this message]
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CAEcHRTpdMX=dqTwNrw7wjdK_GhZ4gwkqtOYeMnNxt_JXr-eG6w@mail.gmail.com' \
--to=vvghjk1234@gmail.com \
--cc=cl@linux.com \
--cc=iamjoonsoo.kim@lge.com \
--cc=linux-mm@kvack.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox