From: Rafael Aquini <aquini@redhat.com>
To: Manfred Spraul <manfred@colorfullife.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
LKML <linux-kernel@vger.kernel.org>,
Davidlohr Bueso <davidlohr.bueso@hp.com>,
Michael Kerrisk <mtk.manpages@gmail.com>,
Rik van Riel <riel@redhat.com>,
1vier1@web.de
Subject: Re: [PATCH 2/3] ipc/sem.c: increase SEMMSL, SEMMNI, SEMOPM
Date: Fri, 15 Aug 2014 10:42:23 -0300 [thread overview]
Message-ID: <20140815134223.GB9918@optiplex.redhat.com> (raw)
In-Reply-To: <1407828557-31995-3-git-send-email-manfred@colorfullife.com>
On Tue, Aug 12, 2014 at 09:29:16AM +0200, Manfred Spraul wrote:
> a)
> SysV can be abused to allocate locked kernel memory. For most systems, a
> small limit doesn't make sense, see the discussion with regards to SHMMAX.
>
> Therefore: Increase the sysv sem limits so that all known applications
> will work with these defaults.
>
> b)
> With regards to the maximum supported:
> Some of the specified hard limits are not correct anymore, therefore the
> patch updates the documentation.
>
> - SEMMNI must stay below IPCMNI, which is 32768.
> As for SHMMAX: Stay a bit below this limit.
>
> - SEMMSL was limited to 8k, to ensure that the kmalloc for the kernel array
> was limited to 16 kB (order=2)
>
> This doesn't apply anymore:
> - the allocation size isn't sizeof(short)*nsems anymore.
> - ipc_alloc falls back to vmalloc
>
> - SEMOPM should stay below 1000, to limit the kmalloc in semtimedop() to an
> order=1 allocation.
> Therefore: Leave it at 500 (order=0 allocation).
>
> Note:
> If an administrator must limit the memory allocations, then he can set the
> values as necessary.
>
> Or he can disable sysv entirely (as e.g. done by Android).
>
> Signed-off-by: Manfred Spraul <manfred@colorfullife.com>
> ---
Acked-by: Rafael Aquini <aquini@redhat.com>
> include/uapi/linux/sem.h | 18 +++++++++++++++---
> 1 file changed, 15 insertions(+), 3 deletions(-)
>
> diff --git a/include/uapi/linux/sem.h b/include/uapi/linux/sem.h
> index 541fce0..dd73b90 100644
> --- a/include/uapi/linux/sem.h
> +++ b/include/uapi/linux/sem.h
> @@ -63,10 +63,22 @@ struct seminfo {
> int semaem;
> };
>
> -#define SEMMNI 128 /* <= IPCMNI max # of semaphore identifiers */
> -#define SEMMSL 250 /* <= 8 000 max num of semaphores per id */
> +/*
> + * SEMMNI, SEMMSL and SEMMNS are default values which can be
> + * modified by sysctl.
> + * The values has been chosen to be larger than necessary for any
> + * known configuration.
> + *
> + * SEMOPM should not be increased beyond 1000, otherwise there is the
> + * risk that semop()/semtimedop() fails due to kernel memory fragmentation when
> + * allocating the sop array.
> + */
> +
> +
> +#define SEMMNI 32000 /* <= IPCMNI max # of semaphore identifiers */
> +#define SEMMSL 32000 /* <= INT_MAX max num of semaphores per id */
> #define SEMMNS (SEMMNI*SEMMSL) /* <= INT_MAX max # of semaphores in system */
> -#define SEMOPM 32 /* <= 1 000 max num of ops per semop call */
> +#define SEMOPM 500 /* <= 1 000 max num of ops per semop call */
> #define SEMVMX 32767 /* <= 32767 semaphore maximum value */
> #define SEMAEM SEMVMX /* adjust on exit max value */
>
> --
> 1.9.3
>
next prev parent reply other threads:[~2014-08-15 13:42 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-08-12 7:29 [PATCH 0/3] ipc: Further updates to sysv/mqueue limits Manfred Spraul
2014-08-12 7:29 ` [PATCH 1/3] ipc/msg: increase MSGMNI, remove scaling Manfred Spraul
2014-08-12 7:29 ` [PATCH 2/3] ipc/sem.c: increase SEMMSL, SEMMNI, SEMOPM Manfred Spraul
[not found] ` <1407828557-31995-3-git-send-email-manfred-nhLOkwUX5cPe2c5cEj3t2g@public.gmane.org>
2014-08-12 7:29 ` [PATCH 3/3] ipc namespace: copy settings from parent namespace Manfred Spraul
2014-08-12 7:29 ` Manfred Spraul
[not found] ` <1407828557-31995-4-git-send-email-manfred-nhLOkwUX5cPe2c5cEj3t2g@public.gmane.org>
2014-08-12 10:37 ` Eric W. Biederman
2014-08-12 10:37 ` Eric W. Biederman
[not found] ` <877g2ec7tg.fsf-JOvCrm2gF+uungPnsOpG7nhyD016LWXt@public.gmane.org>
2014-08-12 20:39 ` Manfred Spraul
2014-08-12 20:39 ` Manfred Spraul
2014-08-15 13:42 ` Rafael Aquini
2014-08-15 13:42 ` Rafael Aquini
2014-08-15 13:42 ` Rafael Aquini [this message]
2014-08-15 13:41 ` [PATCH 1/3] ipc/msg: increase MSGMNI, remove scaling Rafael Aquini
-- strict thread matches above, loose matches on Subject: below --
2014-10-06 18:32 [PATCH 0/3] Misc updates to sysv ipc Manfred Spraul
2014-10-06 18:32 ` [PATCH 1/3] ipc/sem.c: Chance memory barrier in sem_lock() to smp_rmb() Manfred Spraul
2014-10-06 18:32 ` [PATCH 2/3] ipc/sem.c: increase SEMMSL, SEMMNI, SEMOPM Manfred Spraul
2014-10-07 20:09 ` Rafael Aquini
2014-05-29 18:46 [PATCH 0/3] ipc: Further updates to sysv/mqueue limits Manfred Spraul
2014-05-29 18:46 ` [PATCH 1/3] ipc/msg: increase MSGMNI, remove scaling Manfred Spraul
2014-05-29 18:46 ` [PATCH 2/3] ipc/sem.c: increase SEMMSL, SEMMNI, SEMOPM Manfred Spraul
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=20140815134223.GB9918@optiplex.redhat.com \
--to=aquini@redhat.com \
--cc=1vier1@web.de \
--cc=akpm@linux-foundation.org \
--cc=davidlohr.bueso@hp.com \
--cc=linux-kernel@vger.kernel.org \
--cc=manfred@colorfullife.com \
--cc=mtk.manpages@gmail.com \
--cc=riel@redhat.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.