From: Jann Horn <jannh@google.com>
To: Christoph Lameter <cl@linux.com>,
Pekka Enberg <penberg@kernel.org>,
David Rientjes <rientjes@google.com>,
Joonsoo Kim <iamjoonsoo.kim@lge.com>,
Andrew Morton <akpm@linux-foundation.org>
Cc: Linux-MM <linux-mm@kvack.org>
Subject: commit "slub: Acquire_slab() avoid loop" wrongly causes rest of partial slabs to be skipped?
Date: Wed, 23 Dec 2020 13:52:27 +0100 [thread overview]
Message-ID: <CAG48ez1eBJrOTc-F9gA=7ebBd__R+Z7JZCoOHtWTkPvcvsaNtg@mail.gmail.com> (raw)
The commit message of commit 7ced371971966 ("slub: Acquire_slab()
avoid loop") claims:
> Avoid the loop in acquire slab and simply fail if there is a conflict.
>
> This will cause the next page on the list to be considered.
However, get_partial_node() looks like this:
static void *get_partial_node(struct kmem_cache *s, struct kmem_cache_node *n,
struct kmem_cache_cpu *c, gfp_t flags)
{
struct page *page, *page2;
void *object = NULL;
unsigned int available = 0;
int objects;
[...]
spin_lock(&n->list_lock);
list_for_each_entry_safe(page, page2, &n->partial, slab_list) {
void *t;
[...]
t = acquire_slab(s, n, page, object == NULL, &objects);
if (!t)
break;
[...]
}
spin_unlock(&n->list_lock);
return object;
}
So actually, if the cmpxchg() fails, we'll entirely bail out of
get_partial_node() and might, if the system isn't NUMA, fall back to
allocating more memory with new_slab()? That seems to me like it might
cause fragmented slabs to slowly use more memory than they should over
time.
Should the loop in get_partial_node() be using "continue" instead of
"break" in that case, so that the rest of the partial list will be
considered as the commit message claims?
next reply other threads:[~2020-12-23 12:52 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-12-23 12:52 Jann Horn [this message]
2020-12-24 2:23 ` commit "slub: Acquire_slab() avoid loop" wrongly causes rest of partial slabs to be skipped? Joonsoo Kim
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='CAG48ez1eBJrOTc-F9gA=7ebBd__R+Z7JZCoOHtWTkPvcvsaNtg@mail.gmail.com' \
--to=jannh@google.com \
--cc=akpm@linux-foundation.org \
--cc=cl@linux.com \
--cc=iamjoonsoo.kim@lge.com \
--cc=linux-mm@kvack.org \
--cc=penberg@kernel.org \
--cc=rientjes@google.com \
/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;
as well as URLs for NNTP newsgroup(s).