All of lore.kernel.org
 help / color / mirror / Atom feed
From: Catalin Marinas <catalin.marinas@arm.com>
To: Barry Song <21cnbao@gmail.com>
Cc: akpm@linux-foundation.org, will@kernel.org, linux-mm@kvack.org,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org, hanchuanhua@oppo.com,
	zhangshiming@oppo.com, guojian@oppo.com,
	Barry Song <v-songbaohua@oppo.com>,
	"Huang, Ying" <ying.huang@intel.com>,
	Minchan Kim <minchan@kernel.org>,
	Johannes Weiner <hannes@cmpxchg.org>,
	Hugh Dickins <hughd@google.com>, Shaohua Li <shli@kernel.org>,
	Rik van Riel <riel@redhat.com>,
	Andrea Arcangeli <aarcange@redhat.com>,
	Steven Price <steven.price@arm.com>
Subject: Re: [PATCH] arm64: enable THP_SWAP for arm64
Date: Tue, 24 May 2022 09:12:09 +0100	[thread overview]
Message-ID: <YoyTWaDmSiBUkaeg@arm.com> (raw)
In-Reply-To: <20220524071403.128644-1-21cnbao@gmail.com>

On Tue, May 24, 2022 at 07:14:03PM +1200, Barry Song wrote:
> From: Barry Song <v-songbaohua@oppo.com>
> 
> THP_SWAP has been proved to improve the swap throughput significantly
> on x86_64 according to commit bd4c82c22c367e ("mm, THP, swap: delay
> splitting THP after swapped out").
> As long as arm64 uses 4K page size, it is quite similar with x86_64
> by having 2MB PMD THP. So we are going to get similar improvement.
> For other page sizes such as 16KB and 64KB, PMD might be too large.
> Negative side effects such as IO latency might be a problem. Thus,
> we can only safely enable the counterpart of X86_64.
> 
> Cc: "Huang, Ying" <ying.huang@intel.com>
> Cc: Minchan Kim <minchan@kernel.org>
> Cc: Johannes Weiner <hannes@cmpxchg.org>
> Cc: Hugh Dickins <hughd@google.com>
> Cc: Shaohua Li <shli@kernel.org>
> Cc: Rik van Riel <riel@redhat.com>
> Cc: Andrea Arcangeli <aarcange@redhat.com>
> Signed-off-by: Barry Song <v-songbaohua@oppo.com>
> ---
>  arch/arm64/Kconfig | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig
> index d550f5acfaf3..8e3771c56fbf 100644
> --- a/arch/arm64/Kconfig
> +++ b/arch/arm64/Kconfig
> @@ -98,6 +98,7 @@ config ARM64
>  	select ARCH_WANT_HUGE_PMD_SHARE if ARM64_4K_PAGES || (ARM64_16K_PAGES && !ARM64_VA_BITS_36)
>  	select ARCH_WANT_LD_ORPHAN_WARN
>  	select ARCH_WANTS_NO_INSTR
> +	select ARCH_WANTS_THP_SWAP if ARM64_4K_PAGES

I'm not opposed to this but I think it would break pages mapped with
PROT_MTE. We have an assumption in mte_sync_tags() that compound pages
are not swapped out (or in). With MTE, we store the tags in a slab
object (128-bytes per swapped page) and restore them when pages are
swapped in. At some point we may teach the core swap code about such
metadata but in the meantime that was the easiest way.

-- 
Catalin

WARNING: multiple messages have this Message-ID (diff)
From: Catalin Marinas <catalin.marinas@arm.com>
To: Barry Song <21cnbao@gmail.com>
Cc: akpm@linux-foundation.org, will@kernel.org, linux-mm@kvack.org,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org, hanchuanhua@oppo.com,
	zhangshiming@oppo.com, guojian@oppo.com,
	Barry Song <v-songbaohua@oppo.com>,
	"Huang, Ying" <ying.huang@intel.com>,
	Minchan Kim <minchan@kernel.org>,
	Johannes Weiner <hannes@cmpxchg.org>,
	Hugh Dickins <hughd@google.com>, Shaohua Li <shli@kernel.org>,
	Rik van Riel <riel@redhat.com>,
	Andrea Arcangeli <aarcange@redhat.com>,
	Steven Price <steven.price@arm.com>
Subject: Re: [PATCH] arm64: enable THP_SWAP for arm64
Date: Tue, 24 May 2022 09:12:09 +0100	[thread overview]
Message-ID: <YoyTWaDmSiBUkaeg@arm.com> (raw)
In-Reply-To: <20220524071403.128644-1-21cnbao@gmail.com>

On Tue, May 24, 2022 at 07:14:03PM +1200, Barry Song wrote:
> From: Barry Song <v-songbaohua@oppo.com>
> 
> THP_SWAP has been proved to improve the swap throughput significantly
> on x86_64 according to commit bd4c82c22c367e ("mm, THP, swap: delay
> splitting THP after swapped out").
> As long as arm64 uses 4K page size, it is quite similar with x86_64
> by having 2MB PMD THP. So we are going to get similar improvement.
> For other page sizes such as 16KB and 64KB, PMD might be too large.
> Negative side effects such as IO latency might be a problem. Thus,
> we can only safely enable the counterpart of X86_64.
> 
> Cc: "Huang, Ying" <ying.huang@intel.com>
> Cc: Minchan Kim <minchan@kernel.org>
> Cc: Johannes Weiner <hannes@cmpxchg.org>
> Cc: Hugh Dickins <hughd@google.com>
> Cc: Shaohua Li <shli@kernel.org>
> Cc: Rik van Riel <riel@redhat.com>
> Cc: Andrea Arcangeli <aarcange@redhat.com>
> Signed-off-by: Barry Song <v-songbaohua@oppo.com>
> ---
>  arch/arm64/Kconfig | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig
> index d550f5acfaf3..8e3771c56fbf 100644
> --- a/arch/arm64/Kconfig
> +++ b/arch/arm64/Kconfig
> @@ -98,6 +98,7 @@ config ARM64
>  	select ARCH_WANT_HUGE_PMD_SHARE if ARM64_4K_PAGES || (ARM64_16K_PAGES && !ARM64_VA_BITS_36)
>  	select ARCH_WANT_LD_ORPHAN_WARN
>  	select ARCH_WANTS_NO_INSTR
> +	select ARCH_WANTS_THP_SWAP if ARM64_4K_PAGES

I'm not opposed to this but I think it would break pages mapped with
PROT_MTE. We have an assumption in mte_sync_tags() that compound pages
are not swapped out (or in). With MTE, we store the tags in a slab
object (128-bytes per swapped page) and restore them when pages are
swapped in. At some point we may teach the core swap code about such
metadata but in the meantime that was the easiest way.

-- 
Catalin

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  reply	other threads:[~2022-05-24  8:12 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-24  7:14 [PATCH] arm64: enable THP_SWAP for arm64 Barry Song
2022-05-24  7:14 ` Barry Song
2022-05-24  8:12 ` Catalin Marinas [this message]
2022-05-24  8:12   ` Catalin Marinas
2022-05-24 10:05   ` Barry Song
2022-05-24 10:05     ` Barry Song
2022-05-24 11:15     ` Barry Song
2022-05-24 11:15       ` Barry Song
2022-05-26  8:13       ` Anshuman Khandual
2022-05-26  8:13         ` Anshuman Khandual
2022-05-24 19:14     ` Catalin Marinas
2022-05-24 19:14       ` Catalin Marinas
2022-05-25 11:10       ` Barry Song
2022-05-25 11:10         ` Barry Song
2022-05-25 16:54         ` Catalin Marinas
2022-05-25 16:54           ` Catalin Marinas
2022-05-25 17:49         ` Yang Shi
2022-05-25 17:49           ` Yang Shi
2022-05-26  9:19           ` Barry Song
2022-05-26  9:19             ` Barry Song
2022-05-26 17:02             ` Yang Shi
2022-05-26 17:02               ` Yang Shi
2022-05-27  7:29               ` Barry Song
2022-05-27  7:29                 ` Barry Song

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YoyTWaDmSiBUkaeg@arm.com \
    --to=catalin.marinas@arm.com \
    --cc=21cnbao@gmail.com \
    --cc=aarcange@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=guojian@oppo.com \
    --cc=hanchuanhua@oppo.com \
    --cc=hannes@cmpxchg.org \
    --cc=hughd@google.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=minchan@kernel.org \
    --cc=riel@redhat.com \
    --cc=shli@kernel.org \
    --cc=steven.price@arm.com \
    --cc=v-songbaohua@oppo.com \
    --cc=will@kernel.org \
    --cc=ying.huang@intel.com \
    --cc=zhangshiming@oppo.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.