stable.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Patch "mm, swap: fix false error message in __swp_swapcount()" has been added to the 4.13-stable tree
@ 2017-11-22  8:39 gregkh
  2017-11-22  9:29 ` Greg KH
  0 siblings, 1 reply; 2+ messages in thread
From: gregkh @ 2017-11-22  8:39 UTC (permalink / raw)
  To: huang.ying.caritas, akpm, gregkh, hughd, lists, mhocko, minchan,
	tim.c.chen, torvalds, ying.huang
  Cc: stable, stable-commits


This is a note to let you know that I've just added the patch titled

    mm, swap: fix false error message in __swp_swapcount()

to the 4.13-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     mm-swap-fix-false-error-message-in-__swp_swapcount.patch
and it can be found in the queue-4.13 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@vger.kernel.org> know about it.


>From e9a6effa500526e2a19d5ad042cb758b55b1ef93 Mon Sep 17 00:00:00 2001
From: Huang Ying <huang.ying.caritas@gmail.com>
Date: Wed, 15 Nov 2017 17:33:15 -0800
Subject: mm, swap: fix false error message in __swp_swapcount()

From: Huang Ying <huang.ying.caritas@gmail.com>

commit e9a6effa500526e2a19d5ad042cb758b55b1ef93 upstream.

When a page fault occurs for a swap entry, the physical swap readahead
(not the VMA base swap readahead) may readahead several swap entries
after the fault swap entry.  The readahead algorithm calculates some of
the swap entries to readahead via increasing the offset of the fault
swap entry without checking whether they are beyond the end of the swap
device and it relys on the __swp_swapcount() and swapcache_prepare() to
check it.  Although __swp_swapcount() checks for the swap entry passed
in, it will complain with the error message as follow for the expected
invalid swap entry.  This may make the end users confused.

  swap_info_get: Bad swap offset entry 0200f8a7

To fix the false error message, the swap entry checking is added in
swapin_readahead() to avoid to pass the out-of-bound swap entries and
the swap entry reserved for the swap header to __swp_swapcount() and
swapcache_prepare().

Link: http://lkml.kernel.org/r/20171102054225.22897-1-ying.huang@intel.com
Fixes: e8c26ab60598 ("mm/swap: skip readahead for unreferenced swap slots")
Signed-off-by: "Huang, Ying" <ying.huang@intel.com>
Reported-by: Christian Kujau <lists@nerdbynature.de>
Acked-by: Minchan Kim <minchan@kernel.org>
Suggested-by: Minchan Kim <minchan@kernel.org>
Cc: Tim Chen <tim.c.chen@linux.intel.com>
Cc: Michal Hocko <mhocko@suse.com>
Cc: Hugh Dickins <hughd@google.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 mm/swap_state.c |    3 +++
 1 file changed, 3 insertions(+)

--- a/mm/swap_state.c
+++ b/mm/swap_state.c
@@ -506,6 +506,7 @@ struct page *swapin_readahead(swp_entry_
 	unsigned long offset = entry_offset;
 	unsigned long start_offset, end_offset;
 	unsigned long mask;
+	struct swap_info_struct *si = swp_swap_info(entry);
 	struct blk_plug plug;
 	bool do_poll = true;
 
@@ -519,6 +520,8 @@ struct page *swapin_readahead(swp_entry_
 	end_offset = offset | mask;
 	if (!start_offset)	/* First page is swap header. */
 		start_offset++;
+	if (end_offset >= si->max)
+		end_offset = si->max - 1;
 
 	blk_start_plug(&plug);
 	for (offset = start_offset; offset <= end_offset ; offset++) {


Patches currently in stable-queue which might be from huang.ying.caritas@gmail.com are

queue-4.13/mm-swap-fix-false-error-message-in-__swp_swapcount.patch

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

* Re: Patch "mm, swap: fix false error message in __swp_swapcount()" has been added to the 4.13-stable tree
  2017-11-22  8:39 Patch "mm, swap: fix false error message in __swp_swapcount()" has been added to the 4.13-stable tree gregkh
@ 2017-11-22  9:29 ` Greg KH
  0 siblings, 0 replies; 2+ messages in thread
From: Greg KH @ 2017-11-22  9:29 UTC (permalink / raw)
  To: huang.ying.caritas, akpm, hughd, lists, mhocko, minchan,
	tim.c.chen, torvalds, ying.huang
  Cc: stable, stable-commits

On Wed, Nov 22, 2017 at 09:39:26AM +0100, gregkh@linuxfoundation.org wrote:
> 
> This is a note to let you know that I've just added the patch titled
> 
>     mm, swap: fix false error message in __swp_swapcount()
> 
> to the 4.13-stable tree which can be found at:
>     http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary
> 
> The filename of the patch is:
>      mm-swap-fix-false-error-message-in-__swp_swapcount.patch
> and it can be found in the queue-4.13 subdirectory.
> 
> If you, or anyone else, feels it should not be added to the stable tree,
> please let <stable@vger.kernel.org> know about it.

Nope, I have to drop this from 4.13 and 4.14 as it breaks the build.
Can someone please send me a working version if it belongs in those
kernel trees?

thanks,

greg k-h

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

end of thread, other threads:[~2017-11-22  9:29 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-11-22  8:39 Patch "mm, swap: fix false error message in __swp_swapcount()" has been added to the 4.13-stable tree gregkh
2017-11-22  9:29 ` Greg KH

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).