]> git.kernelconcepts.de Git - karo-tx-linux.git/blobdiff - mm/swap_slots.c
powerpc/44x: Add generic compatible string for I2C EEPROM
[karo-tx-linux.git] / mm / swap_slots.c
index aa1c415f4abd6785ee7ee5d6f3f56ab74cd7bc60..58f6c78f1dad313dc7aa9b2ec31ddab361335fe1 100644 (file)
@@ -31,6 +31,7 @@
 #include <linux/cpumask.h>
 #include <linux/vmalloc.h>
 #include <linux/mutex.h>
+#include <linux/mm.h>
 
 #ifdef CONFIG_SWAP
 
@@ -119,16 +120,18 @@ static int alloc_swap_slot_cache(unsigned int cpu)
 
        /*
         * Do allocation outside swap_slots_cache_mutex
-        * as vzalloc could trigger reclaim and get_swap_page,
+        * as kvzalloc could trigger reclaim and get_swap_page,
         * which can lock swap_slots_cache_mutex.
         */
-       slots = vzalloc(sizeof(swp_entry_t) * SWAP_SLOTS_CACHE_SIZE);
+       slots = kvzalloc(sizeof(swp_entry_t) * SWAP_SLOTS_CACHE_SIZE,
+                        GFP_KERNEL);
        if (!slots)
                return -ENOMEM;
 
-       slots_ret = vzalloc(sizeof(swp_entry_t) * SWAP_SLOTS_CACHE_SIZE);
+       slots_ret = kvzalloc(sizeof(swp_entry_t) * SWAP_SLOTS_CACHE_SIZE,
+                            GFP_KERNEL);
        if (!slots_ret) {
-               vfree(slots);
+               kvfree(slots);
                return -ENOMEM;
        }
 
@@ -152,9 +155,9 @@ static int alloc_swap_slot_cache(unsigned int cpu)
 out:
        mutex_unlock(&swap_slots_cache_mutex);
        if (slots)
-               vfree(slots);
+               kvfree(slots);
        if (slots_ret)
-               vfree(slots_ret);
+               kvfree(slots_ret);
        return 0;
 }
 
@@ -171,7 +174,7 @@ static void drain_slots_cache_cpu(unsigned int cpu, unsigned int type,
                cache->cur = 0;
                cache->nr = 0;
                if (free_slots && cache->slots) {
-                       vfree(cache->slots);
+                       kvfree(cache->slots);
                        cache->slots = NULL;
                }
                mutex_unlock(&cache->alloc_lock);
@@ -186,7 +189,7 @@ static void drain_slots_cache_cpu(unsigned int cpu, unsigned int type,
                }
                spin_unlock_irq(&cache->free_lock);
                if (slots)
-                       vfree(slots);
+                       kvfree(slots);
        }
 }