[dm-devel] [PATCH] SLUB: Do not fallback to mininum order if __GFP_NORETRY is set
Michal Hocko
mhocko at kernel.org
Thu Apr 19 11:00:51 UTC 2018
On Wed 18-04-18 09:45:39, Cristopher Lameter wrote:
> Mikulas Patoka wants to ensure that no fallback to lower order happens. I
> think __GFP_NORETRY should work correctly in that case too and not fall
> back.
Overriding __GFP_NORETRY is just a bad idea. It will make the semantic
of the flag just more confusing. Note there are users who use
__GFP_NORETRY as a way to suppress heavy memory pressure and/or the OOM
killer. You do not want to change the semantic for them.
Besides that the changelog is less than optimal. What is the actual
problem? Why somebody doesn't want a fallback? Is there a configuration
that could prevent the same?
> Allocating at a smaller order is a retry operation and should not
> be attempted.
>
> If the caller does not want retries then respect that.
>
> GFP_NORETRY allows callers to ensure that only maximum order
> allocations are attempted.
>
> Signed-off-by: Christoph Lameter <cl at linux.com>
>
> Index: linux/mm/slub.c
> ===================================================================
> --- linux.orig/mm/slub.c
> +++ linux/mm/slub.c
> @@ -1598,7 +1598,7 @@ static struct page *allocate_slab(struct
> alloc_gfp = (alloc_gfp | __GFP_NOMEMALLOC) & ~(__GFP_RECLAIM|__GFP_NOFAIL);
>
> page = alloc_slab_page(s, alloc_gfp, node, oo);
> - if (unlikely(!page)) {
> + if (unlikely(!page) && !(flags & __GFP_NORETRY)) {
> oo = s->min;
> alloc_gfp = flags;
> /*
--
Michal Hocko
SUSE Labs
More information about the dm-devel
mailing list