Message ID | 20170623071303.13469-5-ying.huang@intel.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
diff --git a/mm/swapfile.c b/mm/swapfile.c index c5d2ab1416a2..d3329b209d12 100644 --- a/mm/swapfile.c +++ b/mm/swapfile.c @@ -948,9 +948,10 @@ int get_swap_pages(int n_goal, bool cluster, swp_entry_t swp_entries[]) spin_unlock(&si->lock); goto nextsi; } - if (cluster) - n_ret = swap_alloc_cluster(si, swp_entries); - else + if (cluster) { + if (!(si->flags & SWP_FILE)) + n_ret = swap_alloc_cluster(si, swp_entries); + } else n_ret = scan_swap_map_slots(si, SWAP_HAS_CACHE, n_goal, swp_entries); spin_unlock(&si->lock);