All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] hanging swapoff with HAVE_ARCH_SOFT_DIRTY=y
@ 2015-09-14  9:24 Martin Schwidefsky
  2015-09-14  9:24 ` [PATCH] mm/swapfile: mm/swapfile: fix swapoff vs. software dirty bits Martin Schwidefsky
  0 siblings, 1 reply; 4+ messages in thread
From: Martin Schwidefsky @ 2015-09-14  9:24 UTC (permalink / raw)
  To: Cyrill Gorcunov, Andrew Morton, Michal Hocko; +Cc: linux-mm, Martin Schwidefsky

Greetings,

while implementing software dirty bits for s390 we noticed that the swapoff
command at shutdown caused the system to hang. After some debugging I found
the maybe_same_pte() function to be the cause of this.

The bug shows up for any configuration with CONFIG_HAVE_ARCH_SOFT_DIRTY=y
and CONFIG_MEM_SOFT_DIRTY=n. Currently this affects x86_64 only.

Martin Schwidefsky (1):
  mm/swapfile: fix swapoff with software dirty bits enabled

 mm/swapfile.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

-- 
1.9.1

--
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>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH] mm/swapfile: mm/swapfile: fix swapoff vs. software dirty bits
  2015-09-14  9:24 [PATCH] hanging swapoff with HAVE_ARCH_SOFT_DIRTY=y Martin Schwidefsky
@ 2015-09-14  9:24 ` Martin Schwidefsky
  2015-12-17 16:08   ` Cyrill Gorcunov
  0 siblings, 1 reply; 4+ messages in thread
From: Martin Schwidefsky @ 2015-09-14  9:24 UTC (permalink / raw)
  To: Cyrill Gorcunov, Andrew Morton, Michal Hocko; +Cc: linux-mm, Martin Schwidefsky

Fixes a regression introduced with commit 179ef71cbc085252
"mm: save soft-dirty bits on swapped pages"

The maybe_same_pte() function is used to match a swap pte independent
of the swap software dirty bit set with pte_swp_mksoft_dirty().

For CONFIG_HAVE_ARCH_SOFT_DIRTY=y but CONFIG_MEM_SOFT_DIRTY=n the
software dirty bit may be set but maybe_same_pte() will not recognize
a software dirty swap pte. Due to this a 'swapoff -a' will hang.

The straightforward solution is to replace CONFIG_MEM_SOFT_DIRTY
with HAVE_ARCH_SOFT_DIRTY in maybe_same_pte().

Cc: linux-mm@kvack.org
Cc: Cyrill Gorcunov <gorcunov@gmail.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Michal Hocko <mhocko@suse.cz>
Reported-by: Sebastian Ott <sebott@linux.vnet.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
---
 mm/swapfile.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mm/swapfile.c b/mm/swapfile.c
index 5887731..bf7da58 100644
--- a/mm/swapfile.c
+++ b/mm/swapfile.c
@@ -1113,7 +1113,7 @@ unsigned int count_swap_pages(int type, int free)
 
 static inline int maybe_same_pte(pte_t pte, pte_t swp_pte)
 {
-#ifdef CONFIG_MEM_SOFT_DIRTY
+#ifdef CONFIG_HAVE_ARCH_SOFT_DIRTY
 	/*
 	 * When pte keeps soft dirty bit the pte generated
 	 * from swap entry does not has it, still it's same
-- 
1.9.1

--
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>

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] mm/swapfile: mm/swapfile: fix swapoff vs. software dirty bits
  2015-09-14  9:24 ` [PATCH] mm/swapfile: mm/swapfile: fix swapoff vs. software dirty bits Martin Schwidefsky
@ 2015-12-17 16:08   ` Cyrill Gorcunov
  2015-12-18  7:41     ` Martin Schwidefsky
  0 siblings, 1 reply; 4+ messages in thread
From: Cyrill Gorcunov @ 2015-12-17 16:08 UTC (permalink / raw)
  To: Martin Schwidefsky
  Cc: Andrew Morton, Michal Hocko, Linux Memory Management List

