Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp4296851rwb; Tue, 20 Sep 2022 11:37:21 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7AS0K7E21baLgGe4Zl0vpa8thFryrZAIXSDQogzwaWspJAKEDvurdyn16YpYFQwS9bsomZ X-Received: by 2002:aa7:cb83:0:b0:443:3f15:84fe with SMTP id r3-20020aa7cb83000000b004433f1584femr21724370edt.17.1663699041321; Tue, 20 Sep 2022 11:37:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1663699041; cv=none; d=google.com; s=arc-20160816; b=DNFjqwYbQpc5lGS/Y0I9c0HkA67D4O6zv/dmlVZb+PIOE5iZSb7UnupSoIVXG/VgIR 8nIbThXoPPhrpH1BMpRK/eAXxl1ZXQODd0YCtkZhP246JfH1qTwNy4jq+Y0huEK2yqsK 5zMjWufOS+Zkjf1UVZKF9akgD0ogJO6BQizmmLH3tnQk37RZVE6BI8gVM1DhQb+DNQ/Q A3imGWYtoU6C7NkWlQCuETlav3Pwxy1P8vJuTFi23AeudaL4VPr64mFzRGj4RThCxsrx paEIjpmdPUGrz9OmW/UFllc/fuOxcYS2LL+FYDNMymZXEmDs/zzmcFPnoGgDHixZ0rpU fjZg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=wakXnUEC4Q60N3E3fQ84WxeXdvulgvHfb2chAjS00No=; b=QDirpaJfz5Dctw7pQIG402cQlroGd27/HLM+RCQwy5aUiqaBy8pI1VTLYDo77j8opl 8q4+H8N56It467il0PGX0V0Hh2j1zl3YDpk/X1MrjhHvcr7oD6hBq1UC4PKzxhs1MX3b 1WXXoZdKuGLecWYQzu0vpEmd0WIHaXruBASlDBBidGmM3b+7w1cKPVb9OFFYhtCpvlDK nvfLxdvw7EM4vCBaDyxSKDlBXq17wo3clFD8CNlmJgJDy5ld4FaOHYpjO5vsZ+U4tATF kLbtLO0Dy1a1atKQaqTI4fZvaWCPQWXN7OEnaCaKRBFS/IrXS7aLq/l2/O4GSZLriOE2 h5Tg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id hz3-20020a1709072ce300b0077fd5b45e18si357995ejc.929.2022.09.20.11.36.56; Tue, 20 Sep 2022 11:37:21 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231327AbiITSJ4 (ORCPT + 99 others); Tue, 20 Sep 2022 14:09:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42924 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231285AbiITSJo (ORCPT ); Tue, 20 Sep 2022 14:09:44 -0400 Received: from us-smtp-delivery-44.mimecast.com (us-smtp-delivery-44.mimecast.com [207.211.30.44]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7C04E60DA for ; Tue, 20 Sep 2022 11:09:35 -0700 (PDT) Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-185-DMmJYzxEOWSPHuBH53reNA-1; Tue, 20 Sep 2022 14:09:23 -0400 X-MC-Unique: DMmJYzxEOWSPHuBH53reNA-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id D5E38802801; Tue, 20 Sep 2022 18:09:22 +0000 (UTC) Received: from comp-core-i7-2640m-0182e6.redhat.com (unknown [10.40.208.17]) by smtp.corp.redhat.com (Postfix) with ESMTP id EC0032166B26; Tue, 20 Sep 2022 18:09:20 +0000 (UTC) From: Alexey Gladkov To: LKML , Linux Containers , linux-doc@vger.kernel.org, linux-man@vger.kernel.org Cc: Andrew Morton , Christian Brauner , "Eric W . Biederman" , Kees Cook , Manfred Spraul , Jonathan Corbet Subject: [PATCH v2 3/3] docs: Add information about ipc sysctls limitations Date: Tue, 20 Sep 2022 20:08:22 +0200 Message-Id: In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 3.1 on 10.11.54.6 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_LOW, SPF_HELO_NONE,SPF_SOFTFAIL autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. Signed-off-by: Alexey Gladkov Acked-by: "Eric W. Biederman" --- 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 ee6572b1edad..c8b89bd8f004 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) ======================================================== @@ -1181,15 +1184,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 ====== -- 2.33.4