mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-08-26 02:39:48 +00:00
Revert "swap: fix do_swap_page() race with swapoff"
This reverts commit8e4af3917b
which is commit2799e77529
upstream. It should not have been added to the stable trees, sorry about that. Link: https://lore.kernel.org/r/YPVgaY6uw59Fqg5x@casper.infradead.org Reported-by: From: Matthew Wilcox <willy@infradead.org> Cc: Miaohe Lin <linmiaohe@huawei.com> Cc: Ying Huang <ying.huang@intel.com> Cc: Alex Shi <alexs@kernel.org> Cc: David Hildenbrand <david@redhat.com> Cc: Dennis Zhou <dennis@kernel.org> Cc: Hugh Dickins <hughd@google.com> Cc: Johannes Weiner <hannes@cmpxchg.org> Cc: Joonsoo Kim <iamjoonsoo.kim@lge.com> Cc: Matthew Wilcox <willy@infradead.org> Cc: Michal Hocko <mhocko@suse.com> Cc: Minchan Kim <minchan@kernel.org> Cc: Tim Chen <tim.c.chen@linux.intel.com> Cc: Wei Yang <richard.weiyang@gmail.com> Cc: Yang Shi <shy828301@gmail.com> Cc: Yu Zhao <yuzhao@google.com> Cc: Andrew Morton <akpm@linux-foundation.org> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Sasha Levin <sashal@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
d92aa22f24
commit
277b311ae1
2 changed files with 2 additions and 18 deletions
|
@ -503,15 +503,6 @@ static inline struct swap_info_struct *swp_swap_info(swp_entry_t entry)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline struct swap_info_struct *get_swap_device(swp_entry_t entry)
|
|
||||||
{
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline void put_swap_device(struct swap_info_struct *si)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
#define swap_address_space(entry) (NULL)
|
#define swap_address_space(entry) (NULL)
|
||||||
#define get_nr_swap_pages() 0L
|
#define get_nr_swap_pages() 0L
|
||||||
#define total_swap_pages 0L
|
#define total_swap_pages 0L
|
||||||
|
|
11
mm/memory.c
11
mm/memory.c
|
@ -3302,7 +3302,6 @@ vm_fault_t do_swap_page(struct vm_fault *vmf)
|
||||||
{
|
{
|
||||||
struct vm_area_struct *vma = vmf->vma;
|
struct vm_area_struct *vma = vmf->vma;
|
||||||
struct page *page = NULL, *swapcache;
|
struct page *page = NULL, *swapcache;
|
||||||
struct swap_info_struct *si = NULL;
|
|
||||||
swp_entry_t entry;
|
swp_entry_t entry;
|
||||||
pte_t pte;
|
pte_t pte;
|
||||||
int locked;
|
int locked;
|
||||||
|
@ -3330,16 +3329,14 @@ vm_fault_t do_swap_page(struct vm_fault *vmf)
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Prevent swapoff from happening to us. */
|
|
||||||
si = get_swap_device(entry);
|
|
||||||
if (unlikely(!si))
|
|
||||||
goto out;
|
|
||||||
|
|
||||||
delayacct_set_flag(DELAYACCT_PF_SWAPIN);
|
delayacct_set_flag(DELAYACCT_PF_SWAPIN);
|
||||||
page = lookup_swap_cache(entry, vma, vmf->address);
|
page = lookup_swap_cache(entry, vma, vmf->address);
|
||||||
swapcache = page;
|
swapcache = page;
|
||||||
|
|
||||||
if (!page) {
|
if (!page) {
|
||||||
|
struct swap_info_struct *si = swp_swap_info(entry);
|
||||||
|
|
||||||
if (data_race(si->flags & SWP_SYNCHRONOUS_IO) &&
|
if (data_race(si->flags & SWP_SYNCHRONOUS_IO) &&
|
||||||
__swap_count(entry) == 1) {
|
__swap_count(entry) == 1) {
|
||||||
/* skip swapcache */
|
/* skip swapcache */
|
||||||
|
@ -3510,8 +3507,6 @@ vm_fault_t do_swap_page(struct vm_fault *vmf)
|
||||||
unlock:
|
unlock:
|
||||||
pte_unmap_unlock(vmf->pte, vmf->ptl);
|
pte_unmap_unlock(vmf->pte, vmf->ptl);
|
||||||
out:
|
out:
|
||||||
if (si)
|
|
||||||
put_swap_device(si);
|
|
||||||
return ret;
|
return ret;
|
||||||
out_nomap:
|
out_nomap:
|
||||||
pte_unmap_unlock(vmf->pte, vmf->ptl);
|
pte_unmap_unlock(vmf->pte, vmf->ptl);
|
||||||
|
@ -3523,8 +3518,6 @@ vm_fault_t do_swap_page(struct vm_fault *vmf)
|
||||||
unlock_page(swapcache);
|
unlock_page(swapcache);
|
||||||
put_page(swapcache);
|
put_page(swapcache);
|
||||||
}
|
}
|
||||||
if (si)
|
|
||||||
put_swap_device(si);
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue