linux 2.6.16.38 w/ vs2.0.3-rc1
[linux-2.6.git] / drivers / infiniband / core / uverbs_mem.c
index efe147d..a945edd 100644 (file)
@@ -36,6 +36,7 @@
 
 #include <linux/mm.h>
 #include <linux/dma-mapping.h>
+#include <linux/vs_memory.h>
 
 #include "uverbs.h"
 
@@ -161,7 +162,7 @@ out:
        if (ret < 0)
                __ib_umem_release(dev, mem, 0);
        else
-               current->mm->locked_vm = locked;
+               vx_vmlocked_sub(current->mm, current->mm->locked_vm - locked);
 
        up_write(&current->mm->mmap_sem);
        free_page((unsigned long) page_list);
@@ -174,8 +175,8 @@ void ib_umem_release(struct ib_device *dev, struct ib_umem *umem)
        __ib_umem_release(dev, umem, 1);
 
        down_write(&current->mm->mmap_sem);
-       current->mm->locked_vm -=
-               PAGE_ALIGN(umem->length + umem->offset) >> PAGE_SHIFT;
+       vx_vmlocked_sub(current->mm,
+               PAGE_ALIGN(umem->length + umem->offset) >> PAGE_SHIFT);
        up_write(&current->mm->mmap_sem);
 }
 
@@ -184,7 +185,7 @@ static void ib_umem_account(void *work_ptr)
        struct ib_umem_account_work *work = work_ptr;
 
        down_write(&work->mm->mmap_sem);
-       work->mm->locked_vm -= work->diff;
+       vx_vmlocked_sub(work->mm, work->diff);
        up_write(&work->mm->mmap_sem);
        mmput(work->mm);
        kfree(work);
@@ -211,10 +212,8 @@ void ib_umem_release_on_close(struct ib_device *dev, struct ib_umem *umem)
         */
 
        work = kmalloc(sizeof *work, GFP_KERNEL);
-       if (!work) {
-               mmput(mm);
+       if (!work)
                return;
-       }
 
        INIT_WORK(&work->work, ib_umem_account, work);
        work->mm   = mm;