From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 00EE9C55ABD for ; Mon, 16 Nov 2020 08:34:52 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 2B94A207BC for ; Mon, 16 Nov 2020 08:34:51 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="wG9D9F/z" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 2B94A207BC Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=hisilicon.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:In-Reply-To:References:Message-ID:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=YfaasJjKOX5uIR4aya6CJ8sBggSKP2Udh4kz3BdgqV0=; b=wG9D9F/zRqvozzDSCGA8DFOgn u3v6joe4/VuZlyYTYovH+CXnC+gig4aMi7Y8+zOzT57Y0t+lLCoh8znxWeiEebL+sM0ha4CLs2YiU PmWhoyjdryoJ7tNxIOxV4XvlUt7Dh/5iv2PshNu9fxy/jjPwrDFgsKCIffGq2Nom8e/rwFDfgJyRN k2/8J9Ysw1e4TmSMioOccL7117FCdOKXhzfqTN25/MvhwL8hHJsovjd9kRUAD008k3Uztqxx776A5 P1A2KcKfaV6EEzV1m8L6pwftaCqmOacG7LXRyq8icJrv1jMRq59mUfXI89rc3ntXQS8yDGmtupPPx DRjuDN7PA==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1keZxm-0000bB-Rw; Mon, 16 Nov 2020 08:34:15 +0000 Received: from szxga03-in.huawei.com ([45.249.212.189]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1keZxi-0000P9-LR for linux-arm-kernel@lists.infradead.org; Mon, 16 Nov 2020 08:34:12 +0000 Received: from DGGEMM402-HUB.china.huawei.com (unknown [172.30.72.57]) by szxga03-in.huawei.com (SkyGuard) with ESMTP id 4CZMmH5wmHz54hV; Mon, 16 Nov 2020 16:33:35 +0800 (CST) Received: from dggemi709-chm.china.huawei.com (10.3.20.108) by DGGEMM402-HUB.china.huawei.com (10.3.20.210) with Microsoft SMTP Server (TLS) id 14.3.487.0; Mon, 16 Nov 2020 16:33:43 +0800 Received: from dggemi761-chm.china.huawei.com (10.1.198.147) by dggemi709-chm.china.huawei.com (10.3.20.108) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1913.5; Mon, 16 Nov 2020 16:33:43 +0800 Received: from dggemi761-chm.china.huawei.com ([10.9.49.202]) by dggemi761-chm.china.huawei.com ([10.9.49.202]) with mapi id 15.01.1913.007; Mon, 16 Nov 2020 16:33:43 +0800 From: "Song Bao Hua (Barry Song)" To: Catalin Marinas , Mike Rapoport , "liwei (CM)" Subject: RE: [PATCH v2] arm64: mm: free unused memmap for sparse memory model that define VMEMMAP Thread-Topic: [PATCH v2] arm64: mm: free unused memmap for sparse memory model that define VMEMMAP Thread-Index: AQHWgeqeF9IRtLcIvk+OGBJGQD8vganK4CWw Date: Mon, 16 Nov 2020 08:33:43 +0000 Message-ID: References: <20200812010655.96339-1-liwei213@huawei.com> <20200817080405.GL969206@linux.ibm.com> <20200903120558.GB31409@gaia> In-Reply-To: <20200903120558.GB31409@gaia> Accept-Language: en-GB, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.126.201.147] MIME-Version: 1.0 X-CFilter-Loop: Reflected X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201116_033411_159002_84EFFEDB X-CRM114-Status: GOOD ( 25.81 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "linux-arm-kernel@lists.infradead.org" , "steve.capper@arm.com" , "Chenfeng \(puck\)" , sujunfei , "linux-kernel@vger.kernel.org" , Linuxarm , "Xiaqing \(A\)" , butao , "will@kernel.org" , "nsaenzjulienne@suse.de" , fengbaopeng Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org > -----Original Message----- > From: Catalin Marinas [mailto:catalin.marinas@arm.com] > Sent: Friday, September 4, 2020 12:06 AM > To: Mike Rapoport > Cc: liwei (CM) ; will@kernel.org; Xiaqing (A) > ; Chenfeng (puck) ; > butao ; fengbaopeng ; > nsaenzjulienne@suse.de; steve.capper@arm.com; Song Bao Hua (Barry Song) > ; linux-arm-kernel@lists.infradead.org; > linux-kernel@vger.kernel.org; sujunfei > Subject: Re: [PATCH v2] arm64: mm: free unused memmap for sparse memory > model that define VMEMMAP > > On Mon, Aug 17, 2020 at 11:04:05AM +0300, Mike Rapoport wrote: > > On Wed, Aug 12, 2020 at 09:06:55AM +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, this patch do it. > > > > I've been thinking about it a bit more and it seems that instead of > > freeing unused memory map it would be better to allocate the exact > > memory map from the beginning. > > > > In sparse_init_nid() we can replace PAGES_PER_SECTION parameter to > > __populate_section_memmap() with the calculated value for architectures > > that define HAVE_ARCH_PFN_VALID. > > Or just use a smaller PAGES_PER_SECTION and reduce the waste ;). > > Just to be clear, are you suggesting that we should use pfn_valid() on > the pages within a section to calculate the actual range? The > pfn_valid() implementation on arm64 checks for the validity of a sparse > section, so this would be called from within the sparse_init() code > path. I hope there's no dependency but I haven't checked. If it works, > it's fine by me, it solves the FLATMEM mem_map freeing as well. > > With 4KB pages on arm64, vmemmap_populate() stops at the pmd level, so > it always allocates PMD_SIZE. Wei's patch also only frees in PMD_SIZE > amounts. So, with a sizeof(struct page) of 64 (2^6), a PMD_SIZE mem_map > section would cover 2^(21-6) pages, so that's equivalent to a > SECTION_SIZE_BITS of 21-6+12 = 27. > > If we reduce SECTION_SIZE_BITS to 27 or less, this patch is a no-op. It would be the simplest way to fix this issue. It seems X86_64 is also using 27. @wei, has you ever tried to send a patch to change SECTION_SIZE_BITS to 27 for ARM64? > > -- > Catalin Thanks Barry _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel