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=-2.2 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 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 812FFC433DF for ; Tue, 7 Jul 2020 03:52:54 +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 4EC082053B for ; Tue, 7 Jul 2020 03:52:54 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="kZsuHb22" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 4EC082053B Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=arm.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:In-Reply-To:MIME-Version:Date:Message-ID:From: References:To:Subject:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=7hIEZ0da5sZKNxojzZpwYfyNPxYup1AawHO7G28tFGk=; b=kZsuHb22X3pwy4HDLgbvoMN3Y HXK/yuvQewUojYMIapY3Cv+zSlBz10L1evNQx2GhRyX6SCKi0gU53E+8CsxuY4M3xtPb7BpEjM5gO X18pHpK59hN0801ZESfPJq2VDVtknS4h8LLAZbxjw7aBpDYlyK8tgYNkRjp7q0V0jSMsYO01FGmLj AmJpbFh1IDliSsZYpviQd1yGdMzbVMwb5oPmtA0Pbz9G5KJQt4graB9cWwgTf2HHwB3WBwZhzQfuT z7+NslfyVwgbSn2xdAG2y6B5hlf9ZrC5vsEMLpWgqs7hGjWUflVLJa8e64XdoQ3TGjiF9mKWqR/eA 2DNuf5yuw==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jsedk-0006wd-8T; Tue, 07 Jul 2020 03:51:28 +0000 Received: from foss.arm.com ([217.140.110.172]) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jsedh-0006vT-9V; Tue, 07 Jul 2020 03:51:26 +0000 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 90E72C0A; Mon, 6 Jul 2020 20:51:19 -0700 (PDT) Received: from [10.163.86.118] (unknown [10.163.86.118]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id E34973F718; Mon, 6 Jul 2020 20:51:11 -0700 (PDT) Subject: Re: [PATCH V4 1/3] mm/sparsemem: Enable vmem_altmap support in vmemmap_populate_basepages() To: David Hildenbrand , linux-mm@kvack.org References: <1594004178-8861-1-git-send-email-anshuman.khandual@arm.com> <1594004178-8861-2-git-send-email-anshuman.khandual@arm.com> From: Anshuman Khandual Message-ID: <7ac5ff78-378c-37e2-444f-9f72844b8697@arm.com> Date: Tue, 7 Jul 2020 09:20:52 +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: Content-Language: en-US X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200706_235125_439055_C112D2EC X-CRM114-Status: GOOD ( 25.15 ) 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: Mark Rutland , Michal Hocko , linux-ia64@vger.kernel.org, Peter Zijlstra , catalin.marinas@arm.com, Dave Hansen , linux-riscv@lists.infradead.org, Will Deacon , Thomas Gleixner , justin.he@arm.com, x86@kernel.org, "Matthew Wilcox \(Oracle\)" , Mike Rapoport , Ingo Molnar , Fenghua Yu , Pavel Tatashin , Andy Lutomirski , Paul Walmsley , Dan Williams , linux-arm-kernel@lists.infradead.org, Tony Luck , linux-kernel@vger.kernel.org, Palmer Dabbelt , akpm@linux-foundation.org, "Kirill A. Shutemov" 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 On 07/06/2020 02:33 PM, David Hildenbrand wrote: >> return 0; >> @@ -1505,7 +1505,7 @@ int __meminit vmemmap_populate(unsigned long start, unsigned long end, int node, >> int err; >> >> if (end - start < PAGES_PER_SECTION * sizeof(struct page)) >> - err = vmemmap_populate_basepages(start, end, node); >> + err = vmemmap_populate_basepages(start, end, node, NULL); >> else if (boot_cpu_has(X86_FEATURE_PSE)) >> err = vmemmap_populate_hugepages(start, end, node, altmap); >> else if (altmap) { > > It's somewhat weird that we don't allocate basepages from altmap on x86 > (both for sub-sections and without PSE). I wonder if we can simply > unlock that with your change. Especially, also handle the > !X86_FEATURE_PSE case below properly with an altmap. > > a) all hw with PMEM has PSE - except special QEMU setups, so nobody > cared to implement. For the sub-section special case, nobody cared about > a handfull of memmap not ending up on the altmap. (but it's still wasted > system memory IIRC). > > b) the pagetable overhead for small pages is not-neglectable and might > result in similar issues as solved by the switch to altmap on very huge > PMEM (with small amount of system RAM). > > I guess it is due to a). Hmm, I assume these are some decisions that x86 platform will have to make going forward in a subsequent patch as the third patch does for the arm64 platform. But it is clearly beyond the scope of this patch which never intended to change existing behavior on a given platform. > > [...] > >> >> -pte_t * __meminit vmemmap_pte_populate(pmd_t *pmd, unsigned long addr, int node) >> +pte_t * __meminit vmemmap_pte_populate(pmd_t *pmd, unsigned long addr, int node, >> + struct vmem_altmap *altmap) >> { >> pte_t *pte = pte_offset_kernel(pmd, addr); >> if (pte_none(*pte)) { >> pte_t entry; >> - void *p = vmemmap_alloc_block_buf(PAGE_SIZE, node); >> + void *p; >> + >> + if (altmap) >> + p = altmap_alloc_block_buf(PAGE_SIZE, altmap); >> + else >> + p = vmemmap_alloc_block_buf(PAGE_SIZE, node); >> if (!p) >> return NULL; > > I was wondering if > > if (altmap) > p = altmap_alloc_block_buf(PAGE_SIZE, altmap); > if (!p) > p = vmemmap_alloc_block_buf(PAGE_SIZE, node); > if (!p) > return NULL > > Would make sense. But I guess this isn't really relevant in practice, > because the altmap is usually sized properly. > > In general, LGTM. Okay, I assume that no further changes are required here. _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel