Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1610307 > unrolled thread
| Started by | "Huang, Ying" <ying.huang@intel.com> |
|---|---|
| First post | 2017-03-28 07:40 +0200 |
| Last post | 2017-04-01 05:30 +0200 |
| Articles | 7 — 4 participants |
Back to article view | Back to linux.kernel
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
[PATCH -mm -v7 1/9] mm, swap: Make swap cluster size same of THP size on x86_64 "Huang, Ying" <ying.huang@intel.com> - 2017-03-28 07:40 +0200
Re: [PATCH -mm -v7 1/9] mm, swap: Make swap cluster size same of THP size on x86_64 "Kirill A. Shutemov" <kirill@shutemov.name> - 2017-03-29 01:40 +0200
Re: [PATCH -mm -v7 1/9] mm, swap: Make swap cluster size same of THP size on x86_64 "Huang\, Ying" <ying.huang@intel.com> - 2017-03-29 03:20 +0200
Re: [PATCH -mm -v7 1/9] mm, swap: Make swap cluster size same of THP size on x86_64 Johannes Weiner <hannes@cmpxchg.org> - 2017-03-29 19:00 +0200
Re: [PATCH -mm -v7 1/9] mm, swap: Make swap cluster size same of THP size on x86_64 "Huang\, Ying" <ying.huang@intel.com> - 2017-03-30 02:50 +0200
Re: [PATCH -mm -v7 1/9] mm, swap: Make swap cluster size same of THP size on x86_64 Johannes Weiner <hannes@cmpxchg.org> - 2017-03-31 17:00 +0200
Re: [PATCH -mm -v7 1/9] mm, swap: Make swap cluster size same of THP size on x86_64 "Huang\, Ying" <ying.huang@intel.com> - 2017-04-01 05:30 +0200
| From | "Huang, Ying" <ying.huang@intel.com> |
|---|---|
| Date | 2017-03-28 07:40 +0200 |
| Subject | [PATCH -mm -v7 1/9] mm, swap: Make swap cluster size same of THP size on x86_64 |
| Message-ID | <tpS1j-2ZP-3@gated-at.bofh.it> |
From: Huang Ying <ying.huang@intel.com> In this patch, the size of the swap cluster is changed to that of the THP (Transparent Huge Page) on x86_64 architecture (512). This is for the THP swap support on x86_64. Where one swap cluster will be used to hold the contents of each THP swapped out. And some information of the swapped out THP (such as compound map count) will be recorded in the swap_cluster_info data structure. For other architectures which want THP swap support, ARCH_USES_THP_SWAP_CLUSTER need to be selected in the Kconfig file for the architecture. In effect, this will enlarge swap cluster size by 2 times on x86_64. Which may make it harder to find a free cluster when the swap space becomes fragmented. So that, this may reduce the continuous swap space allocation and sequential write in theory. The performance test in 0day shows no regressions caused by this. Cc: Hugh Dickins <hughd@google.com> Cc: Shaohua Li <shli@kernel.org> Cc: Minchan Kim <minchan@kernel.org> Cc: Rik van Riel <riel@redhat.com> Suggested-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: "Huang, Ying" <ying.huang@intel.com> --- arch/x86/Kconfig | 1 + mm/Kconfig | 13 +++++++++++++ mm/swapfile.c | 4 ++++ 3 files changed, 18 insertions(+) diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig index abfc31fb0bee..852d13878793 100644 --- a/arch/x86/Kconfig +++ b/arch/x86/Kconfig @@ -178,6 +178,7 @@ config X86 select USER_STACKTRACE_SUPPORT select VIRT_TO_BUS select X86_FEATURE_NAMES if PROC_FS + select ARCH_USES_THP_SWAP_CLUSTER if X86_64 config INSTRUCTION_DECODER def_bool y diff --git a/mm/Kconfig b/mm/Kconfig index 9b8fccb969dc..7b708e200c29 100644 --- a/mm/Kconfig +++ b/mm/Kconfig @@ -499,6 +499,19 @@ config FRONTSWAP If unsure, say Y to enable frontswap. +config ARCH_USES_THP_SWAP_CLUSTER + bool + default n + +config THP_SWAP_CLUSTER + bool + depends on SWAP && TRANSPARENT_HUGEPAGE && ARCH_USES_THP_SWAP_CLUSTER + default y + help + Use one swap cluster to hold the contents of the THP + (Transparent Huge Page) swapped out. The size of the swap + cluster will be same as that of THP. + config CMA bool "Contiguous Memory Allocator" depends on HAVE_MEMBLOCK && MMU diff --git a/mm/swapfile.c b/mm/swapfile.c index 53b5881ee0d6..abc401f72a0a 100644 --- a/mm/swapfile.c +++ b/mm/swapfile.c @@ -199,7 +199,11 @@ static void discard_swap_cluster(struct swap_info_struct *si, } } +#ifdef CONFIG_THP_SWAP_CLUSTER +#define SWAPFILE_CLUSTER HPAGE_PMD_NR +#else #define SWAPFILE_CLUSTER 256 +#endif #define LATENCY_LIMIT 256 static inline void cluster_set_flag(struct swap_cluster_info *info, -- 2.11.0
[toc] | [next] | [standalone]
| From | "Kirill A. Shutemov" <kirill@shutemov.name> |
|---|---|
| Date | 2017-03-29 01:40 +0200 |
| Subject | Re: [PATCH -mm -v7 1/9] mm, swap: Make swap cluster size same of THP size on x86_64 |
| Message-ID | <tq8St-6H1-9@gated-at.bofh.it> |
| In reply to | #1610307 |
On Tue, Mar 28, 2017 at 01:32:01PM +0800, Huang, Ying wrote: > From: Huang Ying <ying.huang@intel.com> > > In this patch, the size of the swap cluster is changed to that of the > THP (Transparent Huge Page) on x86_64 architecture (512). This is for > the THP swap support on x86_64. Where one swap cluster will be used to > hold the contents of each THP swapped out. And some information of the > swapped out THP (such as compound map count) will be recorded in the > swap_cluster_info data structure. > > For other architectures which want THP swap support, > ARCH_USES_THP_SWAP_CLUSTER need to be selected in the Kconfig file for > the architecture. Intreseting case could be architecture with HPAGE_PMD_NR < 256. Can current code pack more than one THP per claster. If not we need to have BUILG_BUG_ON() to catch attempt of such enabling. -- Kirill A. Shutemov
[toc] | [prev] | [next] | [standalone]
| From | "Huang\, Ying" <ying.huang@intel.com> |
|---|---|
| Date | 2017-03-29 03:20 +0200 |
| Message-ID | <tqarf-7UU-3@gated-at.bofh.it> |
| In reply to | #1611434 |
"Kirill A. Shutemov" <kirill@shutemov.name> writes: > On Tue, Mar 28, 2017 at 01:32:01PM +0800, Huang, Ying wrote: >> From: Huang Ying <ying.huang@intel.com> >> >> In this patch, the size of the swap cluster is changed to that of the >> THP (Transparent Huge Page) on x86_64 architecture (512). This is for >> the THP swap support on x86_64. Where one swap cluster will be used to >> hold the contents of each THP swapped out. And some information of the >> swapped out THP (such as compound map count) will be recorded in the >> swap_cluster_info data structure. >> >> For other architectures which want THP swap support, >> ARCH_USES_THP_SWAP_CLUSTER need to be selected in the Kconfig file for >> the architecture. > > Intreseting case could be architecture with HPAGE_PMD_NR < 256. > Can current code pack more than one THP per claster. No. Only one THP for each swap cluster is supported. But in current implementation, if HPAGE_PMD_NR < 256, the swap cluster will be < 256 too. The size of swap cluster will be exact same as HPAGE_PMD_NR. Best Regards, Huang, Ying > If not we need to have BUILG_BUG_ON() to catch attempt of such enabling.
[toc] | [prev] | [next] | [standalone]
| From | Johannes Weiner <hannes@cmpxchg.org> |
|---|---|
| Date | 2017-03-29 19:00 +0200 |
| Subject | Re: [PATCH -mm -v7 1/9] mm, swap: Make swap cluster size same of THP size on x86_64 |
| Message-ID | <tqp6W-1bC-25@gated-at.bofh.it> |
| In reply to | #1610307 |
On Tue, Mar 28, 2017 at 01:32:01PM +0800, Huang, Ying wrote:
> @@ -499,6 +499,19 @@ config FRONTSWAP
>
> If unsure, say Y to enable frontswap.
>
> +config ARCH_USES_THP_SWAP_CLUSTER
> + bool
> + default n
This is fine.
> +config THP_SWAP_CLUSTER
> + bool
> + depends on SWAP && TRANSPARENT_HUGEPAGE && ARCH_USES_THP_SWAP_CLUSTER
> + default y
> + help
> + Use one swap cluster to hold the contents of the THP
> + (Transparent Huge Page) swapped out. The size of the swap
> + cluster will be same as that of THP.
But this is a super weird thing to ask the user. How would they know
what to say, if we don't know? I don't think this should be a config
knob at all. Merge the two config items into a simple
config THP_SWAP_CLUSTER
bool
default n
and let the archs with reasonable THP sizes select it.
[toc] | [prev] | [next] | [standalone]
| From | "Huang\, Ying" <ying.huang@intel.com> |
|---|---|
| Date | 2017-03-30 02:50 +0200 |
| Message-ID | <tqwrM-6Aq-25@gated-at.bofh.it> |
| In reply to | #1612153 |
Johannes Weiner <hannes@cmpxchg.org> writes: > On Tue, Mar 28, 2017 at 01:32:01PM +0800, Huang, Ying wrote: >> @@ -499,6 +499,19 @@ config FRONTSWAP >> >> If unsure, say Y to enable frontswap. >> >> +config ARCH_USES_THP_SWAP_CLUSTER >> + bool >> + default n > > This is fine. > >> +config THP_SWAP_CLUSTER >> + bool >> + depends on SWAP && TRANSPARENT_HUGEPAGE && ARCH_USES_THP_SWAP_CLUSTER >> + default y >> + help >> + Use one swap cluster to hold the contents of the THP >> + (Transparent Huge Page) swapped out. The size of the swap >> + cluster will be same as that of THP. > > But this is a super weird thing to ask the user. How would they know > what to say, if we don't know? I don't think this should be a config > knob at all. Merge the two config items into a simple The user will not see this, because there is no string after "bool" to let user to select it. The help here is for document only, so that architecture developers could know what this is for. > config THP_SWAP_CLUSTER > bool > default n > > and let the archs with reasonable THP sizes select it. This will have same effect as the original solution except the document is removed. Best Regards, Huang, Ying
[toc] | [prev] | [next] | [standalone]
| From | Johannes Weiner <hannes@cmpxchg.org> |
|---|---|
| Date | 2017-03-31 17:00 +0200 |
| Subject | Re: [PATCH -mm -v7 1/9] mm, swap: Make swap cluster size same of THP size on x86_64 |
| Message-ID | <tr6bT-5VY-3@gated-at.bofh.it> |
| In reply to | #1612475 |
On Thu, Mar 30, 2017 at 08:45:56AM +0800, Huang, Ying wrote: > Johannes Weiner <hannes@cmpxchg.org> writes: > > > On Tue, Mar 28, 2017 at 01:32:01PM +0800, Huang, Ying wrote: > >> @@ -499,6 +499,19 @@ config FRONTSWAP > >> > >> If unsure, say Y to enable frontswap. > >> > >> +config ARCH_USES_THP_SWAP_CLUSTER > >> + bool > >> + default n > > > > This is fine. > > > >> +config THP_SWAP_CLUSTER > >> + bool > >> + depends on SWAP && TRANSPARENT_HUGEPAGE && ARCH_USES_THP_SWAP_CLUSTER > >> + default y > >> + help > >> + Use one swap cluster to hold the contents of the THP > >> + (Transparent Huge Page) swapped out. The size of the swap > >> + cluster will be same as that of THP. > > > > But this is a super weird thing to ask the user. How would they know > > what to say, if we don't know? I don't think this should be a config > > knob at all. Merge the two config items into a simple > > The user will not see this, because there is no string after "bool" to > let user to select it. The help here is for document only, so that > architecture developers could know what this is for. Oh, I missed that. My bad! > > config THP_SWAP_CLUSTER > > bool > > default n > > > > and let the archs with reasonable THP sizes select it. > > This will have same effect as the original solution except the document > is removed. Then I still don't understand why we need two config symbols. Can't archs select the documented THP_SWAP_CLUSTER directly? The #ifdef in swapfile.c could check THP && THP_SWAP_CLUSTER. Am I missing something?
[toc] | [prev] | [next] | [standalone]
| From | "Huang\, Ying" <ying.huang@intel.com> |
|---|---|
| Date | 2017-04-01 05:30 +0200 |
| Message-ID | <trhTH-5sS-1@gated-at.bofh.it> |
| In reply to | #1614084 |
Johannes Weiner <hannes@cmpxchg.org> writes: > On Thu, Mar 30, 2017 at 08:45:56AM +0800, Huang, Ying wrote: >> Johannes Weiner <hannes@cmpxchg.org> writes: >> >> > On Tue, Mar 28, 2017 at 01:32:01PM +0800, Huang, Ying wrote: >> >> @@ -499,6 +499,19 @@ config FRONTSWAP >> >> >> >> If unsure, say Y to enable frontswap. >> >> >> >> +config ARCH_USES_THP_SWAP_CLUSTER >> >> + bool >> >> + default n >> > >> > This is fine. >> > >> >> +config THP_SWAP_CLUSTER >> >> + bool >> >> + depends on SWAP && TRANSPARENT_HUGEPAGE && ARCH_USES_THP_SWAP_CLUSTER >> >> + default y >> >> + help >> >> + Use one swap cluster to hold the contents of the THP >> >> + (Transparent Huge Page) swapped out. The size of the swap >> >> + cluster will be same as that of THP. >> > >> > But this is a super weird thing to ask the user. How would they know >> > what to say, if we don't know? I don't think this should be a config >> > knob at all. Merge the two config items into a simple >> >> The user will not see this, because there is no string after "bool" to >> let user to select it. The help here is for document only, so that >> architecture developers could know what this is for. > > Oh, I missed that. My bad! > >> > config THP_SWAP_CLUSTER >> > bool >> > default n >> > >> > and let the archs with reasonable THP sizes select it. >> >> This will have same effect as the original solution except the document >> is removed. > > Then I still don't understand why we need two config symbols. Can't > archs select the documented THP_SWAP_CLUSTER directly? > > The #ifdef in swapfile.c could check THP && THP_SWAP_CLUSTER. > > Am I missing something? I use two config symbols just to save some typing, instead of #ifdef CONFIG_THP_SWAP_CLUSTER it will be, #if defined(CONFIG_TRANSPARENT_HUGEPAGE) && defined(CONFIG_THP_SWAP_CLUSTER) or #if defined(CONFIG_SWAP) && defined(CONFIG_TRANSPARENT_HUGEPAGE) && defined(CONFIG_THP_SWAP_CLUSTER) Best Regards, Huang, Ying
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web