Received: by 10.192.165.156 with SMTP id m28csp1572247imm; Wed, 18 Apr 2018 11:51:58 -0700 (PDT) X-Google-Smtp-Source: AIpwx4/xkQ/FPq3qdp6daCKUV3hZDOwBTovaNWcXqRz1peatCQYPFeu7gsGFpC8GX/nKB32G0aNO X-Received: by 10.101.96.198 with SMTP id r6mr2610267pgv.446.1524077518269; Wed, 18 Apr 2018 11:51:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524077518; cv=none; d=google.com; s=arc-20160816; b=JDlLwddgWA5Hw5tnEqyqYu7wYwEVKB9VvSlEqrPUTRWxNS+VdOwtyk+SjOuSbpakLn uuutalWQZ2f0pJWQ5BS6uhlrD+2b0zuo1x00NpndWBtk4EzHtrBs/tK88QN/Xqm60oJh qliOH99oY37B2D7G1tI854idJQ4tAX3SInfiGIMdS3Ew4YI0ukL50kclFa2OpWfdB+sg eSerOzVGB9CT/sZY7e4bJ/ZScuxdAjZ8bomrbGNhh0w0mjBVsbWONszL1mlcJ53XeRkR CbTFVb1fvq3Ey4LEpqs/Hu0t2/AxFEoLcsQXwaJyQBZFtHN0M5iQhKD3ElpLfFhbS+zn Ia/A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :message-id:in-reply-to:subject:cc:to:from:date:dkim-signature :arc-authentication-results; bh=X6fspnxoYhmF0vATi0ya25BFwtIO3XyoHcWRklD8dqs=; b=ry53DUiWWtSI92YVnY7964QLx/f3M9q94wCDbHeklrFOWdHvpWbecgR2yAr6kRuo12 6YKYRwvPmtbdkDNAaG+SDDDUjaLjVB15NRfXLpFIOZ8Nwi94/8+2SV2VXmR4Y67g+jxj Q7++d7mJgvABC+6GjZpHI8qmI0/GX7XVHFLSZHtxI0PypDMW6wZFLMHPctAb0c60THDU 57cdo6IUwSidEIqtrmBN9Nqqw2rWazO7umHPP/v+7m/tcDibRiXUxoFkUqtDpxFsnR9p wHrUtdDWb6qoIr8Zh/8oAteNIVD6c3cn3H/Cx2WvrpplhsNnWqTz0Prgc//XYY2zKh3S L1ew== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=FexytxRj; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p2-v6si1711827plo.520.2018.04.18.11.51.44; Wed, 18 Apr 2018 11:51:58 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=FexytxRj; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752703AbeDRStZ (ORCPT + 99 others); Wed, 18 Apr 2018 14:49:25 -0400 Received: from mail-pf0-f194.google.com ([209.85.192.194]:45928 "EHLO mail-pf0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751866AbeDRStY (ORCPT ); Wed, 18 Apr 2018 14:49:24 -0400 Received: by mail-pf0-f194.google.com with SMTP id l27so1339868pfk.12 for ; Wed, 18 Apr 2018 11:49:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:from:to:cc:subject:in-reply-to:message-id:references :user-agent:mime-version; bh=X6fspnxoYhmF0vATi0ya25BFwtIO3XyoHcWRklD8dqs=; b=FexytxRjG3iDtFcuTCJiJEzgbmHeSl3n1JKK8s2TJLe2Tsz8tmh5ND/FJR/ZX6zhwn LD4U5NmajTKzLmwAjAhnqR860UaTMysOxEi2c8kx/e4nL8t8ZD5WyYtknCtfWd/ZmZ0d VnN3goWKoj+K5DezfsJ2BbUBLMMkHuwMdXICCbYZRG3TKqWXvXXTSapnQ4LLn6Jsk8FY e+WkH467J8ggeaW5WcdrXrsgioQeweLu6oSrjZkE4XUSE8KrUooX3aruoueElE8YNG0s UHEAIwjMOr5CcRsrSuEBbuACg2sjeu/BnCcV3lR6blKRG8z3MBLXKO8k3yOVfEXO9x6Y 2pEg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:in-reply-to:message-id :references:user-agent:mime-version; bh=X6fspnxoYhmF0vATi0ya25BFwtIO3XyoHcWRklD8dqs=; b=jvcTcQWcSCff/ksbU8rMeOMny/9cw+ez6GPQlrC+OUWtGj4hLnOVkL/YUwqzyYXwup gJwYIKmH8dZ1SDP+hSR3VXyFK5Llg+fGRLvZpFP9uN1GaPWjIQsNDbM8/pokTOhgx8WP l3+L6PDuJ5gS80iKA0MdD97GjVKoRqculC/rcKVCfbWxyHHOHgkROKvI+tEMDslS9jq3 7yGTpdGUoaisgWIi1qNQ5pQya1wgrrhfBSan+xJb5BgfuLKQiWzWhrsz2/Xp72UoJvPC McnpWDtHtbPCCBVsU378fDQyh1AlxVtF4dQFa9oLMbQ9ZBfzs2PCm1Mu8n3FHHl7rB1G ecPQ== X-Gm-Message-State: ALQs6tBIyOb5YmJfBJtYBE42B823iguK+YXJCeLUVrXizRCuMOeT9aeL pXT4fEjVz/UJVMmIzHcPNl0Ugw== X-Received: by 10.99.55.1 with SMTP id e1mr2590734pga.237.1524077363597; Wed, 18 Apr 2018 11:49:23 -0700 (PDT) Received: from [2620:15c:17:3:3a5:23a7:5e32:4598] ([2620:15c:17:3:3a5:23a7:5e32:4598]) by smtp.gmail.com with ESMTPSA id c186sm3598919pfb.40.2018.04.18.11.49.22 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 18 Apr 2018 11:49:22 -0700 (PDT) Date: Wed, 18 Apr 2018 11:49:22 -0700 (PDT) From: David Rientjes X-X-Sender: rientjes@chino.kir.corp.google.com To: Mikulas Patocka cc: Christopher Lameter , Vlastimil Babka , Mike Snitzer , Matthew Wilcox , Pekka Enberg , linux-mm@kvack.org, dm-devel@redhat.com, Joonsoo Kim , Andrew Morton , linux-kernel@vger.kernel.org Subject: Re: [PATCH] SLUB: Do not fallback to mininum order if __GFP_NORETRY is set In-Reply-To: Message-ID: References: User-Agent: Alpine 2.21 (DEB 202 2017-01-01) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 18 Apr 2018, Mikulas Patocka 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. > > > > > > > > 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 > > > > 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; > > /* > > No, this would hit NULL pointer dereference if page is NULL and > __GFP_NORETRY is set. You want this: > > --- > mm/slub.c | 2 ++ > 1 file changed, 2 insertions(+) > > Index: linux-2.6/mm/slub.c > =================================================================== > --- linux-2.6.orig/mm/slub.c 2018-04-17 20:58:23.000000000 +0200 > +++ linux-2.6/mm/slub.c 2018-04-18 17:04:01.000000000 +0200 > @@ -1599,6 +1599,8 @@ static struct page *allocate_slab(struct > > page = alloc_slab_page(s, alloc_gfp, node, oo); > if (unlikely(!page)) { > + if (flags & __GFP_NORETRY) > + goto out; > oo = s->min; > alloc_gfp = flags; > /* > I don't see the connection between the max order, which can be influenced by userspace with slub_min_objects, slub_min_order, etc, and specifying __GFP_NORETRY which means try to reclaim and free memory but don't loop. If I force a slab cache to try a max order of 9 for hugepages as a best effort, why does __GFP_NORETRY suddenly mean I won't fallback to oo_order(s->min)?