From: "Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com>
To: Hugh Dickins <hughd@google.com>,
Andrew Morton <akpm@linux-foundation.org>
Cc: Cyrill Gorcunov <gorcunov@gmail.com>,
Laurent Dufour <ldufour@linux.vnet.ibm.com>,
Michael Ellerman <mpe@ellerman.id.au>,
Martin Schwidefsky <schwidefsky@de.ibm.com>,
linuxppc-dev@lists.ozlabs.org, linux-mm@kvack.org
Subject: Re: [PATCH next] mm: make swapoff more robust against soft dirty
Date: Mon, 11 Jan 2016 11:09:49 +0530 [thread overview]
Message-ID: <87pox8u122.fsf@linux.vnet.ibm.com> (raw)
In-Reply-To: <alpine.LSU.2.11.1601091656491.9808@eggly.anvils>
Hugh Dickins <hughd@google.com> writes:
> Both s390 and powerpc have hit the issue of swapoff hanging, when
> CONFIG_HAVE_ARCH_SOFT_DIRTY and CONFIG_MEM_SOFT_DIRTY ifdefs were
> not quite as x86_64 had them. I think it would be much clearer if
> HAVE_ARCH_SOFT_DIRTY was just a Kconfig option set by architectures
> to determine whether the MEM_SOFT_DIRTY option should be offered,
> and the actual code depend upon CONFIG_MEM_SOFT_DIRTY alone.
>
> But won't embark on that change myself: instead make swapoff more
> robust, by using pte_swp_clear_soft_dirty() on each pte it encounters,
> without an explicit #ifdef CONFIG_MEM_SOFT_DIRTY. That being a no-op,
> whether the bit in question is defined as 0 or the asm-generic fallback
> is used, unless soft dirty is fully turned on.
>
> Why "maybe" in maybe_same_pte()? Rename it pte_same_as_swp().
>
Ok this also explains, the _PAGE_PTE issue on powerpc you mentioned in the other
email.
Reviewed-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
> Signed-off-by: Hugh Dickins <hughd@google.com>
> ---
>
> mm/swapfile.c | 18 ++++--------------
> 1 file changed, 4 insertions(+), 14 deletions(-)
>
> --- 4.4-next/mm/swapfile.c 2016-01-06 11:54:46.327006983 -0800
> +++ linux/mm/swapfile.c 2016-01-09 13:39:19.632872694 -0800
> @@ -1109,19 +1109,9 @@ unsigned int count_swap_pages(int type,
> }
> #endif /* CONFIG_HIBERNATION */
>
> -static inline int maybe_same_pte(pte_t pte, pte_t swp_pte)
> +static inline int pte_same_as_swp(pte_t pte, pte_t swp_pte)
> {
> -#ifdef CONFIG_MEM_SOFT_DIRTY
> - /*
> - * When pte keeps soft dirty bit the pte generated
> - * from swap entry does not has it, still it's same
> - * pte from logical point of view.
> - */
> - pte_t swp_pte_dirty = pte_swp_mksoft_dirty(swp_pte);
> - return pte_same(pte, swp_pte) || pte_same(pte, swp_pte_dirty);
> -#else
> - return pte_same(pte, swp_pte);
> -#endif
> + return pte_same(pte_swp_clear_soft_dirty(pte), swp_pte);
> }
>
> /*
> @@ -1150,7 +1140,7 @@ static int unuse_pte(struct vm_area_stru
> }
>
> pte = pte_offset_map_lock(vma->vm_mm, pmd, addr, &ptl);
> - if (unlikely(!maybe_same_pte(*pte, swp_entry_to_pte(entry)))) {
> + if (unlikely(!pte_same_as_swp(*pte, swp_entry_to_pte(entry)))) {
> mem_cgroup_cancel_charge(page, memcg, false);
> ret = 0;
> goto out;
> @@ -1208,7 +1198,7 @@ static int unuse_pte_range(struct vm_are
> * swapoff spends a _lot_ of time in this loop!
> * Test inline before going to call unuse_pte.
> */
> - if (unlikely(maybe_same_pte(*pte, swp_pte))) {
> + if (unlikely(pte_same_as_swp(*pte, swp_pte))) {
> pte_unmap(pte);
> ret = unuse_pte(vma, pmd, addr, entry, page);
> if (ret)
WARNING: multiple messages have this Message-ID (diff)
From: "Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com>
To: Hugh Dickins <hughd@google.com>,
Andrew Morton <akpm@linux-foundation.org>
Cc: Cyrill Gorcunov <gorcunov@gmail.com>,
Laurent Dufour <ldufour@linux.vnet.ibm.com>,
Michael Ellerman <mpe@ellerman.id.au>,
Martin Schwidefsky <schwidefsky@de.ibm.com>,
linuxppc-dev@lists.ozlabs.org, linux-mm@kvack.org
Subject: Re: [PATCH next] mm: make swapoff more robust against soft dirty
Date: Mon, 11 Jan 2016 11:09:49 +0530 [thread overview]
Message-ID: <87pox8u122.fsf@linux.vnet.ibm.com> (raw)
In-Reply-To: <alpine.LSU.2.11.1601091656491.9808@eggly.anvils>
Hugh Dickins <hughd@google.com> writes:
> Both s390 and powerpc have hit the issue of swapoff hanging, when
> CONFIG_HAVE_ARCH_SOFT_DIRTY and CONFIG_MEM_SOFT_DIRTY ifdefs were
> not quite as x86_64 had them. I think it would be much clearer if
> HAVE_ARCH_SOFT_DIRTY was just a Kconfig option set by architectures
> to determine whether the MEM_SOFT_DIRTY option should be offered,
> and the actual code depend upon CONFIG_MEM_SOFT_DIRTY alone.
>
> But won't embark on that change myself: instead make swapoff more
> robust, by using pte_swp_clear_soft_dirty() on each pte it encounters,
> without an explicit #ifdef CONFIG_MEM_SOFT_DIRTY. That being a no-op,
> whether the bit in question is defined as 0 or the asm-generic fallback
> is used, unless soft dirty is fully turned on.
>
> Why "maybe" in maybe_same_pte()? Rename it pte_same_as_swp().
>
Ok this also explains, the _PAGE_PTE issue on powerpc you mentioned in the other
email.
Reviewed-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
> Signed-off-by: Hugh Dickins <hughd@google.com>
> ---
>
> mm/swapfile.c | 18 ++++--------------
> 1 file changed, 4 insertions(+), 14 deletions(-)
>
> --- 4.4-next/mm/swapfile.c 2016-01-06 11:54:46.327006983 -0800
> +++ linux/mm/swapfile.c 2016-01-09 13:39:19.632872694 -0800
> @@ -1109,19 +1109,9 @@ unsigned int count_swap_pages(int type,
> }
> #endif /* CONFIG_HIBERNATION */
>
> -static inline int maybe_same_pte(pte_t pte, pte_t swp_pte)
> +static inline int pte_same_as_swp(pte_t pte, pte_t swp_pte)
> {
> -#ifdef CONFIG_MEM_SOFT_DIRTY
> - /*
> - * When pte keeps soft dirty bit the pte generated
> - * from swap entry does not has it, still it's same
> - * pte from logical point of view.
> - */
> - pte_t swp_pte_dirty = pte_swp_mksoft_dirty(swp_pte);
> - return pte_same(pte, swp_pte) || pte_same(pte, swp_pte_dirty);
> -#else
> - return pte_same(pte, swp_pte);
> -#endif
> + return pte_same(pte_swp_clear_soft_dirty(pte), swp_pte);
> }
>
> /*
> @@ -1150,7 +1140,7 @@ static int unuse_pte(struct vm_area_stru
> }
>
> pte = pte_offset_map_lock(vma->vm_mm, pmd, addr, &ptl);
> - if (unlikely(!maybe_same_pte(*pte, swp_entry_to_pte(entry)))) {
> + if (unlikely(!pte_same_as_swp(*pte, swp_entry_to_pte(entry)))) {
> mem_cgroup_cancel_charge(page, memcg, false);
> ret = 0;
> goto out;
> @@ -1208,7 +1198,7 @@ static int unuse_pte_range(struct vm_are
> * swapoff spends a _lot_ of time in this loop!
> * Test inline before going to call unuse_pte.
> */
> - if (unlikely(maybe_same_pte(*pte, swp_pte))) {
> + if (unlikely(pte_same_as_swp(*pte, swp_pte))) {
> pte_unmap(pte);
> ret = unuse_pte(vma, pmd, addr, entry, page);
> if (ret)
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
next prev parent reply other threads:[~2016-01-11 5:40 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-01-10 0:54 [PATCH next] powerpc/mm: fix _PAGE_SWP_SOFT_DIRTY breaking swapoff Hugh Dickins
2016-01-10 0:54 ` Hugh Dickins
2016-01-10 0:59 ` [PATCH next] mm: make swapoff more robust against soft dirty Hugh Dickins
2016-01-10 0:59 ` Hugh Dickins
2016-01-10 14:09 ` Cyrill Gorcunov
2016-01-10 14:09 ` Cyrill Gorcunov
2016-01-11 5:39 ` Aneesh Kumar K.V [this message]
2016-01-11 5:39 ` Aneesh Kumar K.V
2016-01-10 14:07 ` [PATCH next] powerpc/mm: fix _PAGE_SWP_SOFT_DIRTY breaking swapoff Cyrill Gorcunov
2016-01-10 14:07 ` Cyrill Gorcunov
2016-01-11 5:43 ` Aneesh Kumar K.V
2016-01-11 5:43 ` Aneesh Kumar K.V
2016-01-11 6:05 ` Hugh Dickins
2016-01-11 6:05 ` Hugh Dickins
2016-01-11 6:31 ` Aneesh Kumar K.V
2016-01-11 6:31 ` Aneesh Kumar K.V
2016-01-11 7:33 ` Hugh Dickins
2016-01-11 7:33 ` Hugh Dickins
2016-01-11 16:04 ` Laurent Dufour
2016-01-11 16:04 ` Laurent Dufour
2016-01-12 12:32 ` [next] " Michael Ellerman
2016-01-12 12:32 ` Michael Ellerman
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=87pox8u122.fsf@linux.vnet.ibm.com \
--to=aneesh.kumar@linux.vnet.ibm.com \
--cc=akpm@linux-foundation.org \
--cc=gorcunov@gmail.com \
--cc=hughd@google.com \
--cc=ldufour@linux.vnet.ibm.com \
--cc=linux-mm@kvack.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=mpe@ellerman.id.au \
--cc=schwidefsky@de.ibm.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.