Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp2274346pxu; Mon, 7 Dec 2020 02:08:16 -0800 (PST) X-Google-Smtp-Source: ABdhPJzW0AGaGuzIfiGSm4Wip/ZVRXgPtGovGCH9F6KrbMVGjk1dKd08EWvsvIRd88Fofbj1VYuw X-Received: by 2002:a17:906:31cb:: with SMTP id f11mr18440509ejf.142.1607335695793; Mon, 07 Dec 2020 02:08:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1607335695; cv=none; d=google.com; s=arc-20160816; b=PsQjg0rZpPGwWLWIFdRs/ebwIXHyKcYMmtV/CPy024txFeVGyyi0sxCljXmZ9mOnqF nz0dfLVmgSzoWqpNk7Eq3xps4ey1hqV1w/+lKDC42yLXUdL5ptIhNsJQlpo3/KStYYAJ NtbdkxFsvIB2a78S/O+R2PF2KGf0jUPcnWvclMAurVM1zSR0txkk+OLT7NKCw3wh+ME0 UUysSJWwQ/2ynx1zkkFp++iipkaxJR9chf3FF59cvDM3yI4D8iJpPZBV2bYaCUv+47DK /GInf793YNRAYVQjJnIhcvMBsUJvFZHEz9DnEWPnz3sRFHxCwN7cuwNQcRPXkziTRnya GHHQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=QiPMOQuCk2zUPq//oBZGAxumwdDBB5FUYlyVGE+xieI=; b=pgL09aTfa7b4Rb2UzcBFvuxsRnAzCw3bfHDzqc+vDhqYbVoVZaKR++IJ2+fx5tXYob FZ+eofvpCKpEK8qIMW5Wh4rDC/eGeHQRR96uqTKsdZXNriGiOURzQ9YFKXzbG4aJ7rWq 9fs2xMyTzNkx+cetHFDQebqIOuM98Yw0QpZ/gSfZ28+RupZV0s7RoHJGfWM8YCYUH+Kc 16MqTUPhl4kq5dsyFR1Rd7px7j1DvrNSHw3VE1O6XGFCPkrlDu4AZ7/KSDP1ybdM2pAJ NlAK/YPa+EVAMiHSv6bAnUD9Znwbp/sIRZfvYjrip1nGNYxdVnHjYUbnRGM6fythoXgV f7ZQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=RTIeNpFt; 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=pass (p=NONE sp=NONE dis=NONE) header.from=ibm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id u26si6101281ejx.267.2020.12.07.02.07.52; Mon, 07 Dec 2020 02:08:15 -0800 (PST) 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; dkim=pass header.i=@ibm.com header.s=pp1 header.b=RTIeNpFt; 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=pass (p=NONE sp=NONE dis=NONE) header.from=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726572AbgLGKGQ (ORCPT + 99 others); Mon, 7 Dec 2020 05:06:16 -0500 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:10178 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726023AbgLGKGL (ORCPT ); Mon, 7 Dec 2020 05:06:11 -0500 Received: from pps.filterd (m0098394.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 0B7A4kkQ129799; Mon, 7 Dec 2020 05:05:09 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=date : from : to : cc : subject : message-id : references : mime-version : content-type : in-reply-to; s=pp1; bh=QiPMOQuCk2zUPq//oBZGAxumwdDBB5FUYlyVGE+xieI=; b=RTIeNpFtqxNW7BWGoGzBG9medrSpAD9BVbsnzuOy2NNVsf8mZ56ZNM7pCoF6KsRAqCgO Xc8EKih3r+d/Dw9fD++CE70zuAbfeTG0dksT+rfWilKppeQMNOQYq/UxeWHoChsvelYU Ii1B38zMgUq808he/89HYMSc9L1MK+tmbCJvBEGh9nxqvqcr3E0XEH3RAlYbXIrW/gHZ AoTsDlc88IHXtIr+ws/z/OTfjjexz4J/N+p0TQx2MKkurc6YRtaBWakGQ7QSwMgho5Ux as0dP3SmuNaAfYyyWiIyxQp3KaGZCicDNYz0Rn5yh/4YlVERa3Emg5rwQtzUAL+D54gv 2A== Received: from ppma06ams.nl.ibm.com (66.31.33a9.ip4.static.sl-reverse.com [169.51.49.102]) by mx0a-001b2d01.pphosted.com with ESMTP id 359h7t25bg-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 07 Dec 2020 05:05:08 -0500 Received: from pps.filterd (ppma06ams.nl.ibm.com [127.0.0.1]) by ppma06ams.nl.ibm.com (8.16.0.42/8.16.0.42) with SMTP id 0B7A2Pku008581; Mon, 7 Dec 2020 10:04:32 GMT Received: from b06cxnps3074.portsmouth.uk.ibm.com (d06relay09.portsmouth.uk.ibm.com [9.149.109.194]) by ppma06ams.nl.ibm.com with ESMTP id 3581fhjc11-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 07 Dec 2020 10:04:32 +0000 Received: from d06av26.portsmouth.uk.ibm.com (d06av26.portsmouth.uk.ibm.com [9.149.105.62]) by b06cxnps3074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 0B7A4Uxw24576444 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 7 Dec 2020 10:04:30 GMT Received: from d06av26.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 21308AE055; Mon, 7 Dec 2020 10:04:30 +0000 (GMT) Received: from d06av26.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id A7BAFAE053; Mon, 7 Dec 2020 10:04:28 +0000 (GMT) Received: from linux.ibm.com (unknown [9.145.50.18]) by d06av26.portsmouth.uk.ibm.com (Postfix) with ESMTPS; Mon, 7 Dec 2020 10:04:28 +0000 (GMT) Date: Mon, 7 Dec 2020 12:04:26 +0200 From: Mike Rapoport To: Ard Biesheuvel Cc: Marc Zyngier , Will Deacon , Wei Li , Barry Song , Steve Capper , Catalin Marinas , Linux Kernel Mailing List , fengbaopeng2@hisilicon.com, butao@hisilicon.com, Nicolas Saenz Julienne , Linux ARM Subject: Re: [PATCH] arm64: mm: decrease the section size to reduce the memory reserved for the page map Message-ID: <20201207100426.GE1112728@linux.ibm.com> References: <20201204014443.43329-1-liwei213@huawei.com> <20201204111347.GA844@willie-the-truck> <390f5f441d99a832f4b2425b46f6d971@kernel.org> <20201207094215.GC1112728@linux.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-TM-AS-GCONF: 00 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.312,18.0.737 definitions=2020-12-07_08:2020-12-04,2020-12-07 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 bulkscore=0 mlxscore=0 malwarescore=0 adultscore=0 lowpriorityscore=0 suspectscore=5 mlxlogscore=999 phishscore=0 clxscore=1015 spamscore=0 priorityscore=1501 impostorscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2012070063 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Dec 07, 2020 at 10:49:26AM +0100, Ard Biesheuvel wrote: > On Mon, 7 Dec 2020 at 10:42, Mike Rapoport wrote: > > > > On Mon, Dec 07, 2020 at 09:35:06AM +0000, Marc Zyngier wrote: > > > On 2020-12-07 09:09, Ard Biesheuvel wrote: > > > > (+ Marc) > > > > > > > > On Fri, 4 Dec 2020 at 12:14, Will Deacon wrote: > > > > > > > > > > On Fri, Dec 04, 2020 at 09:44:43AM +0800, Wei Li wrote: > > > > > > For the memory hole, sparse memory model that define SPARSEMEM_VMEMMAP > > > > > > do not free the reserved memory for the page map, decrease the section > > > > > > size can reduce the waste of reserved memory. > > > > > > > > > > > > Signed-off-by: Wei Li > > > > > > Signed-off-by: Baopeng Feng > > > > > > Signed-off-by: Xia Qing > > > > > > --- > > > > > > arch/arm64/include/asm/sparsemem.h | 2 +- > > > > > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > > > > > > > > > diff --git a/arch/arm64/include/asm/sparsemem.h b/arch/arm64/include/asm/sparsemem.h > > > > > > index 1f43fcc79738..8963bd3def28 100644 > > > > > > --- a/arch/arm64/include/asm/sparsemem.h > > > > > > +++ b/arch/arm64/include/asm/sparsemem.h > > > > > > @@ -7,7 +7,7 @@ > > > > > > > > > > > > #ifdef CONFIG_SPARSEMEM > > > > > > #define MAX_PHYSMEM_BITS CONFIG_ARM64_PA_BITS > > > > > > -#define SECTION_SIZE_BITS 30 > > > > > > +#define SECTION_SIZE_BITS 27 > > > > > > > > > > We chose '30' to avoid running out of bits in the page flags. What > > > > > changed? > > > > > > > > > > With this patch, I can trigger: > > > > > > > > > > ./include/linux/mmzone.h:1170:2: error: Allocator MAX_ORDER exceeds > > > > > SECTION_SIZE > > > > > #error Allocator MAX_ORDER exceeds SECTION_SIZE > > > > > > > > > > if I bump up NR_CPUS and NODES_SHIFT. > > > > > > > > > > > > > Does this mean we will run into problems with the GICv3 ITS LPI tables > > > > again if we are forced to reduce MAX_ORDER to fit inside > > > > SECTION_SIZE_BITS? > > > > > > Most probably. We are already massively constraint on platforms > > > such as TX1, and dividing the max allocatable range by 8 isn't > > > going to make it work any better... > > > > I don't think MAX_ORDER should shrink. Even if SECTION_SIZE_BITS is > > reduced it should accomodate the existing MAX_ORDER. > > > > My two pennies. > > > > But include/linux/mmzone.h:1170 has this: > > #if (MAX_ORDER - 1 + PAGE_SHIFT) > SECTION_SIZE_BITS > #error Allocator MAX_ORDER exceeds SECTION_SIZE > #endif > > and Will managed to trigger it after applying this patch. Right, because with 64K pages section size of 27 bits is not enough to accomodate MAX_ORDER (2^13 pages of 64K). Which means that definition of SECTION_SIZE_BITS should take MAX_ORDER into account either statically with #ifdef ARM64_4K_PAGES #define SECTION_SIZE_BITS #elif ARM64_16K_PAGES #define SECTION_SIZE_BITS #elif ARM64_64K_PAGES #define SECTION_SIZE_BITS #else #error "and what is the page size?" #endif or dynamically, like e.g. ia64 does: #ifdef CONFIG_FORCE_MAX_ZONEORDER #if ((CONFIG_FORCE_MAX_ZONEORDER - 1 + PAGE_SHIFT) > SECTION_SIZE_BITS) #undef SECTION_SIZE_BITS #define SECTION_SIZE_BITS (CONFIG_FORCE_MAX_ZONEORDER - 1 + PAGE_SHIFT) #endif -- Sincerely yours, Mike.