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.7 required=3.0 tests=BAYES_00,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 31DF8C5517A for ; Fri, 6 Nov 2020 16:43:55 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C6634217A0 for ; Fri, 6 Nov 2020 16:43:54 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=bytedance-com.20150623.gappssmtp.com header.i=@bytedance-com.20150623.gappssmtp.com header.b="cBVLpopj" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727108AbgKFQnx (ORCPT ); Fri, 6 Nov 2020 11:43:53 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36584 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725868AbgKFQnx (ORCPT ); Fri, 6 Nov 2020 11:43:53 -0500 Received: from mail-pf1-x441.google.com (mail-pf1-x441.google.com [IPv6:2607:f8b0:4864:20::441]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EE54CC0613CF for ; Fri, 6 Nov 2020 08:43:51 -0800 (PST) Received: by mail-pf1-x441.google.com with SMTP id 72so1825779pfv.7 for ; Fri, 06 Nov 2020 08:43:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=ohGyP98uQQKhnB3pJGvLmrdRlMtpjmrRpHdlKsDa8JI=; b=cBVLpopjhvuZcULC1BoMrRoa/qq8goCwuZepVXmet2PTomK/LcORE5FdTGmV/Wu2B+ dWCKuVD0LZOHtB2nvIN/jibiaWuYIPt5p5mCkqr3azhxoZwWxaH3kjA+7CfWvGJcC2DI quopXOYu4OBkMgKQf05O3xOEvSsSfiOzN0HVHuNMviMzMm/5R9gsAPj55tujY33FL13H u+fOVdxUbtfVU/lX/4JVhlYtX1331+EpqSLDaxenFQgBFAkwSOYPFktjFtCLNx/qKjPP kzg/VRVgKtJzxUFCEiApIjGfoO2lPrK+TWx72ZkasH9cVcULD7csMyqsGvqn2hsV+7A/ iTFg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=ohGyP98uQQKhnB3pJGvLmrdRlMtpjmrRpHdlKsDa8JI=; b=czf5253YudxmF+VS/rVKDcuGxehVNDnSanh/8/mtoUAR5rNO3ELSzeyhACjv1TDUi/ lxule7XAt5vI47qDgSqQw67F4eolkAMsm0fvvJ8mi0KWjkXLZl393LpbZk/dxhFwJjM0 awYI4+ZuiRIBdG07R694qBVDkVW0Qwrf+Mz2EF+yfH+QD5HbbqxSc6699QTcONx0YB9S HQiINw9eJcyKK1GB0w0my1/nE6L25zTVIxBRXE3sLvHLwyztZMcAFNme5nmDQPPd325u Ye9xck1waoH8N06+qXChCSa52Me1+zp3lkhB3kN1wzaW+ELY0LS7pWemLJbRUyRQnhM2 ftgg== X-Gm-Message-State: AOAM530S/PX67CWa7IJAzj8/3TYePv6tnUWR7Mt1du3qWmPqkrhBJfZX ebqLvw/GNg8QFp0xnI1Rl2h0Kg0aj5kioCZzkQuPEg== X-Google-Smtp-Source: ABdhPJyLaAnrd+IG224fnDzZZ5YAYD7PCCD1T83OO0MFDfB2bhbeqq8qZzCx71hvpPHp2KQsJtiiQ4jrSkR16OyaidE= X-Received: by 2002:a17:90a:4749:: with SMTP id y9mr397490pjg.229.1604681031446; Fri, 06 Nov 2020 08:43:51 -0800 (PST) MIME-Version: 1.0 References: <20201026145114.59424-1-songmuchun@bytedance.com> <20201026145114.59424-6-songmuchun@bytedance.com> <20201105132337.GA7552@linux> <20201106094643.GA15654@linux> In-Reply-To: <20201106094643.GA15654@linux> From: Muchun Song Date: Sat, 7 Nov 2020 00:43:12 +0800 Message-ID: Subject: Re: [External] Re: [PATCH v2 05/19] mm/hugetlb: Introduce pgtable allocation/freeing helpers To: Oscar Salvador Cc: Jonathan Corbet , Mike Kravetz , Thomas Gleixner , mingo@redhat.com, bp@alien8.de, x86@kernel.org, hpa@zytor.com, dave.hansen@linux.intel.com, luto@kernel.org, Peter Zijlstra , viro@zeniv.linux.org.uk, Andrew Morton , paulmck@kernel.org, mchehab+huawei@kernel.org, pawan.kumar.gupta@linux.intel.com, Randy Dunlap , oneukum@suse.com, anshuman.khandual@arm.com, jroedel@suse.de, Mina Almasry , David Rientjes , Matthew Wilcox , Xiongchun duan , linux-doc@vger.kernel.org, LKML , Linux Memory Management List , linux-fsdevel Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Nov 6, 2020 at 5:46 PM Oscar Salvador wrote: > > On Fri, Nov 06, 2020 at 12:08:22AM +0800, Muchun Song wrote: > > > I do not think you need this. > > > We already have hugepages_supported(). > > > > Maybe some architectures support hugepage, but the vmemmap do not > > use the hugepage map. In this case, we need it. But I am not sure if it > > exists in the real world. At least, x86 can reuse hugepages_supported. > > Yes, but that is the point. > IIUC, this patchset will enable HugeTLB vmemmap pages only for x86_64. > Then, let us make the patchset specific to that architecture. > > If at some point this grows more users (powerpc, arm, ...), then we > can add the missing code, but for now it makes sense to only include > the bits to make this work on x86_64. > > And also according to this the changelog is a bit "misleading". > > "On some architectures, the vmemmap areas use huge page mapping. > If we want to free the unused vmemmap pages, we have to split > the huge pmd firstly. So we should pre-allocate pgtable to split > huge pmd." Thanks for your suggestions. I will rewrite the commit log. > > On x86_64, vmemmap is always PMD mapped if the machine has hugepages > support and if we have 2MB contiguos pages and PMD aligned. > e.g: I have seen cases where after the system has ran for a period > of time hotplug operations were mapping the vmemmap representing > the hot-added range on page base, because we could not find > enough contiguos and aligned memory. > > Something that [1] tries to solve: > > [1] https://patchwork.kernel.org/project/linux-mm/cover/20201022125835.26396-1-osalvador@suse.de/ > > But anyway, my point is that let us make it clear in the changelog that > this is aimed for x86_64 at the moment. > Saying "on some architures" might make think people that this is not > x86_64 specific. > > >> > > + vmemmap_pgtable_init(page); > > > > > > Maybe just open code this one? > > > > Sorry. I don't quite understand what it means. Could you explain? > > I meant doing > > page_huge_pte(page) = NULL > > But no strong feelings. > > -- > Oscar Salvador > SUSE L3 -- Yours, Muchun 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.7 required=3.0 tests=BAYES_00,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 1AA4CC388F2 for ; Fri, 6 Nov 2020 16:43:56 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 468B3217A0 for ; Fri, 6 Nov 2020 16:43:55 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=bytedance-com.20150623.gappssmtp.com header.i=@bytedance-com.20150623.gappssmtp.com header.b="cBVLpopj" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 468B3217A0 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=bytedance.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 60D706B0036; Fri, 6 Nov 2020 11:43:54 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 596096B005C; Fri, 6 Nov 2020 11:43:54 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 45E616B005D; Fri, 6 Nov 2020 11:43:54 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0087.hostedemail.com [216.40.44.87]) by kanga.kvack.org (Postfix) with ESMTP id 15DE66B0036 for ; Fri, 6 Nov 2020 11:43:54 -0500 (EST) Received: from smtpin24.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 97783180AD802 for ; Fri, 6 Nov 2020 16:43:53 +0000 (UTC) X-FDA: 77454565146.24.steel17_09056a7272d4 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin24.hostedemail.com (Postfix) with ESMTP id 776AE1A4A0 for ; Fri, 6 Nov 2020 16:43:53 +0000 (UTC) X-HE-Tag: steel17_09056a7272d4 X-Filterd-Recvd-Size: 5817 Received: from mail-pf1-f196.google.com (mail-pf1-f196.google.com [209.85.210.196]) by imf44.hostedemail.com (Postfix) with ESMTP for ; Fri, 6 Nov 2020 16:43:52 +0000 (UTC) Received: by mail-pf1-f196.google.com with SMTP id z3so1832277pfz.6 for ; Fri, 06 Nov 2020 08:43:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=ohGyP98uQQKhnB3pJGvLmrdRlMtpjmrRpHdlKsDa8JI=; b=cBVLpopjhvuZcULC1BoMrRoa/qq8goCwuZepVXmet2PTomK/LcORE5FdTGmV/Wu2B+ dWCKuVD0LZOHtB2nvIN/jibiaWuYIPt5p5mCkqr3azhxoZwWxaH3kjA+7CfWvGJcC2DI quopXOYu4OBkMgKQf05O3xOEvSsSfiOzN0HVHuNMviMzMm/5R9gsAPj55tujY33FL13H u+fOVdxUbtfVU/lX/4JVhlYtX1331+EpqSLDaxenFQgBFAkwSOYPFktjFtCLNx/qKjPP kzg/VRVgKtJzxUFCEiApIjGfoO2lPrK+TWx72ZkasH9cVcULD7csMyqsGvqn2hsV+7A/ iTFg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=ohGyP98uQQKhnB3pJGvLmrdRlMtpjmrRpHdlKsDa8JI=; b=CPeD4BhpOjsthoDdlwqCoSq/2qLq2CmxgXSF3WBkqtatZrEZ4kl1jyf4rBAxJ4FhjR UYeKosi3N29Zep9XKPvUIWoB3jKNLIZNPl3pytxpvPn3YX3VEC3uNiTKu4hARA0mo5iY Q5OjZjRaB4K0TyD2+qDEYxLf8W32bTtN4tM9LP8vCZNYQkoV2JeiBHCakJlC5BnIQaMr J8BhkJuhyp1NzAKHu/Cy7psuwbgDnwF+K8EInnwYVN9/oIVaMHwMyN+/Ux0rQfd3Hr3t jRoSNIVGTGRK6XV4Selv47M7JOHD7gc1DuWKPd5RxmVGX86V4WGXL2d65hdURy6UwjWs 7SSg== X-Gm-Message-State: AOAM531w39dSkiW2+518eyHG6XzxYf0Crrp4HHdHqgDKR3dX6k4vDkXk jsoC0MNH6U977ijrONATj/IHrOvJ6HsWZhPV7Vh/9A== X-Google-Smtp-Source: ABdhPJyLaAnrd+IG224fnDzZZ5YAYD7PCCD1T83OO0MFDfB2bhbeqq8qZzCx71hvpPHp2KQsJtiiQ4jrSkR16OyaidE= X-Received: by 2002:a17:90a:4749:: with SMTP id y9mr397490pjg.229.1604681031446; Fri, 06 Nov 2020 08:43:51 -0800 (PST) MIME-Version: 1.0 References: <20201026145114.59424-1-songmuchun@bytedance.com> <20201026145114.59424-6-songmuchun@bytedance.com> <20201105132337.GA7552@linux> <20201106094643.GA15654@linux> In-Reply-To: <20201106094643.GA15654@linux> From: Muchun Song Date: Sat, 7 Nov 2020 00:43:12 +0800 Message-ID: Subject: Re: [External] Re: [PATCH v2 05/19] mm/hugetlb: Introduce pgtable allocation/freeing helpers To: Oscar Salvador Cc: Jonathan Corbet , Mike Kravetz , Thomas Gleixner , mingo@redhat.com, bp@alien8.de, x86@kernel.org, hpa@zytor.com, dave.hansen@linux.intel.com, luto@kernel.org, Peter Zijlstra , viro@zeniv.linux.org.uk, Andrew Morton , paulmck@kernel.org, mchehab+huawei@kernel.org, pawan.kumar.gupta@linux.intel.com, Randy Dunlap , oneukum@suse.com, anshuman.khandual@arm.com, jroedel@suse.de, Mina Almasry , David Rientjes , Matthew Wilcox , Xiongchun duan , linux-doc@vger.kernel.org, LKML , Linux Memory Management List , linux-fsdevel Content-Type: text/plain; charset="UTF-8" X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Fri, Nov 6, 2020 at 5:46 PM Oscar Salvador wrote: > > On Fri, Nov 06, 2020 at 12:08:22AM +0800, Muchun Song wrote: > > > I do not think you need this. > > > We already have hugepages_supported(). > > > > Maybe some architectures support hugepage, but the vmemmap do not > > use the hugepage map. In this case, we need it. But I am not sure if it > > exists in the real world. At least, x86 can reuse hugepages_supported. > > Yes, but that is the point. > IIUC, this patchset will enable HugeTLB vmemmap pages only for x86_64. > Then, let us make the patchset specific to that architecture. > > If at some point this grows more users (powerpc, arm, ...), then we > can add the missing code, but for now it makes sense to only include > the bits to make this work on x86_64. > > And also according to this the changelog is a bit "misleading". > > "On some architectures, the vmemmap areas use huge page mapping. > If we want to free the unused vmemmap pages, we have to split > the huge pmd firstly. So we should pre-allocate pgtable to split > huge pmd." Thanks for your suggestions. I will rewrite the commit log. > > On x86_64, vmemmap is always PMD mapped if the machine has hugepages > support and if we have 2MB contiguos pages and PMD aligned. > e.g: I have seen cases where after the system has ran for a period > of time hotplug operations were mapping the vmemmap representing > the hot-added range on page base, because we could not find > enough contiguos and aligned memory. > > Something that [1] tries to solve: > > [1] https://patchwork.kernel.org/project/linux-mm/cover/20201022125835.26396-1-osalvador@suse.de/ > > But anyway, my point is that let us make it clear in the changelog that > this is aimed for x86_64 at the moment. > Saying "on some architures" might make think people that this is not > x86_64 specific. > > >> > > + vmemmap_pgtable_init(page); > > > > > > Maybe just open code this one? > > > > Sorry. I don't quite understand what it means. Could you explain? > > I meant doing > > page_huge_pte(page) = NULL > > But no strong feelings. > > -- > Oscar Salvador > SUSE L3 -- Yours, Muchun