diff mbox series

IB/core: Warn if can't pin memory

Message ID 20181220090407.5920-1-yuval.shaia@oracle.com (mailing list archive)
State Superseded
Headers show
Series IB/core: Warn if can't pin memory | expand

Commit Message

Yuval Shaia Dec. 20, 2018, 9:04 a.m. UTC
When memory registration is needed for page count which exceeds the
allowed lock limit the function exits with an error but no error is
printed.
Since this is a case that system administrator can fix (rlimit etc) we
need to give an alert.
This is not a data patch so performance penalty is not a consideration.

Signed-off-by: Yuval Shaia <yuval.shaia@oracle.com>
---
 drivers/infiniband/core/umem.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Leon Romanovsky Dec. 20, 2018, 9:08 a.m. UTC | #1
On Thu, Dec 20, 2018 at 11:04:07AM +0200, Yuval Shaia wrote:
> When memory registration is needed for page count which exceeds the
> allowed lock limit the function exits with an error but no error is
> printed.
> Since this is a case that system administrator can fix (rlimit etc) we
> need to give an alert.
> This is not a data patch so performance penalty is not a consideration.

It is user triggerable print and simple loop execution will spam dmesg.
Maybe you should use ratelimit ariant of pr_err.

Thanks
diff mbox series

Patch

diff --git a/drivers/infiniband/core/umem.c b/drivers/infiniband/core/umem.c
index c6144df47ea4..e213e7e3a277 100644
--- a/drivers/infiniband/core/umem.c
+++ b/drivers/infiniband/core/umem.c
@@ -164,6 +164,8 @@  struct ib_umem *ib_umem_get(struct ib_ucontext *context, unsigned long addr,
 	if (check_add_overflow(mm->pinned_vm, npages, &new_pinned) ||
 	    (new_pinned > lock_limit && !capable(CAP_IPC_LOCK))) {
 		up_write(&mm->mmap_sem);
+		pr_err("%s: Can't pin memory, req %ld, lmt %ld ipc_lock off\n",
+		       __func__, new_pinned, lock_limit);
 		ret = -ENOMEM;
 		goto out;
 	}