From 5cfd84c85f9d657f6f2f9093c6485322aaff20f2 Mon Sep 17 00:00:00 2001 From: Vasiliy Stelmachenok Date: Thu, 31 Aug 2023 16:41:39 +0300 Subject: [PATCH 1/5] Enable defer+madvise defragmention for THP by default --- etc/tmpfiles.d/thp.conf | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 etc/tmpfiles.d/thp.conf diff --git a/etc/tmpfiles.d/thp.conf b/etc/tmpfiles.d/thp.conf new file mode 100644 index 0000000..bdd379e --- /dev/null +++ b/etc/tmpfiles.d/thp.conf @@ -0,0 +1,3 @@ +# Improve performance for applications that use tcmalloc +# https://github.com/google/tcmalloc/blob/master/docs/tuning.md#system-level-optimizations +w- /sys/kernel/mm/transparent_hugepage/defrag - - - - defer+madvise From 679b292092d252f99a048d62cd2abfea9df1cf00 Mon Sep 17 00:00:00 2001 From: Vasiliy Stelmachenok Date: Mon, 4 Sep 2023 15:20:21 +0300 Subject: [PATCH 2/5] Enable madvise globally for THP --- etc/tmpfiles.d/thp.conf | 1 + 1 file changed, 1 insertion(+) diff --git a/etc/tmpfiles.d/thp.conf b/etc/tmpfiles.d/thp.conf index bdd379e..e846d66 100644 --- a/etc/tmpfiles.d/thp.conf +++ b/etc/tmpfiles.d/thp.conf @@ -1,3 +1,4 @@ # Improve performance for applications that use tcmalloc # https://github.com/google/tcmalloc/blob/master/docs/tuning.md#system-level-optimizations w- /sys/kernel/mm/transparent_hugepage/defrag - - - - defer+madvise +w- /sys/kernel/mm/transparent_hugepage/enable - - - - madvise From b26ae7bed801909980498de3ccade8fdd19d4810 Mon Sep 17 00:00:00 2001 From: NextWorks <46625863+NextWork123@users.noreply.github.com> Date: Mon, 4 Sep 2023 16:40:50 +0200 Subject: [PATCH 3/5] Better to use w! the difference is that: w! overwrites existing data in the file. w- writes data only if the file is empty or unset. --- etc/tmpfiles.d/thp.conf | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/etc/tmpfiles.d/thp.conf b/etc/tmpfiles.d/thp.conf index e846d66..31c71a3 100644 --- a/etc/tmpfiles.d/thp.conf +++ b/etc/tmpfiles.d/thp.conf @@ -1,4 +1,4 @@ # Improve performance for applications that use tcmalloc # https://github.com/google/tcmalloc/blob/master/docs/tuning.md#system-level-optimizations -w- /sys/kernel/mm/transparent_hugepage/defrag - - - - defer+madvise -w- /sys/kernel/mm/transparent_hugepage/enable - - - - madvise +w! /sys/kernel/mm/transparent_hugepage/defrag - - - - defer+madvise +w! /sys/kernel/mm/transparent_hugepage/enable - - - - madvise From 48ee0a59d8a71a8b02f34100bcd3ac37541e78aa Mon Sep 17 00:00:00 2001 From: Vasiliy Stelmachenok Date: Tue, 5 Sep 2023 12:13:28 +0300 Subject: [PATCH 4/5] Fix the typo --- etc/tmpfiles.d/thp.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/etc/tmpfiles.d/thp.conf b/etc/tmpfiles.d/thp.conf index 31c71a3..7558493 100644 --- a/etc/tmpfiles.d/thp.conf +++ b/etc/tmpfiles.d/thp.conf @@ -1,4 +1,4 @@ # Improve performance for applications that use tcmalloc # https://github.com/google/tcmalloc/blob/master/docs/tuning.md#system-level-optimizations w! /sys/kernel/mm/transparent_hugepage/defrag - - - - defer+madvise -w! /sys/kernel/mm/transparent_hugepage/enable - - - - madvise +w! /sys/kernel/mm/transparent_hugepage/enabled - - - - madvise From f4bc377911e4d5f67fc082b7ab3c4e3ba47e38ae Mon Sep 17 00:00:00 2001 From: Vasiliy Stelmachenok Date: Thu, 21 Sep 2023 18:45:18 +0300 Subject: [PATCH 5/5] Remove global enabling of madvise Due to possible regressions --- etc/tmpfiles.d/thp.conf | 1 - 1 file changed, 1 deletion(-) diff --git a/etc/tmpfiles.d/thp.conf b/etc/tmpfiles.d/thp.conf index 7558493..284a726 100644 --- a/etc/tmpfiles.d/thp.conf +++ b/etc/tmpfiles.d/thp.conf @@ -1,4 +1,3 @@ # Improve performance for applications that use tcmalloc # https://github.com/google/tcmalloc/blob/master/docs/tuning.md#system-level-optimizations w! /sys/kernel/mm/transparent_hugepage/defrag - - - - defer+madvise -w! /sys/kernel/mm/transparent_hugepage/enabled - - - - madvise