On Mon, Sep 14, 2015 at 12:24 PM, Martin Schwidefsky
<schwidefsky@de.ibm.com> wrote:
> Fixes a regression introduced with commit 179ef71cbc085252
> "mm: save soft-dirty bits on swapped pages"
>
> The maybe_same_pte() function is used to match a swap pte independent
> of the swap software dirty bit set with pte_swp_mksoft_dirty().
>
> For CONFIG_HAVE_ARCH_SOFT_DIRTY=y but CONFIG_MEM_SOFT_DIRTY=n the
> software dirty bit may be set but maybe_same_pte() will not recognize
> a software dirty swap pte. Due to this a 'swapoff -a' will hang.
>
> The straightforward solution is to replace CONFIG_MEM_SOFT_DIRTY
> with HAVE_ARCH_SOFT_DIRTY in maybe_same_pte().
>
> Cc: linux-mm@kvack.org
> Cc: Cyrill Gorcunov <gorcunov@gmail.com>
> Cc: Andrew Morton <akpm@linux-foundation.org>
> Cc: Michal Hocko <mhocko@suse.cz>
> Reported-by: Sebastian Ott <sebott@linux.vnet.ibm.com>
> Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>

We've been discussing this already
http://comments.gmane.org/gmane.linux.kernel.mm/138664

--
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>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] mm/swapfile: mm/swapfile: fix swapoff vs. software dirty bits
  2015-12-17 16:08   ` Cyrill Gorcunov
@ 2015-12-18  7:41     ` Martin Schwidefsky
  0 siblings, 0 replies; 4+ messages in thread
From: Martin Schwidefsky @ 2015-12-18  7:41 UTC (permalink / raw)
  To: Cyrill Gorcunov; +Cc: Andrew Morton, Michal Hocko, Linux Memory Management List

On Thu, 17 Dec 2015 19:08:46 +0300
Cyrill Gorcunov <gorcunov@gmail.com> wrote:

> On Mon, Sep 14, 2015 at 12:24 PM, Martin Schwidefsky
> <schwidefsky@de.ibm.com> wrote:
> > Fixes a regression introduced with commit 179ef71cbc085252
> > "mm: save soft-dirty bits on swapped pages"
> >
> > The maybe_same_pte() function is used to match a swap pte independent
> > of the swap software dirty bit set with pte_swp_mksoft_dirty().
> >
> > For CONFIG_HAVE_ARCH_SOFT_DIRTY=y but CONFIG_MEM_SOFT_DIRTY=n the
> > software dirty bit may be set but maybe_same_pte() will not recognize
> > a software dirty swap pte. Due to this a 'swapoff -a' will hang.
> >
> > The straightforward solution is to replace CONFIG_MEM_SOFT_DIRTY
> > with HAVE_ARCH_SOFT_DIRTY in maybe_same_pte().
> >
> > Cc: linux-mm@kvack.org
> > Cc: Cyrill Gorcunov <gorcunov@gmail.com>
> > Cc: Andrew Morton <akpm@linux-foundation.org>
> > Cc: Michal Hocko <mhocko@suse.cz>
> > Reported-by: Sebastian Ott <sebott@linux.vnet.ibm.com>
> > Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
> 
> We've been discussing this already
> http://comments.gmane.org/gmane.linux.kernel.mm/138664
 
Yes indeed. I'm still trying to find out how this mail has been
sent a second time. That was not intentional, sorry for the noise.

-- 
blue skies,
   Martin.

"Reality continues to ruin my life." - Calvin.

--
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>

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2015-12-18  7:41 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-09-14  9:24 [PATCH] hanging swapoff with HAVE_ARCH_SOFT_DIRTY=y Martin Schwidefsky
2015-09-14  9:24 ` [PATCH] mm/swapfile: mm/swapfile: fix swapoff vs. software dirty bits Martin Schwidefsky
2015-12-17 16:08   ` Cyrill Gorcunov
2015-12-18  7:41     ` Martin Schwidefsky

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.