mm-commits.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* + mm-slub-consider-rest-of-partial-list-if-acquire_slab-fails.patch added to -mm tree
@ 2020-12-29 21:00 akpm
  0 siblings, 0 replies; only message in thread
From: akpm @ 2020-12-29 21:00 UTC (permalink / raw)
  To: mm-commits, rientjes, penberg, iamjoonsoo.kim, cl, jannh


The patch titled
     Subject: mm, slub: consider rest of partial list if acquire_slab() fails
has been added to the -mm tree.  Its filename is
     mm-slub-consider-rest-of-partial-list-if-acquire_slab-fails.patch

This patch should soon appear at
    https://ozlabs.org/~akpm/mmots/broken-out/mm-slub-consider-rest-of-partial-list-if-acquire_slab-fails.patch
and later at
    https://ozlabs.org/~akpm/mmotm/broken-out/mm-slub-consider-rest-of-partial-list-if-acquire_slab-fails.patch

Before you just go and hit "reply", please:
   a) Consider who else should be cc'ed
   b) Prefer to cc a suitable mailing list as well
   c) Ideally: find the original patch on the mailing list and do a
      reply-to-all to that, adding suitable additional cc's

*** Remember to use Documentation/process/submit-checklist.rst when testing your code ***

The -mm tree is included into linux-next and is updated
there every 3-4 working days

------------------------------------------------------
From: Jann Horn <jannh@google.com>
Subject: mm, slub: consider rest of partial list if acquire_slab() fails

acquire_slab() fails if there is contention on the freelist of the page
(probably because some other CPU is concurrently freeing an object from
the page).  In that case, it might make sense to look for a different page
(since there might be more remote frees to the page from other CPUs, and
we don't want contention on struct page).

However, the current code accidentally stops looking at the partial list
completely in that case.  Especially on kernels without CONFIG_NUMA set,
this means that get_partial() fails and new_slab_objects() falls back to
new_slab(), allocating new pages.  This could lead to an unnecessary
increase in memory fragmentation.

Link: https://lkml.kernel.org/r/20201228130853.1871516-1-jannh@google.com
Fixes: 7ced37197196 ("slub: Acquire_slab() avoid loop")
Signed-off-by: Jann Horn <jannh@google.com>
Acked-by: David Rientjes <rientjes@google.com>
Acked-by: Joonsoo Kim <iamjoonsoo.kim@lge.com>
Cc: Christoph Lameter <cl@linux.com>
Cc: Pekka Enberg <penberg@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---

 mm/slub.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/mm/slub.c~mm-slub-consider-rest-of-partial-list-if-acquire_slab-fails
+++ a/mm/slub.c
@@ -1973,7 +1973,7 @@ static void *get_partial_node(struct kme
 
 		t = acquire_slab(s, n, page, object == NULL, &objects);
 		if (!t)
-			break;
+			continue; /* cmpxchg raced */
 
 		available += objects;
 		if (!object) {
_

Patches currently in -mm which might be from jannh@google.com are

mm-slub-consider-rest-of-partial-list-if-acquire_slab-fails.patch


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2020-12-29 21:01 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-29 21:00 + mm-slub-consider-rest-of-partial-list-if-acquire_slab-fails.patch added to -mm tree akpm

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).