diff options
Diffstat (limited to 'mm')
-rw-r--r-- | mm/memory.c | 4 | ||||
-rw-r--r-- | mm/rmap.c | 3 |
2 files changed, 5 insertions, 2 deletions
diff --git a/mm/memory.c b/mm/memory.c index e9ef599498b5..d68421dd64ef 100644 --- a/mm/memory.c +++ b/mm/memory.c | |||
@@ -372,7 +372,9 @@ copy_one_pte(struct mm_struct *dst_mm, struct mm_struct *src_mm, | |||
372 | /* make sure dst_mm is on swapoff's mmlist. */ | 372 | /* make sure dst_mm is on swapoff's mmlist. */ |
373 | if (unlikely(list_empty(&dst_mm->mmlist))) { | 373 | if (unlikely(list_empty(&dst_mm->mmlist))) { |
374 | spin_lock(&mmlist_lock); | 374 | spin_lock(&mmlist_lock); |
375 | list_add(&dst_mm->mmlist, &src_mm->mmlist); | 375 | if (list_empty(&dst_mm->mmlist)) |
376 | list_add(&dst_mm->mmlist, | ||
377 | &src_mm->mmlist); | ||
376 | spin_unlock(&mmlist_lock); | 378 | spin_unlock(&mmlist_lock); |
377 | } | 379 | } |
378 | } | 380 | } |
@@ -559,7 +559,8 @@ static int try_to_unmap_one(struct page *page, struct vm_area_struct *vma) | |||
559 | swap_duplicate(entry); | 559 | swap_duplicate(entry); |
560 | if (list_empty(&mm->mmlist)) { | 560 | if (list_empty(&mm->mmlist)) { |
561 | spin_lock(&mmlist_lock); | 561 | spin_lock(&mmlist_lock); |
562 | list_add(&mm->mmlist, &init_mm.mmlist); | 562 | if (list_empty(&mm->mmlist)) |
563 | list_add(&mm->mmlist, &init_mm.mmlist); | ||
563 | spin_unlock(&mmlist_lock); | 564 | spin_unlock(&mmlist_lock); |
564 | } | 565 | } |
565 | set_pte_at(mm, address, pte, swp_entry_to_pte(entry)); | 566 | set_pte_at(mm, address, pte, swp_entry_to_pte(entry)); |