Skip to content

Commit 1af80d0

Browse files
committed
Merge tag 'slab-for-6.16' of git://git.kernel.org/pub/scm/linux/kernel/git/vbabka/slab
Pull slab updates from Vlastimil Babka: - Make kvmalloc() more suitable for callers that need it to succeed, but without unnecessary overhead by reclaim and compaction to get a physically contiguous allocation. Instead fall back to vmalloc() more easily by default, unless instructed by __GFP_RETRY_MAYFAIL to prefer kmalloc() harder. This should allow the removal of a xfs-specific workaround (Michal Hocko) - Remove potentially excessive warnings due to memory pressure when allocating structures for per-object allocation profiling metadata (Usama Arif) * tag 'slab-for-6.16' of git://git.kernel.org/pub/scm/linux/kernel/git/vbabka/slab: mm: slub: only warn once when allocating slab obj extensions fails mm: kvmalloc: make kmalloc fast path real fast path
2 parents f5ebe7b + 354ad60 commit 1af80d0

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

mm/slub.c

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2084,10 +2084,11 @@ prepare_slab_obj_exts_hook(struct kmem_cache *s, gfp_t flags, void *p)
20842084

20852085
slab = virt_to_slab(p);
20862086
if (!slab_obj_exts(slab) &&
2087-
WARN(alloc_slab_obj_exts(slab, s, flags, false),
2088-
"%s, %s: Failed to create slab extension vector!\n",
2089-
__func__, s->name))
2087+
alloc_slab_obj_exts(slab, s, flags, false)) {
2088+
pr_warn_once("%s, %s: Failed to create slab extension vector!\n",
2089+
__func__, s->name);
20902090
return NULL;
2091+
}
20912092

20922093
return slab_obj_exts(slab) + obj_to_index(s, slab, p);
20932094
}
@@ -4968,14 +4969,16 @@ static gfp_t kmalloc_gfp_adjust(gfp_t flags, size_t size)
49684969
* We want to attempt a large physically contiguous block first because
49694970
* it is less likely to fragment multiple larger blocks and therefore
49704971
* contribute to a long term fragmentation less than vmalloc fallback.
4971-
* However make sure that larger requests are not too disruptive - no
4972-
* OOM killer and no allocation failure warnings as we have a fallback.
4972+
* However make sure that larger requests are not too disruptive - i.e.
4973+
* do not direct reclaim unless physically continuous memory is preferred
4974+
* (__GFP_RETRY_MAYFAIL mode). We still kick in kswapd/kcompactd to
4975+
* start working in the background
49734976
*/
49744977
if (size > PAGE_SIZE) {
49754978
flags |= __GFP_NOWARN;
49764979

49774980
if (!(flags & __GFP_RETRY_MAYFAIL))
4978-
flags |= __GFP_NORETRY;
4981+
flags &= ~__GFP_DIRECT_RECLAIM;
49794982

49804983
/* nofail semantic is implemented by the vmalloc fallback */
49814984
flags &= ~__GFP_NOFAIL;

0 commit comments

Comments
 (0)