Message ID | 20220331065640.5777-1-songmuchun@bytedance.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | [v4,1/2] mm: hugetlb_vmemmap: introduce ARCH_WANT_HUGETLB_PAGE_FREE_VMEMMAP | expand |
On 31.03.22 08:56, Muchun Song wrote: > The feature of minimizing overhead of struct page associated with each > HugeTLB page is implemented on x86_64, however, the infrastructure of > this feature is already there, we could easily enable it for other > architectures. Introduce ARCH_WANT_HUGETLB_PAGE_FREE_VMEMMAP for other > architectures to be easily enabled. Just select this config if they > want to enable this feature. > > Suggested-by: Andrew Morton <akpm@linux-foundation.org> > Signed-off-by: Muchun Song <songmuchun@bytedance.com> > --- > arch/x86/Kconfig | 1 + > fs/Kconfig | 10 +++++++++- > 2 files changed, 10 insertions(+), 1 deletion(-) > > diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig > index 9f5bd41bf660..e69d42528542 100644 > --- a/arch/x86/Kconfig > +++ b/arch/x86/Kconfig > @@ -119,6 +119,7 @@ config X86 > select ARCH_WANTS_DYNAMIC_TASK_STRUCT > select ARCH_WANTS_NO_INSTR > select ARCH_WANT_HUGE_PMD_SHARE > + select ARCH_WANT_HUGETLB_PAGE_FREE_VMEMMAP if X86_64 > select ARCH_WANT_LD_ORPHAN_WARN > select ARCH_WANTS_THP_SWAP if X86_64 > select ARCH_HAS_PARANOID_L1D_FLUSH > diff --git a/fs/Kconfig b/fs/Kconfig > index 6c7dc1387beb..f6db2af33738 100644 > --- a/fs/Kconfig > +++ b/fs/Kconfig > @@ -245,9 +245,17 @@ config HUGETLBFS > config HUGETLB_PAGE > def_bool HUGETLBFS > > +# > +# Select this config option from the architecture Kconfig, if it is preferred > +# to enable the feature of minimizing overhead of struct page associated with > +# each HugeTLB page. > +# > +config ARCH_WANT_HUGETLB_PAGE_FREE_VMEMMAP > + bool > + > config HUGETLB_PAGE_FREE_VMEMMAP > def_bool HUGETLB_PAGE > - depends on X86_64 > + depends on ARCH_WANT_HUGETLB_PAGE_FREE_VMEMMAP > depends on SPARSEMEM_VMEMMAP > > config HUGETLB_PAGE_FREE_VMEMMAP_DEFAULT_ON I think something like "HUGETLB_OPTIMIZE_VMEMMAP" might be more expressive, but that would imply renaming the existing config knob. Apart from that LGTM.
On Thu, Mar 31, 2022 at 4:42 PM David Hildenbrand <david@redhat.com> wrote: > > On 31.03.22 08:56, Muchun Song wrote: > > The feature of minimizing overhead of struct page associated with each > > HugeTLB page is implemented on x86_64, however, the infrastructure of > > this feature is already there, we could easily enable it for other > > architectures. Introduce ARCH_WANT_HUGETLB_PAGE_FREE_VMEMMAP for other > > architectures to be easily enabled. Just select this config if they > > want to enable this feature. > > > > Suggested-by: Andrew Morton <akpm@linux-foundation.org> > > Signed-off-by: Muchun Song <songmuchun@bytedance.com> > > --- > > arch/x86/Kconfig | 1 + > > fs/Kconfig | 10 +++++++++- > > 2 files changed, 10 insertions(+), 1 deletion(-) > > > > diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig > > index 9f5bd41bf660..e69d42528542 100644 > > --- a/arch/x86/Kconfig > > +++ b/arch/x86/Kconfig > > @@ -119,6 +119,7 @@ config X86 > > select ARCH_WANTS_DYNAMIC_TASK_STRUCT > > select ARCH_WANTS_NO_INSTR > > select ARCH_WANT_HUGE_PMD_SHARE > > + select ARCH_WANT_HUGETLB_PAGE_FREE_VMEMMAP if X86_64 > > select ARCH_WANT_LD_ORPHAN_WARN > > select ARCH_WANTS_THP_SWAP if X86_64 > > select ARCH_HAS_PARANOID_L1D_FLUSH > > diff --git a/fs/Kconfig b/fs/Kconfig > > index 6c7dc1387beb..f6db2af33738 100644 > > --- a/fs/Kconfig > > +++ b/fs/Kconfig > > @@ -245,9 +245,17 @@ config HUGETLBFS > > config HUGETLB_PAGE > > def_bool HUGETLBFS > > > > +# > > +# Select this config option from the architecture Kconfig, if it is preferred > > +# to enable the feature of minimizing overhead of struct page associated with > > +# each HugeTLB page. > > +# > > +config ARCH_WANT_HUGETLB_PAGE_FREE_VMEMMAP > > + bool > > + > > config HUGETLB_PAGE_FREE_VMEMMAP > > def_bool HUGETLB_PAGE > > - depends on X86_64 > > + depends on ARCH_WANT_HUGETLB_PAGE_FREE_VMEMMAP > > depends on SPARSEMEM_VMEMMAP > > > > config HUGETLB_PAGE_FREE_VMEMMAP_DEFAULT_ON > > > I think something like "HUGETLB_OPTIMIZE_VMEMMAP" might be more > expressive, but that would imply renaming the existing config knob. > How about doing a full code cleanup in a separate series in the future?
On 31.03.22 10:48, Muchun Song wrote: > On Thu, Mar 31, 2022 at 4:42 PM David Hildenbrand <david@redhat.com> wrote: >> >> On 31.03.22 08:56, Muchun Song wrote: >>> The feature of minimizing overhead of struct page associated with each >>> HugeTLB page is implemented on x86_64, however, the infrastructure of >>> this feature is already there, we could easily enable it for other >>> architectures. Introduce ARCH_WANT_HUGETLB_PAGE_FREE_VMEMMAP for other >>> architectures to be easily enabled. Just select this config if they >>> want to enable this feature. >>> >>> Suggested-by: Andrew Morton <akpm@linux-foundation.org> >>> Signed-off-by: Muchun Song <songmuchun@bytedance.com> >>> --- >>> arch/x86/Kconfig | 1 + >>> fs/Kconfig | 10 +++++++++- >>> 2 files changed, 10 insertions(+), 1 deletion(-) >>> >>> diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig >>> index 9f5bd41bf660..e69d42528542 100644 >>> --- a/arch/x86/Kconfig >>> +++ b/arch/x86/Kconfig >>> @@ -119,6 +119,7 @@ config X86 >>> select ARCH_WANTS_DYNAMIC_TASK_STRUCT >>> select ARCH_WANTS_NO_INSTR >>> select ARCH_WANT_HUGE_PMD_SHARE >>> + select ARCH_WANT_HUGETLB_PAGE_FREE_VMEMMAP if X86_64 >>> select ARCH_WANT_LD_ORPHAN_WARN >>> select ARCH_WANTS_THP_SWAP if X86_64 >>> select ARCH_HAS_PARANOID_L1D_FLUSH >>> diff --git a/fs/Kconfig b/fs/Kconfig >>> index 6c7dc1387beb..f6db2af33738 100644 >>> --- a/fs/Kconfig >>> +++ b/fs/Kconfig >>> @@ -245,9 +245,17 @@ config HUGETLBFS >>> config HUGETLB_PAGE >>> def_bool HUGETLBFS >>> >>> +# >>> +# Select this config option from the architecture Kconfig, if it is preferred >>> +# to enable the feature of minimizing overhead of struct page associated with >>> +# each HugeTLB page. >>> +# >>> +config ARCH_WANT_HUGETLB_PAGE_FREE_VMEMMAP >>> + bool >>> + >>> config HUGETLB_PAGE_FREE_VMEMMAP >>> def_bool HUGETLB_PAGE >>> - depends on X86_64 >>> + depends on ARCH_WANT_HUGETLB_PAGE_FREE_VMEMMAP >>> depends on SPARSEMEM_VMEMMAP >>> >>> config HUGETLB_PAGE_FREE_VMEMMAP_DEFAULT_ON >> >> >> I think something like "HUGETLB_OPTIMIZE_VMEMMAP" might be more >> expressive, but that would imply renaming the existing config knob. >> > > How about doing a full code cleanup in a separate series in the future? > Yeah.
On Thu, Mar 31, 2022 at 4:51 PM David Hildenbrand <david@redhat.com> wrote: > > On 31.03.22 10:48, Muchun Song wrote: > > On Thu, Mar 31, 2022 at 4:42 PM David Hildenbrand <david@redhat.com> wrote: > >> > >> On 31.03.22 08:56, Muchun Song wrote: > >>> The feature of minimizing overhead of struct page associated with each > >>> HugeTLB page is implemented on x86_64, however, the infrastructure of > >>> this feature is already there, we could easily enable it for other > >>> architectures. Introduce ARCH_WANT_HUGETLB_PAGE_FREE_VMEMMAP for other > >>> architectures to be easily enabled. Just select this config if they > >>> want to enable this feature. > >>> > >>> Suggested-by: Andrew Morton <akpm@linux-foundation.org> > >>> Signed-off-by: Muchun Song <songmuchun@bytedance.com> > >>> --- > >>> arch/x86/Kconfig | 1 + > >>> fs/Kconfig | 10 +++++++++- > >>> 2 files changed, 10 insertions(+), 1 deletion(-) > >>> > >>> diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig > >>> index 9f5bd41bf660..e69d42528542 100644 > >>> --- a/arch/x86/Kconfig > >>> +++ b/arch/x86/Kconfig > >>> @@ -119,6 +119,7 @@ config X86 > >>> select ARCH_WANTS_DYNAMIC_TASK_STRUCT > >>> select ARCH_WANTS_NO_INSTR > >>> select ARCH_WANT_HUGE_PMD_SHARE > >>> + select ARCH_WANT_HUGETLB_PAGE_FREE_VMEMMAP if X86_64 > >>> select ARCH_WANT_LD_ORPHAN_WARN > >>> select ARCH_WANTS_THP_SWAP if X86_64 > >>> select ARCH_HAS_PARANOID_L1D_FLUSH > >>> diff --git a/fs/Kconfig b/fs/Kconfig > >>> index 6c7dc1387beb..f6db2af33738 100644 > >>> --- a/fs/Kconfig > >>> +++ b/fs/Kconfig > >>> @@ -245,9 +245,17 @@ config HUGETLBFS > >>> config HUGETLB_PAGE > >>> def_bool HUGETLBFS > >>> > >>> +# > >>> +# Select this config option from the architecture Kconfig, if it is preferred > >>> +# to enable the feature of minimizing overhead of struct page associated with > >>> +# each HugeTLB page. > >>> +# > >>> +config ARCH_WANT_HUGETLB_PAGE_FREE_VMEMMAP > >>> + bool > >>> + > >>> config HUGETLB_PAGE_FREE_VMEMMAP > >>> def_bool HUGETLB_PAGE > >>> - depends on X86_64 > >>> + depends on ARCH_WANT_HUGETLB_PAGE_FREE_VMEMMAP > >>> depends on SPARSEMEM_VMEMMAP > >>> > >>> config HUGETLB_PAGE_FREE_VMEMMAP_DEFAULT_ON > >> > >> > >> I think something like "HUGETLB_OPTIMIZE_VMEMMAP" might be more > >> expressive, but that would imply renaming the existing config knob. > >> > > > > How about doing a full code cleanup in a separate series in the future? > > > > Yeah. > OK. Have Added it into my To-do list. Thanks.
On Thu, Mar 31, 2022 at 7:57 PM Muchun Song <songmuchun@bytedance.com> wrote: > > The feature of minimizing overhead of struct page associated with each > HugeTLB page is implemented on x86_64, however, the infrastructure of > this feature is already there, we could easily enable it for other > architectures. Introduce ARCH_WANT_HUGETLB_PAGE_FREE_VMEMMAP for other > architectures to be easily enabled. Just select this config if they > want to enable this feature. > > Suggested-by: Andrew Morton <akpm@linux-foundation.org> > Signed-off-by: Muchun Song <songmuchun@bytedance.com> Review-by: Barry Song <baohua@kernel.org> > --- > arch/x86/Kconfig | 1 + > fs/Kconfig | 10 +++++++++- > 2 files changed, 10 insertions(+), 1 deletion(-) > > diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig > index 9f5bd41bf660..e69d42528542 100644 > --- a/arch/x86/Kconfig > +++ b/arch/x86/Kconfig > @@ -119,6 +119,7 @@ config X86 > select ARCH_WANTS_DYNAMIC_TASK_STRUCT > select ARCH_WANTS_NO_INSTR > select ARCH_WANT_HUGE_PMD_SHARE > + select ARCH_WANT_HUGETLB_PAGE_FREE_VMEMMAP if X86_64 > select ARCH_WANT_LD_ORPHAN_WARN > select ARCH_WANTS_THP_SWAP if X86_64 > select ARCH_HAS_PARANOID_L1D_FLUSH > diff --git a/fs/Kconfig b/fs/Kconfig > index 6c7dc1387beb..f6db2af33738 100644 > --- a/fs/Kconfig > +++ b/fs/Kconfig > @@ -245,9 +245,17 @@ config HUGETLBFS > config HUGETLB_PAGE > def_bool HUGETLBFS > > +# > +# Select this config option from the architecture Kconfig, if it is preferred > +# to enable the feature of minimizing overhead of struct page associated with > +# each HugeTLB page. > +# > +config ARCH_WANT_HUGETLB_PAGE_FREE_VMEMMAP > + bool > + > config HUGETLB_PAGE_FREE_VMEMMAP > def_bool HUGETLB_PAGE > - depends on X86_64 > + depends on ARCH_WANT_HUGETLB_PAGE_FREE_VMEMMAP > depends on SPARSEMEM_VMEMMAP > > config HUGETLB_PAGE_FREE_VMEMMAP_DEFAULT_ON > -- > 2.11.0 >
On 3/31/22 12:26, Muchun Song wrote: > The feature of minimizing overhead of struct page associated with each > HugeTLB page is implemented on x86_64, however, the infrastructure of > this feature is already there, we could easily enable it for other > architectures. Introduce ARCH_WANT_HUGETLB_PAGE_FREE_VMEMMAP for other > architectures to be easily enabled. Just select this config if they > want to enable this feature. > > Suggested-by: Andrew Morton <akpm@linux-foundation.org> > Signed-off-by: Muchun Song <songmuchun@bytedance.com> > --- > arch/x86/Kconfig | 1 + > fs/Kconfig | 10 +++++++++- > 2 files changed, 10 insertions(+), 1 deletion(-) > > diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig > index 9f5bd41bf660..e69d42528542 100644 > --- a/arch/x86/Kconfig > +++ b/arch/x86/Kconfig > @@ -119,6 +119,7 @@ config X86 > select ARCH_WANTS_DYNAMIC_TASK_STRUCT > select ARCH_WANTS_NO_INSTR > select ARCH_WANT_HUGE_PMD_SHARE > + select ARCH_WANT_HUGETLB_PAGE_FREE_VMEMMAP if X86_64 > select ARCH_WANT_LD_ORPHAN_WARN > select ARCH_WANTS_THP_SWAP if X86_64 > select ARCH_HAS_PARANOID_L1D_FLUSH > diff --git a/fs/Kconfig b/fs/Kconfig > index 6c7dc1387beb..f6db2af33738 100644 > --- a/fs/Kconfig > +++ b/fs/Kconfig > @@ -245,9 +245,17 @@ config HUGETLBFS > config HUGETLB_PAGE > def_bool HUGETLBFS > > +# > +# Select this config option from the architecture Kconfig, if it is preferred > +# to enable the feature of minimizing overhead of struct page associated with > +# each HugeTLB page. > +# > +config ARCH_WANT_HUGETLB_PAGE_FREE_VMEMMAP > + bool > + > config HUGETLB_PAGE_FREE_VMEMMAP > def_bool HUGETLB_PAGE > - depends on X86_64 > + depends on ARCH_WANT_HUGETLB_PAGE_FREE_VMEMMAP > depends on SPARSEMEM_VMEMMAP > > config HUGETLB_PAGE_FREE_VMEMMAP_DEFAULT_ON Better to have platforms subscribe via ARCH_HAS/WANTS_ method instead of direct dependency in the config itself. LGTM. Reviewed-by: Anshuman Khandual <anshuman.khandual@arm.com>
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig index 9f5bd41bf660..e69d42528542 100644 --- a/arch/x86/Kconfig +++ b/arch/x86/Kconfig @@ -119,6 +119,7 @@ config X86 select ARCH_WANTS_DYNAMIC_TASK_STRUCT select ARCH_WANTS_NO_INSTR select ARCH_WANT_HUGE_PMD_SHARE + select ARCH_WANT_HUGETLB_PAGE_FREE_VMEMMAP if X86_64 select ARCH_WANT_LD_ORPHAN_WARN select ARCH_WANTS_THP_SWAP if X86_64 select ARCH_HAS_PARANOID_L1D_FLUSH diff --git a/fs/Kconfig b/fs/Kconfig index 6c7dc1387beb..f6db2af33738 100644 --- a/fs/Kconfig +++ b/fs/Kconfig @@ -245,9 +245,17 @@ config HUGETLBFS config HUGETLB_PAGE def_bool HUGETLBFS +# +# Select this config option from the architecture Kconfig, if it is preferred +# to enable the feature of minimizing overhead of struct page associated with +# each HugeTLB page. +# +config ARCH_WANT_HUGETLB_PAGE_FREE_VMEMMAP + bool + config HUGETLB_PAGE_FREE_VMEMMAP def_bool HUGETLB_PAGE - depends on X86_64 + depends on ARCH_WANT_HUGETLB_PAGE_FREE_VMEMMAP depends on SPARSEMEM_VMEMMAP config HUGETLB_PAGE_FREE_VMEMMAP_DEFAULT_ON
The feature of minimizing overhead of struct page associated with each HugeTLB page is implemented on x86_64, however, the infrastructure of this feature is already there, we could easily enable it for other architectures. Introduce ARCH_WANT_HUGETLB_PAGE_FREE_VMEMMAP for other architectures to be easily enabled. Just select this config if they want to enable this feature. Suggested-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Muchun Song <songmuchun@bytedance.com> --- arch/x86/Kconfig | 1 + fs/Kconfig | 10 +++++++++- 2 files changed, 10 insertions(+), 1 deletion(-)