Merge branch 'hfi1' into k.o/for-4.14
[sfrench/cifs-2.6.git] / mm / swap_slots.c
index 90c1032a8ac30ef15af2766d28ccbe0ba3fa2217..13a174006b91234c395d186e6bc9e77319470be0 100644 (file)
@@ -273,11 +273,11 @@ int free_swap_slot(swp_entry_t entry)
 {
        struct swap_slots_cache *cache;
 
-       cache = &get_cpu_var(swp_slots);
+       cache = raw_cpu_ptr(&swp_slots);
        if (use_swap_slot_cache && cache->slots_ret) {
                spin_lock_irq(&cache->free_lock);
                /* Swap slots cache may be deactivated before acquiring lock */
-               if (!use_swap_slot_cache) {
+               if (!use_swap_slot_cache || !cache->slots_ret) {
                        spin_unlock_irq(&cache->free_lock);
                        goto direct_free;
                }
@@ -297,7 +297,6 @@ int free_swap_slot(swp_entry_t entry)
 direct_free:
                swapcache_free_entries(&entry, 1);
        }
-       put_cpu_var(swp_slots);
 
        return 0;
 }