Hello, When I started to use SoftRoCE, I'm very confused by ENOMEM error output even if I gave enough memory. I think EPERM is more suitable for uses to solve error rather than ENOMEM at here of ib_umem_get() when # of pinned pages is over ulimit. This is not "memory is not enough" problem, because driver can succeed to pin enough amount of pages, but it is larger than ulimit value. The hard limit of "max locked memory" can be changed by limit.conf. In addition, this checks also CAP_IPC_LOCK, it is indeed permmission check. So, I think the following patch. If there is a intention why ENOMEM is used here, please let me know. Otherwise, I'm glad if this is merged. Thanks. --- When # of pinned pages are larger than ulimit of "max locked memory" without CAP_IPC_LOCK, current ib_umem_get() returns ENOMEM. But it does not mean "not enough memory", because driver could succeed to pinned enough pages. This is just capability error. Even if a normal user is limited his/her # of pinned pages, system administrator can give permission by change hard limit of this ulimit value. To notify correct information to user, ib_umem_get() should return EPERM instead of ENOMEM at here. Signed-off-by: Yasunori Goto <y-goto@xxxxxxxxxxx> --- drivers/infiniband/core/umem.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/infiniband/core/umem.c b/drivers/infiniband/core/umem.c index 0eb40025075f..9771134649e9 100644 --- a/drivers/infiniband/core/umem.c +++ b/drivers/infiniband/core/umem.c @@ -205,7 +205,7 @@ struct ib_umem *ib_umem_get(struct ib_device *device, unsigned long addr, new_pinned = atomic64_add_return(npages, &mm->pinned_vm); if (new_pinned > lock_limit && !capable(CAP_IPC_LOCK)) { atomic64_sub(npages, &mm->pinned_vm); - ret = -ENOMEM; + ret = -EPERM; goto out; } -- 2.31.1