]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/blobdiff - mm/swapfile.c
mm, vmalloc: fix vmalloc users tracking properly
[mirror_ubuntu-artful-kernel.git] / mm / swapfile.c
index b86b2aca3fb9b10321ea8f6770c7d10905724b2d..4f6cba1b66322f3500714950ef3a12eeda9e4455 100644 (file)
@@ -2270,8 +2270,8 @@ SYSCALL_DEFINE1(swapoff, const char __user *, specialfile)
        free_percpu(p->percpu_cluster);
        p->percpu_cluster = NULL;
        vfree(swap_map);
-       vfree(cluster_info);
-       vfree(frontswap_map);
+       kvfree(cluster_info);
+       kvfree(frontswap_map);
        /* Destroy swap account information */
        swap_cgroup_swapoff(p->type);
        exit_swap_address_space(p->type);
@@ -2794,7 +2794,8 @@ SYSCALL_DEFINE2(swapon, const char __user *, specialfile, int, swap_flags)
                p->cluster_next = 1 + (prandom_u32() % p->highest_bit);
                nr_cluster = DIV_ROUND_UP(maxpages, SWAPFILE_CLUSTER);
 
-               cluster_info = vzalloc(nr_cluster * sizeof(*cluster_info));
+               cluster_info = kvzalloc(nr_cluster * sizeof(*cluster_info),
+                                       GFP_KERNEL);
                if (!cluster_info) {
                        error = -ENOMEM;
                        goto bad_swap;
@@ -2827,7 +2828,8 @@ SYSCALL_DEFINE2(swapon, const char __user *, specialfile, int, swap_flags)
        }
        /* frontswap enabled? set up bit-per-page map for frontswap */
        if (IS_ENABLED(CONFIG_FRONTSWAP))
-               frontswap_map = vzalloc(BITS_TO_LONGS(maxpages) * sizeof(long));
+               frontswap_map = kvzalloc(BITS_TO_LONGS(maxpages) * sizeof(long),
+                                        GFP_KERNEL);
 
        if (p->bdev &&(swap_flags & SWAP_FLAG_DISCARD) && swap_discardable(p)) {
                /*