Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp1706745imu; Thu, 17 Jan 2019 01:49:07 -0800 (PST) X-Google-Smtp-Source: ALg8bN7nOXhmBthulgD7aQqHuVY8czgDUAfiRuupaZi4yXGF5l+SnJisEY4+Zobg/zU6eU0hXT19 X-Received: by 2002:a17:902:4601:: with SMTP id o1mr14251427pld.243.1547718547480; Thu, 17 Jan 2019 01:49:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547718547; cv=none; d=google.com; s=arc-20160816; b=CfqgtShjkVbN2j8Ax6WVWFroXUWiG3iYb0LtESNIglK6BIMTQJtujzfgahhpkutP09 LJPF6jI0G06u1PyojWryFudMxxB9akl31jPnfk1BANycdESr2B6iHxLyGmchkuolFAjU QTc8tt7EqKuef8d3rBmE9KOMz78R/WwpaQiqBoWOoyGWdGJ3ciCrNcuhoDPc+unVBAzM MaKONvyY0ia0SsnLeKU4ZthF+EX/qGtaRYg881nQOD3JALiD3WnDGeyEQ3pfWtL+fL/h LUuT0dRF6RuRgxnj94oZl+RZqz/ESggS+VS8EmMHl9pYi8bYXawS+Rz0zBFMkA34H/Sd abiA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=cS7d3j9oFkJNFmxtCJf4rEoqtVD5eHRQ1NAy6etXuaQ=; b=hgIRko8HBVNwFIR7/bNozPlV0XP1eI34XFXxMTzsmtDI8xdUFxn/WrR2gB7sphaUTe Y5dDEREg58iNeRp3FjNexP6Tqy3nX8Yg8+klfvq96tVGq6FyY3XsArq2uW/W/kLm/AU6 3t0D3AfLKloEdxpFAh58BfHyiefYBKYw6mhVDyRXTmDsRVglhWUmbPjXu/Mtq/qZF08m WwepRcRGmaWtWN5d4M9+2vqjOuDkXS0EWTn1Y1yggSOKU80V3lrrPsOlt5FQKFong4jj XR1Goceo/96lWEghm3IrrWoAk5i637KuOFoWDmFMEu2hwNkYV0uGLR9Rl1VxNDW32cgS 4lvA== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z2si1180140pgs.267.2019.01.17.01.48.52; Thu, 17 Jan 2019 01:49:07 -0800 (PST) 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728598AbfAQJ2t (ORCPT + 99 others); Thu, 17 Jan 2019 04:28:49 -0500 Received: from mx2.suse.de ([195.135.220.15]:51720 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727234AbfAQJ2s (ORCPT ); Thu, 17 Jan 2019 04:28:48 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay1.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 66E4FAC7F; Thu, 17 Jan 2019 09:28:45 +0000 (UTC) Date: Thu, 17 Jan 2019 10:28:42 +0100 From: Petr Mladek To: Mike Rapoport Cc: linux-mm@kvack.org, Andrew Morton , Catalin Marinas , Christoph Hellwig , "David S. Miller" , Dennis Zhou , Geert Uytterhoeven , Greentime Hu , Greg Kroah-Hartman , Guan Xuetao , Guo Ren , Heiko Carstens , Mark Salter , Matt Turner , Max Filippov , Michael Ellerman , Michal Simek , Paul Burton , Rich Felker , Richard Weinberger , Rob Herring , Russell King , Stafford Horne , Tony Luck , Vineet Gupta , Yoshinori Sato , devicetree@vger.kernel.org, kasan-dev@googlegroups.com, linux-alpha@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-c6x-dev@linux-c6x.org, linux-ia64@vger.kernel.org, linux-kernel@vger.kernel.org, linux-m68k@lists.linux-m68k.org, linux-mips@vger.kernel.org, linux-s390@vger.kernel.org, linux-sh@vger.kernel.org, linux-snps-arc@lists.infradead.org, linux-um@lists.infradead.org, linux-usb@vger.kernel.org, linux-xtensa@linux-xtensa.org, linuxppc-dev@lists.ozlabs.org, openrisc@lists.librecores.org, sparclinux@vger.kernel.org, uclinux-h8-devel@lists.sourceforge.jp, x86@kernel.org, xen-devel@lists.xenproject.org Subject: Re: [PATCH 21/21] memblock: drop memblock_alloc_*_nopanic() variants Message-ID: <20190117092842.wnvsc6em5mxga3rn@pathway.suse.cz> References: <1547646261-32535-1-git-send-email-rppt@linux.ibm.com> <1547646261-32535-22-git-send-email-rppt@linux.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1547646261-32535-22-git-send-email-rppt@linux.ibm.com> User-Agent: NeoMutt/20170421 (1.8.2) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed 2019-01-16 15:44:21, Mike Rapoport wrote: > As all the memblock allocation functions return NULL in case of error > rather than panic(), the duplicates with _nopanic suffix can be removed. [...] > diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c > index c4f0a41..ae65221 100644 > --- a/kernel/printk/printk.c > +++ b/kernel/printk/printk.c > @@ -1147,17 +1147,14 @@ void __init setup_log_buf(int early) > if (!new_log_buf_len) > return; > > - if (early) { > - new_log_buf = > - memblock_alloc(new_log_buf_len, LOG_ALIGN); > - } else { > - new_log_buf = memblock_alloc_nopanic(new_log_buf_len, > - LOG_ALIGN); > - } > - > + new_log_buf = memblock_alloc(new_log_buf_len, LOG_ALIGN); The above change is enough. > if (unlikely(!new_log_buf)) { > - pr_err("log_buf_len: %lu bytes not available\n", > - new_log_buf_len); > + if (early) > + panic("log_buf_len: %lu bytes not available\n", > + new_log_buf_len); panic() is not needed here. printk() will just continue using the (smaller) static buffer. > + else > + pr_err("log_buf_len: %lu bytes not available\n", > + new_log_buf_len); > return; > } Best Regards, Petr