Skip to content

Commit b1e1ef3

Browse files
yang-shitorvalds
authored andcommitted
Revert "mm/shmem: fix shmem_swapin() race with swapoff"
Due to the change about how block layer detects congestion the justification of commit 8fd2e0b ("mm: swap: check if swap backing device is congested or not") doesn't stand anymore, so the commit could be just reverted in order to solve the race reported by commit 2efa33f ("mm/shmem: fix shmem_swapin() race with swapoff"), so the fix commit could be just reverted as well. And that fix is also kind of buggy as discussed by [1] and [2]. [1] https://lore.kernel.org/linux-mm/[email protected]/ [2] https://lore.kernel.org/linux-mm/[email protected]/ Link: https://lkml.kernel.org/r/[email protected] Signed-off-by: Yang Shi <[email protected]> Suggested-by: Hugh Dickins <[email protected]> Acked-by: Hugh Dickins <[email protected]> Cc: "Huang, Ying" <[email protected]> Cc: Miaohe Lin <[email protected]> Cc: David Hildenbrand <[email protected]> Cc: Johannes Weiner <[email protected]> Cc: Joonsoo Kim <[email protected]> Cc: Matthew Wilcox (Oracle) <[email protected]> Cc: Michal Hocko <[email protected]> Cc: Minchan Kim <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
1 parent 614cb27 commit b1e1ef3

File tree

1 file changed

+1
-13
lines changed

1 file changed

+1
-13
lines changed

mm/shmem.c

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1696,21 +1696,14 @@ static int shmem_swapin_page(struct inode *inode, pgoff_t index,
16961696
struct address_space *mapping = inode->i_mapping;
16971697
struct shmem_inode_info *info = SHMEM_I(inode);
16981698
struct mm_struct *charge_mm = vma ? vma->vm_mm : NULL;
1699-
struct swap_info_struct *si;
1700-
struct page *page = NULL;
1699+
struct page *page;
17011700
swp_entry_t swap;
17021701
int error;
17031702

17041703
VM_BUG_ON(!*pagep || !xa_is_value(*pagep));
17051704
swap = radix_to_swp_entry(*pagep);
17061705
*pagep = NULL;
17071706

1708-
/* Prevent swapoff from happening to us. */
1709-
si = get_swap_device(swap);
1710-
if (!si) {
1711-
error = EINVAL;
1712-
goto failed;
1713-
}
17141707
/* Look it up and read it in.. */
17151708
page = lookup_swap_cache(swap, NULL, 0);
17161709
if (!page) {
@@ -1772,8 +1765,6 @@ static int shmem_swapin_page(struct inode *inode, pgoff_t index,
17721765
swap_free(swap);
17731766

17741767
*pagep = page;
1775-
if (si)
1776-
put_swap_device(si);
17771768
return 0;
17781769
failed:
17791770
if (!shmem_confirm_swap(mapping, index, swap))
@@ -1784,9 +1775,6 @@ static int shmem_swapin_page(struct inode *inode, pgoff_t index,
17841775
put_page(page);
17851776
}
17861777

1787-
if (si)
1788-
put_swap_device(si);
1789-
17901778
return error;
17911779
}
17921780

0 commit comments

Comments
 (0)