Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754378AbdHYAup (ORCPT ); Thu, 24 Aug 2017 20:50:45 -0400 Received: from mail-pg0-f54.google.com ([74.125.83.54]:36460 "EHLO mail-pg0-f54.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754469AbdHYAuO (ORCPT ); Thu, 24 Aug 2017 20:50:14 -0400 Date: Fri, 25 Aug 2017 09:50:07 +0900 From: AKASHI Takahiro To: Ard Biesheuvel Cc: Catalin Marinas , Will Deacon , Thiago Jung Bauermann , David Howells , Vivek Goyal , Herbert Xu , "David S. Miller" , Andrew Morton , Michael Ellerman , Dave Young , Baoquan He , Arnd Bergmann , "kexec@lists.infradead.org" , "linux-arm-kernel@lists.infradead.org" , "linux-kernel@vger.kernel.org" , Linus Torvalds Subject: Re: [PATCH 03/14] resource: add walk_system_ram_res_rev() Message-ID: <20170825005006.GB6434@akashi-kouhiroshi-no-MacBook-Air.local> Mail-Followup-To: AKASHI Takahiro , Ard Biesheuvel , Catalin Marinas , Will Deacon , Thiago Jung Bauermann , David Howells , Vivek Goyal , Herbert Xu , "David S. Miller" , Andrew Morton , Michael Ellerman , Dave Young , Baoquan He , Arnd Bergmann , "kexec@lists.infradead.org" , "linux-arm-kernel@lists.infradead.org" , "linux-kernel@vger.kernel.org" , Linus Torvalds References: <20170824081811.19299-1-takahiro.akashi@linaro.org> <20170824081811.19299-4-takahiro.akashi@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.8.3 (2017-05-23) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 872 Lines: 24 On Thu, Aug 24, 2017 at 10:06:28AM +0100, Ard Biesheuvel wrote: > On 24 August 2017 at 09:18, AKASHI Takahiro wrote: > > + /* create a list */ > > + rams = vmalloc(sizeof(struct resource) * count); > > + if (!rams) > > + return ret; > > + > > + res.start = start; > > + res.end = end; > > + res.flags = IORESOURCE_SYSTEM_RAM | IORESOURCE_BUSY; > > + orig_end = res.end; > > + i = 0; > > + while ((res.start < res.end) && > > + (!find_next_iomem_res(&res, IORES_DESC_NONE, true))) { > > + if (i >= count) { > > + /* unlikely but */ > > + vfree(rams); > > + count += 16; > > If the count is likely to be < 16, why are we using vmalloc() here? Ah, you're right :) -Takahiro AKASHI