From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4FD79C6FA86 for ; Mon, 19 Sep 2022 15:29:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230011AbiISP3P (ORCPT ); Mon, 19 Sep 2022 11:29:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34186 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229866AbiISP3M (ORCPT ); Mon, 19 Sep 2022 11:29:12 -0400 Received: from out01.mta.xmission.com (out01.mta.xmission.com [166.70.13.231]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AEDE9DEDE; Mon, 19 Sep 2022 08:29:10 -0700 (PDT) Received: from in01.mta.xmission.com ([166.70.13.51]:51716) by out01.mta.xmission.com with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.93) (envelope-from ) id 1oaIhp-005WyF-Ma; Mon, 19 Sep 2022 09:29:09 -0600 Received: from ip68-110-29-46.om.om.cox.net ([68.110.29.46]:41908 helo=email.froward.int.ebiederm.org.xmission.com) by in01.mta.xmission.com with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.93) (envelope-from ) id 1oaIho-001xqf-J0; Mon, 19 Sep 2022 09:29:09 -0600 From: "Eric W. Biederman" To: Alexey Gladkov Cc: LKML , Linux Containers , linux-doc@vger.kernel.org, Andrew Morton , Christian Brauner , Kees Cook , Manfred Spraul , Jonathan Corbet References: <87wnc1i2wo.fsf@email.froward.int.ebiederm.org> <9b566b9b7313300d60b7dfd785ab041bed757ae0.1660664258.git.legion@kernel.org> Date: Mon, 19 Sep 2022 10:29:02 -0500 In-Reply-To: <9b566b9b7313300d60b7dfd785ab041bed757ae0.1660664258.git.legion@kernel.org> (Alexey Gladkov's message of "Tue, 16 Aug 2022 17:42:45 +0200") Message-ID: <87bkrb2xj5.fsf@email.froward.int.ebiederm.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-XM-SPF: eid=1oaIho-001xqf-J0;;;mid=<87bkrb2xj5.fsf@email.froward.int.ebiederm.org>;;;hst=in01.mta.xmission.com;;;ip=68.110.29.46;;;frm=ebiederm@xmission.com;;;spf=softfail X-XM-AID: U2FsdGVkX1+4L+9MyEPXt7wTGczqMWy7gxvNtcsX4Dk= X-SA-Exim-Connect-IP: 68.110.29.46 X-SA-Exim-Mail-From: ebiederm@xmission.com Subject: Re: [PATCH v1 3/3] docs: Add information about ipc sysctls limitations X-SA-Exim-Version: 4.2.1 (built Sat, 08 Feb 2020 21:53:50 +0000) X-SA-Exim-Scanned: Yes (on in01.mta.xmission.com) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Alexey Gladkov writes: > After 25b21cb2f6d6 ("[PATCH] IPC namespace core") and 4e9823111bdc > ("[PATCH] IPC namespace - shm") the shared memory page count stopped > being global and started counting per ipc namespace. The documentation > and shmget(2) still says that shmall is a global option. > > shmget(2): > > SHMALL System-wide limit on the total amount of shared memory, measured > in units of the system page size. On Linux, this limit can be read and > modified via /proc/sys/kernel/shmall. > > I think the changes made in 2006 should be documented. Agreed. Documenting these limits only apply to their ipc namespace is overdue. Acked-by: "Eric W. Biederman" > Signed-off-by: Alexey Gladkov > --- > Documentation/admin-guide/sysctl/kernel.rst | 14 +++++++++++--- > 1 file changed, 11 insertions(+), 3 deletions(-) > > diff --git a/Documentation/admin-guide/sysctl/kernel.rst b/Documentation/admin-guide/sysctl/kernel.rst > index ddccd1077462..9ad344b5e7a1 100644 > --- a/Documentation/admin-guide/sysctl/kernel.rst > +++ b/Documentation/admin-guide/sysctl/kernel.rst > @@ -541,6 +541,9 @@ default (``MSGMNB``). > ``msgmni`` is the maximum number of IPC queues. 32000 by default > (``MSGMNI``). > > +All of these parameters are set per ipc namespace. The maximum number of bytes > +in POSIX message queues is limited by ``RLIMIT_MSGQUEUE``. This limit is > +respected hierarchically in the each user namespace. > > msg_next_id, sem_next_id, and shm_next_id (System V IPC) > ======================================================== > @@ -1169,15 +1172,20 @@ are doing anyway :) > shmall > ====== > > -This parameter sets the total amount of shared memory pages that > -can be used system wide. Hence, ``shmall`` should always be at least > -``ceil(shmmax/PAGE_SIZE)``. > +This parameter sets the total amount of shared memory pages that can be used > +inside ipc namespace. The shared memory pages counting occurs for each ipc > +namespace separately and is not inherited. Hence, ``shmall`` should always be at > +least ``ceil(shmmax/PAGE_SIZE)``. > > If you are not sure what the default ``PAGE_SIZE`` is on your Linux > system, you can run the following command:: > > # getconf PAGE_SIZE > > +To reduce or disable the ability to allocate shared memory, you must create a > +new ipc namespace, set this parameter to the required value and prohibit the > +creation of a new ipc namespace in the current user namespace or cgroups can > +be used. > > shmmax > ======