Received: by 2002:a05:6a10:6744:0:0:0:0 with SMTP id w4csp4693267pxu; Tue, 13 Oct 2020 05:06:40 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyrMqNnsTAE+Grudit9CX8YHlTd8w19YmDJ6nt/d7x2buBDR1DimKotEsogsuewyxT2ooJv X-Received: by 2002:a17:906:f112:: with SMTP id gv18mr32098591ejb.180.1602590799860; Tue, 13 Oct 2020 05:06:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1602590799; cv=none; d=google.com; s=arc-20160816; b=XRtiAY/d9CHLjE7XYuJKzsg+A9BeRg9AHJctrh9BDXA5liZrgAu9CZtF6hohkswJmC uILOxcBgNaN49DdTWwxopvz+MjaEdnP3I0AijAGFhjDUOyzM4sVoKErpKOYFzEAfaVnl L86oWBuG/tV9UliCJ4Jz7DZdBE0RnMH5vajcYlCZcaaCsIHE+4lPqrNDB55JqJEJftaN Ul4EmnHpCqrccbRkJnJ6Zcgt0v/ophu4a/rLvA3Nd/ezHCfzuX51M6a8Y/SECrgVLJiy qDNpSDgPU/ceStALBh117Y0gSmZns+oa2x41M/nMOj6lucA7LrhoJxrMdBO02Hq1FInu EIhw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject; bh=suo/272YM7aGxqQMgXNXdHdFVw6K47m2AIAkNIFZsDU=; b=XJgtskBKdtYDDidta+EVHETRkmxjy6CGh0UECfpxHgKwxfChc686nvifVuyG1Whk+k vroic3xaOqSyVkgywqpxJzTygCyuFSYLKFtRIdAesw/CU2ZGeBd3Xvkd+SYtfTtqwYyu rM/JxgoxRM3eBO/8RMOeBdle3dymdNnCY1aPbrcd6ZiE0np9CvERlgUn0RA8UfZMwECY Hgp2Pvu6PHeTGrq4FmLyWD21jTm2uD22fCXwfTkH89BdushesEVxT+eAuoCiZ5Fmp4wt spO5B1QY2mSuXcv4sC1Hiwr8WVNOheEdRfivTeb7YMXO3FpHsDAuP2sQfgFHYvYkc83m HJAw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id ck9si14094464ejb.445.2020.10.13.05.06.14; Tue, 13 Oct 2020 05:06:39 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727081AbgJMLjj (ORCPT + 99 others); Tue, 13 Oct 2020 07:39:39 -0400 Received: from foss.arm.com ([217.140.110.172]:57236 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726983AbgJMLjj (ORCPT ); Tue, 13 Oct 2020 07:39:39 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id B34DF1FB; Tue, 13 Oct 2020 04:39:38 -0700 (PDT) Received: from [10.163.75.237] (unknown [10.163.75.237]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id A619F3F719; Tue, 13 Oct 2020 04:39:35 -0700 (PDT) Subject: Re: [PATCH v3] arm64/mm: add fallback option to allocate virtually contiguous memory To: Sudarshan Rajagopalan , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Cc: Gavin Shan , Catalin Marinas , Will Deacon , Mark Rutland , Logan Gunthorpe , David Hildenbrand , Andrew Morton , Steven Price References: <339118202d0a4741ec22f215830dc8d9ba1ccd49.1602542734.git.sudaraja@codeaurora.org> From: Anshuman Khandual Message-ID: Date: Tue, 13 Oct 2020 17:08:59 +0530 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: <339118202d0a4741ec22f215830dc8d9ba1ccd49.1602542734.git.sudaraja@codeaurora.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 10/13/2020 04:35 AM, Sudarshan Rajagopalan wrote: > When section mappings are enabled, we allocate vmemmap pages from physically > continuous memory of size PMD_SIZE using vmemmap_alloc_block_buf(). Section > mappings are good to reduce TLB pressure. But when system is highly fragmented > and memory blocks are being hot-added at runtime, its possible that such > physically continuous memory allocations can fail. Rather than failing the > memory hot-add procedure, add a fallback option to allocate vmemmap pages from > discontinuous pages using vmemmap_populate_basepages(). There is a checkpatch warning here, which could be fixed while merging ? WARNING: Possible unwrapped commit description (prefer a maximum 75 chars per line) #7: When section mappings are enabled, we allocate vmemmap pages from physically total: 0 errors, 1 warnings, 13 lines checked > > Signed-off-by: Sudarshan Rajagopalan > Reviewed-by: Gavin Shan > Cc: Catalin Marinas > Cc: Will Deacon > Cc: Anshuman Khandual > Cc: Mark Rutland > Cc: Logan Gunthorpe > Cc: David Hildenbrand > Cc: Andrew Morton > Cc: Steven Price Nonetheless, this looks fine. Did not see any particular problem while creating an experimental vmemmap with interleaving section and base page mapping. Reviewed-by: Anshuman Khandual > --- > arch/arm64/mm/mmu.c | 7 +++++-- > 1 file changed, 5 insertions(+), 2 deletions(-) > > diff --git a/arch/arm64/mm/mmu.c b/arch/arm64/mm/mmu.c > index 75df62fea1b6..44486fd0e883 100644 > --- a/arch/arm64/mm/mmu.c > +++ b/arch/arm64/mm/mmu.c > @@ -1121,8 +1121,11 @@ int __meminit vmemmap_populate(unsigned long start, unsigned long end, int node, > void *p = NULL; > > p = vmemmap_alloc_block_buf(PMD_SIZE, node, altmap); > - if (!p) > - return -ENOMEM; > + if (!p) { > + if (vmemmap_populate_basepages(addr, next, node, altmap)) > + return -ENOMEM; > + continue; > + } > > pmd_set_huge(pmdp, __pa(p), __pgprot(PROT_SECT_NORMAL)); > } else >