Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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

+9 -6
+9 -6
mm/slub.c
··· 2084 2084 2085 2085 slab = virt_to_slab(p); 2086 2086 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); 2090 2090 return NULL; 2091 + } 2091 2092 2092 2093 return slab_obj_exts(slab) + obj_to_index(s, slab, p); 2093 2094 } ··· 4969 4968 * We want to attempt a large physically contiguous block first because 4970 4969 * it is less likely to fragment multiple larger blocks and therefore 4971 4970 * contribute to a long term fragmentation less than vmalloc fallback. 4972 - * However make sure that larger requests are not too disruptive - no 4973 - * OOM killer and no allocation failure warnings as we have a fallback. 4971 + * However make sure that larger requests are not too disruptive - i.e. 4972 + * do not direct reclaim unless physically continuous memory is preferred 4973 + * (__GFP_RETRY_MAYFAIL mode). We still kick in kswapd/kcompactd to 4974 + * start working in the background 4974 4975 */ 4975 4976 if (size > PAGE_SIZE) { 4976 4977 flags |= __GFP_NOWARN; 4977 4978 4978 4979 if (!(flags & __GFP_RETRY_MAYFAIL)) 4979 - flags |= __GFP_NORETRY; 4980 + flags &= ~__GFP_DIRECT_RECLAIM; 4980 4981 4981 4982 /* nofail semantic is implemented by the vmalloc fallback */ 4982 4983 flags &= ~__GFP_NOFAIL;