From patchwork Wed Jan 6 15:24:38 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiri Slaby X-Patchwork-Id: 71332 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.3/8.14.2) with ESMTP id o06GWNen027096 for ; Wed, 6 Jan 2010 16:32:23 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932165Ab0AFQcW (ORCPT ); Wed, 6 Jan 2010 11:32:22 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S932182Ab0AFQcW (ORCPT ); Wed, 6 Jan 2010 11:32:22 -0500 Received: from smtp.mujha-vel.cz ([81.30.225.246]:51151 "EHLO smtp.mujha-vel.cz" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932165Ab0AFQcV (ORCPT ); Wed, 6 Jan 2010 11:32:21 -0500 X-Greylist: delayed 4042 seconds by postgrey-1.27 at vger.kernel.org; Wed, 06 Jan 2010 11:32:21 EST Received: from [217.66.174.142] (helo=localhost.localdomain) by smtp.mujha-vel.cz with esmtp (Exim 4.63) (envelope-from ) id 1NSXkn-0006C2-Sk; Wed, 06 Jan 2010 16:24:58 +0100 From: Jiri Slaby To: jirislaby@gmail.com Cc: linux-kernel@vger.kernel.org, Ralph Campbell , Andrew Morton , Sean Hefty , Hal Rosenstock , linux-rdma@vger.kernel.org Subject: [PATCH] infiniband: use helpers for rlimits Date: Wed, 6 Jan 2010 16:24:38 +0100 Message-Id: <1262791479-26594-10-git-send-email-jslaby@suse.cz> X-Mailer: git-send-email 1.6.5.7 In-Reply-To: <1262791479-26594-1-git-send-email-jslaby@suse.cz> References: <1262791479-26594-1-git-send-email-jslaby@suse.cz> Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org diff --git a/drivers/infiniband/core/umem.c b/drivers/infiniband/core/umem.c index 6f7c096..4f906f0 100644 --- a/drivers/infiniband/core/umem.c +++ b/drivers/infiniband/core/umem.c @@ -136,7 +136,7 @@ struct ib_umem *ib_umem_get(struct ib_ucontext *context, unsigned long addr, down_write(¤t->mm->mmap_sem); locked = npages + current->mm->locked_vm; - lock_limit = current->signal->rlim[RLIMIT_MEMLOCK].rlim_cur >> PAGE_SHIFT; + lock_limit = rlimit(RLIMIT_MEMLOCK) >> PAGE_SHIFT; if ((locked > lock_limit) && !capable(CAP_IPC_LOCK)) { ret = -ENOMEM; diff --git a/drivers/infiniband/hw/ipath/ipath_user_pages.c b/drivers/infiniband/hw/ipath/ipath_user_pages.c index 82878e3..eb7d59a 100644 --- a/drivers/infiniband/hw/ipath/ipath_user_pages.c +++ b/drivers/infiniband/hw/ipath/ipath_user_pages.c @@ -59,8 +59,7 @@ static int __get_user_pages(unsigned long start_page, size_t num_pages, size_t got; int ret; - lock_limit = current->signal->rlim[RLIMIT_MEMLOCK].rlim_cur >> - PAGE_SHIFT; + lock_limit = rlimit(RLIMIT_MEMLOCK) >> PAGE_SHIFT; if (num_pages > lock_limit) { ret = -ENOMEM;