From patchwork Mon Mar 2 20:33:04 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michal Hocko X-Patchwork-Id: 445423 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 94C2F140140 for ; Tue, 3 Mar 2015 07:33:26 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=fail reason="verification failed; unprotected key" header.d=gmail.com header.i=@gmail.com header.b=uB8RU6+U; dkim-adsp=none (unprotected policy); dkim-atps=neutral Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754508AbbCBUdK (ORCPT ); Mon, 2 Mar 2015 15:33:10 -0500 Received: from mail-wg0-f54.google.com ([74.125.82.54]:34752 "EHLO mail-wg0-f54.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753836AbbCBUdI (ORCPT ); Mon, 2 Mar 2015 15:33:08 -0500 Received: by wghn12 with SMTP id n12so35975412wgh.1; Mon, 02 Mar 2015 12:33:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:in-reply-to:user-agent; bh=B3BSmjibuEh1LEOfDrxOgr1H5KTFqSMGN2cbMgQGIQ8=; b=uB8RU6+UQkMuqMRWm+D/dMPdJeXTCeWVCIpb3REHNdUcQqIEoq9SAue7ukMI3ltxdV mSq4KObUzcRZOgBBSLuRVifCOfY9OZJ8qcndI1mBon0LVEov+s/h/OVAELG5eybnJhTD OtU9IEtpy8xZmCzD0pGPc3gwDZ2KsBbiMArlyG1npzR5P/O5yyPvl1PelHOH8LFEKBhr i7Q2kb1YhRNrq4uEjHTMnrF65U26j293su+Pi4IN1PoSVmncPknOoCIjekquZ8Ajw1VD 7mecI50FE5EF1LFGivlFtdwF+W5GegQDCZ6StSAc7m4py1ypOj2SV2hqS0wlzY9XLStC qZfQ== X-Received: by 10.180.10.131 with SMTP id i3mr39969114wib.54.1425328386829; Mon, 02 Mar 2015 12:33:06 -0800 (PST) Received: from localhost (ip-78-45-94-81.net.upcbroadband.cz. [78.45.94.81]) by mx.google.com with ESMTPSA id vq9sm20775304wjc.6.2015.03.02.12.33.05 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 02 Mar 2015 12:33:05 -0800 (PST) Date: Mon, 2 Mar 2015 21:33:04 +0100 From: Michal Hocko To: David Miller Cc: linux-mm@kvack.org, akpm@linux-foundation.org, hannes@cmpxchg.org, rientjes@google.com, david@fromorbit.com, tytso@mit.edu, mgorman@suse.de, penguin-kernel@I-love.SAKURA.ne.jp, sparclinux@vger.kernel.org, vipul@chelsio.com, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [RFC 3/4] sparc: remove __GFP_NOFAIL reuquirement Message-ID: <20150302203304.GA20513@dhcp22.suse.cz> References: <1425304483-7987-1-git-send-email-mhocko@suse.cz> <1425304483-7987-4-git-send-email-mhocko@suse.cz> <20150302.150405.2072800922470200977.davem@davemloft.net> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20150302.150405.2072800922470200977.davem@davemloft.net> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org On Mon 02-03-15 15:04:05, David S. Miller wrote: > From: Michal Hocko > Date: Mon, 2 Mar 2015 14:54:42 +0100 > > > mdesc_kmalloc is currently requiring __GFP_NOFAIL allocation although it > > seems that the allocation failure is handled by all callers (via > > mdesc_alloc). __GFP_NOFAIL is a strong liability for the memory > > allocator and so the users are discouraged to use the flag unless the > > allocation failure is really a nogo. Drop the flag here as this doesn't > > seem to be the case. > > > > Signed-off-by: Michal Hocko > > It is a serious failure. > > If we miss an MDESC update due to this allocation failure, the update > is not an event which gets retransmitted so we will lose the updated > machine description forever. > > We really need this allocation to succeed. OK, thanks for the clarification. This wasn't clear from the commit which has introduced this code. I will drop this patch. Would you accept something like the following instead? diff --git a/arch/sparc/kernel/mdesc.c b/arch/sparc/kernel/mdesc.c index 99632a87e697..26c80e18d7b1 100644 --- a/arch/sparc/kernel/mdesc.c +++ b/arch/sparc/kernel/mdesc.c @@ -130,26 +130,26 @@ static struct mdesc_mem_ops memblock_mdesc_ops = { static struct mdesc_handle *mdesc_kmalloc(unsigned int mdesc_size) { unsigned int handle_size; + struct mdesc_handle *hp; + unsigned long addr; void *base; handle_size = (sizeof(struct mdesc_handle) - sizeof(struct mdesc_hdr) + mdesc_size); + /* + * Allocation has to succeed because mdesc update would be missed + * and such events are not retransmitted. + */ base = kmalloc(handle_size + 15, GFP_KERNEL | __GFP_NOFAIL); - if (base) { - struct mdesc_handle *hp; - unsigned long addr; - - addr = (unsigned long)base; - addr = (addr + 15UL) & ~15UL; - hp = (struct mdesc_handle *) addr; + addr = (unsigned long)base; + addr = (addr + 15UL) & ~15UL; + hp = (struct mdesc_handle *) addr; - mdesc_handle_init(hp, handle_size, base); - return hp; - } + mdesc_handle_init(hp, handle_size, base); - return NULL; + return hp; } static void mdesc_kfree(struct mdesc_handle *hp)