public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Ciju Rajan K <ciju@linux.vnet.ibm.com>
To: William Lee Irwin III <wli@holomorphy.com>
Cc: aglitke <agl@us.ibm.com>, linux-kernel@vger.kernel.org
Subject: Re: [RFC] [PATCH] hugetlbfs :shmget with SHM_HUGETLB only works as root
Date: Tue, 29 Jan 2008 20:28:03 +0530	[thread overview]
Message-ID: <479F3EFB.4070204@linux.vnet.ibm.com> (raw)
In-Reply-To: <20071129231121.GA31637@holomorphy.com>

William Lee Irwin III wrote:
> On Fri, Nov 30, 2007 at 12:02:32AM +0530, Ciju Rajan K wrote:
>>   I tested your patch. But that is not solving the problem.
>>   If the code change to user_shm_lock() is not a good solution, could 
>> you please suggest a method so that the normal user is able to allocate 
>> the huge pages, if his gid is added to /proc/sys/vm/hugetlb_shm_group
> 
> The patch I posted resolves a race unrelated to your issue. Raising your
> locked memory limits should not be difficult. /etc/limits.conf or similar
> should set it up for you. You can also change the default rlimit in the
> kernel and compile it with default limits elevated to what you want your
> unprivileged process to have to start with if you're truly having lots
> of trouble getting userspace to set the default limits properly. I'd
> look in include/asm-generic/resource.h
> 
> 
> -- wli

Hi Wli,

The documentation available in the kernel for huge pages does not talk
about the issue associated with locked memory limit. I think it would be
helpful to the users if we mention about this in the documentation. I
am attaching a small documentation patch.

Thanks
Ciju

Signed-off-by: Ciju Rajan (ciju@linux.vnet.ibm.com)
---
--- Documentation/vm/hugetlbpage.txt.orig       2008-01-24 16:42:40.000000000 +0530
+++ Documentation/vm/hugetlbpage.txt    2008-01-29 19:36:45.000000000 +0530
@@ -108,6 +108,18 @@ a supplementary group and system admin n
  applications to use any combination of mmaps and shm* calls, though the
  mount of filesystem will be required for using mmap calls.

+Note: The default locked limit in the kernel is just 32KB. If the normal
+user whose gid is present in the file /proc/sys/vm/hugetlb_shm_group needs
+more memory than this, the default limit must be increased. If pam is installed
+on your system, resource limits can be configured by installing lines similar
+to the following in /etc/security/limits.conf:
+
+@hugegroup      soft    memlock         2097152
+@hugegroup      hard    memlock         2097152
+
+Otherwise, you may manipulate the locked limit command directly with 'ulimit'.
+See its man page for more information.
+
  *******************************************************************

  /*


  reply	other threads:[~2008-01-29 15:01 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-11-14 14:15 [RFC] [PATCH] hugetlbfs :shmget with SHM_HUGETLB only works as root Ciju Rajan K
2007-11-14 15:31 ` aglitke
2007-11-14 22:00   ` William Lee Irwin III
2007-11-29 18:32     ` Ciju Rajan K
2007-11-29 23:11       ` William Lee Irwin III
2008-01-29 14:58         ` Ciju Rajan K [this message]
2008-01-30  9:32           ` Ciju Rajan K
2007-11-16 13:59   ` Ciju Rajan K

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=479F3EFB.4070204@linux.vnet.ibm.com \
    --to=ciju@linux.vnet.ibm.com \
    --cc=agl@us.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=wli@holomorphy.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox