From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932982AbcBYNsz (ORCPT ); Thu, 25 Feb 2016 08:48:55 -0500 Received: from mail-wm0-f54.google.com ([74.125.82.54]:36768 "EHLO mail-wm0-f54.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1760239AbcBYNsx (ORCPT ); Thu, 25 Feb 2016 08:48:53 -0500 Date: Thu, 25 Feb 2016 14:48:51 +0100 From: Michal Hocko To: Nikolay Borisov Cc: Andrew Morton , David Rientjes , linux-mm@kvack.org, LKML Subject: Re: [PATCH] mm: remove __GFP_NOFAIL is deprecated comment Message-ID: <20160225134850.GA4204@dhcp22.suse.cz> References: <1456397002-27172-1-git-send-email-mhocko@kernel.org> <56CEE72B.5040009@kyup.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <56CEE72B.5040009@kyup.com> User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu 25-02-16 13:36:11, Nikolay Borisov wrote: [...] > > + /* > > + * We most definitely don't want callers attempting to > > + * allocate greater than order-1 page units with __GFP_NOFAIL. > > + */ > > + WARN_ON_ONCE(unlikely(gfp_flags & __GFP_NOFAIL) && (order > 1)); > > WARN_ON_ONCE already includes an unlikely in its definition: > http://lxr.free-electrons.com/source/include/asm-generic/bug.h#L109 OK, I just wanted to keep the condition untouched but you are right the unlikely can be removed. > Reviewed-by: Nikolay Borisov Thanks! --- >>From 6ddc73c6d659224e996d1060974f5a14a1c5bf7d Mon Sep 17 00:00:00 2001 From: Michal Hocko Date: Thu, 25 Feb 2016 11:29:12 +0100 Subject: [PATCH] mm: remove __GFP_NOFAIL is deprecated comment 647757197cd3 ("mm: clarify __GFP_NOFAIL deprecation status") was incomplete and didn't remove the comment about __GFP_NOFAIL being deprecated in buffered_rmqueue. Let's get rid of this leftover but keep the WARN_ON_ONCE for order > 1 because we should really discourage from using __GFP_NOFAIL with higher order allocations because those are just too subtle. Signed-off-by: Michal Hocko Reviewed-by: Nikolay Borisov --- mm/page_alloc.c | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/mm/page_alloc.c b/mm/page_alloc.c index 1993894b4219..b5b7a7b0cad0 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -2347,19 +2347,11 @@ struct page *buffered_rmqueue(struct zone *preferred_zone, list_del(&page->lru); pcp->count--; } else { - if (unlikely(gfp_flags & __GFP_NOFAIL)) { - /* - * __GFP_NOFAIL is not to be used in new code. - * - * All __GFP_NOFAIL callers should be fixed so that they - * properly detect and handle allocation failures. - * - * We most definitely don't want callers attempting to - * allocate greater than order-1 page units with - * __GFP_NOFAIL. - */ - WARN_ON_ONCE(order > 1); - } + /* + * We most definitely don't want callers attempting to + * allocate greater than order-1 page units with __GFP_NOFAIL. + */ + WARN_ON_ONCE((gfp_flags & __GFP_NOFAIL) && (order > 1)); spin_lock_irqsave(&zone->lock, flags); page = NULL; -- 2.7.0 -- Michal Hocko SUSE Labs