+ mm-swap-simplify-total_swapcache_pages-with-get_swap_device-fix.patch added to -mm tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The patch titled
     Subject: mm, swap: fix bad swap file entry warning
has been added to the -mm tree.  Its filename is
     mm-swap-simplify-total_swapcache_pages-with-get_swap_device-fix.patch

This patch should soon appear at
    http://ozlabs.org/~akpm/mmots/broken-out/mm-swap-simplify-total_swapcache_pages-with-get_swap_device-fix.patch
and later at
    http://ozlabs.org/~akpm/mmotm/broken-out/mm-swap-simplify-total_swapcache_pages-with-get_swap_device-fix.patch

Before you just go and hit "reply", please:
   a) Consider who else should be cc'ed
   b) Prefer to cc a suitable mailing list as well
   c) Ideally: find the original patch on the mailing list and do a
      reply-to-all to that, adding suitable additional cc's

*** Remember to use Documentation/process/submit-checklist.rst when testing your code ***

The -mm tree is included into linux-next and is updated
there every 3-4 working days

------------------------------------------------------
From: Huang Ying <ying.huang@xxxxxxxxx>
Subject: mm, swap: fix bad swap file entry warning

Mike reported the following warning messages

  get_swap_device: Bad swap file entry 1400000000000001

This is produced by

- total_swapcache_pages()
  - get_swap_device()

Where get_swap_device() is used to check whether the swap device is
valid and prevent it from being swapoff if so.  But get_swap_device()
may produce warning message as above for some invalid swap devices.
This is fixed via calling swp_swap_info() before get_swap_device() to
filter out the swap devices that may cause warning messages.

Link: http://lkml.kernel.org/r/20190531024102.21723-1-ying.huang@xxxxxxxxx
Fixes: 6a946753dbe6 ("mm/swap_state.c: simplify total_swapcache_pages() with get_swap_device()")
Signed-off-by: "Huang, Ying" <ying.huang@xxxxxxxxx>
Tested-by: Mike Kravetz <mike.kravetz@xxxxxxxxxx>
Cc: Andrea Parri <andrea.parri@xxxxxxxxxxxxxxxxxxxx>
Cc: Paul E. McKenney <paulmck@xxxxxxxxxxxxxxxxxx>
Cc: Michal Hocko <mhocko@xxxxxxxx>
Cc: Minchan Kim <minchan@xxxxxxxxxx>
Cc: Hugh Dickins <hughd@xxxxxxxxxx>
Cc: Stephen Rothwell <sfr@xxxxxxxxxxxxxxxx>
Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
---

 mm/swap_state.c |    7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

--- a/mm/swap_state.c~mm-swap-simplify-total_swapcache_pages-with-get_swap_device-fix
+++ a/mm/swap_state.c
@@ -76,8 +76,13 @@ unsigned long total_swapcache_pages(void
 	struct swap_info_struct *si;
 
 	for (i = 0; i < MAX_SWAPFILES; i++) {
+		swp_entry_t entry = swp_entry(i, 1);
+
+		/* Avoid get_swap_device() to warn for bad swap entry */
+		if (!swp_swap_info(entry))
+			continue;
 		/* Prevent swapoff to free swapper_spaces */
-		si = get_swap_device(swp_entry(i, 1));
+		si = get_swap_device(entry);
 		if (!si)
 			continue;
 		nr = nr_swapper_spaces[i];
_

Patches currently in -mm which might be from ying.huang@xxxxxxxxx are

mm-swap-fix-race-between-swapoff-and-some-swap-operations.patch
mm-swap-simplify-total_swapcache_pages-with-get_swap_device.patch
mm-swap-simplify-total_swapcache_pages-with-get_swap_device-fix.patch




[Index of Archives]     [Kernel Archive]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]

  Powered by Linux