Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1247928 > unrolled thread

[PATCH] IB/core: Print error when umem fails due to locked memory limit.

Started byj.glisse@gmail.com
First post2015-10-15 18:00 +0200
Last post2015-10-15 18:10 +0200
Articles 2 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] IB/core: Print error when umem fails due to locked memory limit. j.glisse@gmail.com - 2015-10-15 18:00 +0200
    Re: [PATCH] IB/core: Print error when umem fails due to locked memory  limit. Doug Ledford <dledford@redhat.com> - 2015-10-15 18:10 +0200

#1247928 — [PATCH] IB/core: Print error when umem fails due to locked memory limit.

Fromj.glisse@gmail.com
Date2015-10-15 18:00 +0200
Subject[PATCH] IB/core: Print error when umem fails due to locked memory limit.
Message-ID<qjT6G-2yx-5@gated-at.bofh.it>
From: Jérôme Glisse <jglisse@redhat.com>

It can be rather tedious to find why userspace is failing when only
thing kernel report is -ENOMEM. This add an error message so that
user can figure out why they are getting -ENOMEM.

Signed-off-by: Jérôme Glisse <jglisse@redhat.com>
cc: <linux-rdma@vger.kernel.org>
Cc: Haggai Eran <haggaie@mellanox.com>
Cc: Sagi Grimberg <sagig@mellanox.com>
Cc: Shachar Raindel <raindel@mellanox.com>
Cc: Doug Ledford <dledford@redhat.com>
---
 drivers/infiniband/core/umem.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/infiniband/core/umem.c b/drivers/infiniband/core/umem.c
index 38acb3c..a66929e 100644
--- a/drivers/infiniband/core/umem.c
+++ b/drivers/infiniband/core/umem.c
@@ -169,6 +169,7 @@ struct ib_umem *ib_umem_get(struct ib_ucontext *context, unsigned long addr,
 	lock_limit = rlimit(RLIMIT_MEMLOCK) >> PAGE_SHIFT;
 
 	if ((locked > lock_limit) && !capable(CAP_IPC_LOCK)) {
+		pr_err("locked memory quota exhausted (see ulimit -l)\n");
 		ret = -ENOMEM;
 		goto out;
 	}
-- 
1.8.3.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [next] | [standalone]


#1247945 — Re: [PATCH] IB/core: Print error when umem fails due to locked memory limit.

FromDoug Ledford <dledford@redhat.com>
Date2015-10-15 18:10 +0200
SubjectRe: [PATCH] IB/core: Print error when umem fails due to locked memory limit.
Message-ID<qjTgm-2Z7-37@gated-at.bofh.it>
In reply to#1247928

[Multipart message — attachments visible in raw view] — view raw

On 10/15/2015 10:21 AM, j.glisse@gmail.com wrote:
> From: Jérôme Glisse <jglisse@redhat.com>
> 
> It can be rather tedious to find why userspace is failing when only
> thing kernel report is -ENOMEM. This add an error message so that
> user can figure out why they are getting -ENOMEM.
> 
> Signed-off-by: Jérôme Glisse <jglisse@redhat.com>
> cc: <linux-rdma@vger.kernel.org>
> Cc: Haggai Eran <haggaie@mellanox.com>
> Cc: Sagi Grimberg <sagig@mellanox.com>
> Cc: Shachar Raindel <raindel@mellanox.com>
> Cc: Doug Ledford <dledford@redhat.com>
> ---
>  drivers/infiniband/core/umem.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/infiniband/core/umem.c b/drivers/infiniband/core/umem.c
> index 38acb3c..a66929e 100644
> --- a/drivers/infiniband/core/umem.c
> +++ b/drivers/infiniband/core/umem.c
> @@ -169,6 +169,7 @@ struct ib_umem *ib_umem_get(struct ib_ucontext *context, unsigned long addr,
>  	lock_limit = rlimit(RLIMIT_MEMLOCK) >> PAGE_SHIFT;
>  
>  	if ((locked > lock_limit) && !capable(CAP_IPC_LOCK)) {
> +		pr_err("locked memory quota exhausted (see ulimit -l)\n");
>  		ret = -ENOMEM;
>  		goto out;
>  	}
> 

This looks like it could easily cause a flood of messages (possibly even
enough to DoS the machine).  Please convert this to some sort of rate
limited output (preferably, you would issue this warning only once per
task, and the error would include the command name).

-- 
Doug Ledford <dledford@redhat.com>
              GPG KeyID: 0E572FDD


[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web