Received: by 10.192.165.156 with SMTP id m28csp1336293imm; Wed, 18 Apr 2018 08:07:11 -0700 (PDT) X-Google-Smtp-Source: AIpwx4+nxt1p7mLIxpqwvWnPjQxn0o+jJNOROvUEXKYEcK29TET0EbLuhNSLZCK9L/r4LKft0U82 X-Received: by 2002:a17:902:362:: with SMTP id 89-v6mr2486219pld.270.1524064031056; Wed, 18 Apr 2018 08:07:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524064031; cv=none; d=google.com; s=arc-20160816; b=a75N1Lg/VFcusbVVpyxpCzGXdo+XcugbmOgUJCgm0e1+owG166y/yMViH8rt0GwbD5 MRB8+IOirvikB71Nrpx3bTTlYL4w5lHOwsKelPkoMBxbv+iCWMWvLOUq5WBrMP6wKpl0 LgjtYYtzIu8k2BMCiEgt4Ak/Yz1PkJO8hj0D2EevSbZ4A0hQDaG3SQD12UAhz/D19CWm LtPfRAd2qM/MRRXMEzddPJL491SeF4m0t/ZPCC1PKyU7es0QIoaS+c9ba/rpOhoV8jIm iO8VvaQQR/u1T8NfM8LMknCNxV86TzsVg11p3g6oUS6CQlO3vH7xmikK/5RHNrrBbBvF TwWQ== 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 :arc-authentication-results; bh=5YGk7Mtferc0Jt5VtD4zYr9gZ9vagT4P1TXuptKeVrg=; b=m9tYRfoW0pbsPHXwK+s3GWNYbX8IqKfyc9CWxoV7EzClEA7Qk5IuURpDxJtC+y0urH embCChL28raGPq6mQC9jPig3nf/Mw844jkeaBRa4s260i5r/awklk5DKCRhQvAG4ly/9 3q7DAHqGRG7+WfY/zgWpoAa3LbEIJgTntZpCZyDj2LrGc+VgdSaOkrtnrZBmt8AdUbU1 WK9VXvmX6hvGvXOexuabybJ0oKty9Rx3RUUcQziAdyfrJJMJc0QmUgEVwT/n0SP3sLZC NlPnJNQq5fW5yDYwTd/w24djnWwoHhuQubnI2HnvT8JDr+6okUiNBoC7TNqnAGiZ21K/ IlYg== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x6si1160775pgv.430.2018.04.18.08.06.55; Wed, 18 Apr 2018 08:07:11 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753008AbeDRPFj (ORCPT + 99 others); Wed, 18 Apr 2018 11:05:39 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:47116 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752871AbeDRPFh (ORCPT ); Wed, 18 Apr 2018 11:05:37 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 4FBF7818B11C; Wed, 18 Apr 2018 15:05:37 +0000 (UTC) Received: from file01.intranet.prod.int.rdu2.redhat.com (file01.intranet.prod.int.rdu2.redhat.com [10.11.5.7]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 333C51134CCD; Wed, 18 Apr 2018 15:05:33 +0000 (UTC) Received: from file01.intranet.prod.int.rdu2.redhat.com (localhost [127.0.0.1]) by file01.intranet.prod.int.rdu2.redhat.com (8.14.4/8.14.4) with ESMTP id w3IF5XuM018193; Wed, 18 Apr 2018 11:05:33 -0400 Received: from localhost (mpatocka@localhost) by file01.intranet.prod.int.rdu2.redhat.com (8.14.4/8.14.4/Submit) with ESMTP id w3IF5V7j018185; Wed, 18 Apr 2018 11:05:31 -0400 X-Authentication-Warning: file01.intranet.prod.int.rdu2.redhat.com: mpatocka owned process doing -bs Date: Wed, 18 Apr 2018 11:05:31 -0400 (EDT) From: Mikulas Patocka X-X-Sender: mpatocka@file01.intranet.prod.int.rdu2.redhat.com To: Christopher Lameter cc: Vlastimil Babka , Mike Snitzer , Matthew Wilcox , Pekka Enberg , linux-mm@kvack.org, dm-devel@redhat.com, David Rientjes , 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.02 (LRH 1266 2009-07-14) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.8]); Wed, 18 Apr 2018 15:05:37 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.8]); Wed, 18 Apr 2018 15:05:37 +0000 (UTC) for IP:'10.11.54.3' DOMAIN:'int-mx03.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'mpatocka@redhat.com' RCPT:'' Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 18 Apr 2018, Christopher 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. > > > > 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; /*