From patchwork Thu Nov 11 23:42:02 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mina Almasry X-Patchwork-Id: 12615885 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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9D791C43217 for ; Thu, 11 Nov 2021 23:42:24 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 3E9F360F55 for ; Thu, 11 Nov 2021 23:42:24 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 3E9F360F55 Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=google.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvack.org Received: by kanga.kvack.org (Postfix) id 438BC6B0085; Thu, 11 Nov 2021 18:42:23 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 3253B6B0083; Thu, 11 Nov 2021 18:42:23 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 19F306B0085; Thu, 11 Nov 2021 18:42:23 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0088.hostedemail.com [216.40.44.88]) by kanga.kvack.org (Postfix) with ESMTP id F20266B0082 for ; Thu, 11 Nov 2021 18:42:22 -0500 (EST) Received: from smtpin26.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id ACA011854B8DF for ; Thu, 11 Nov 2021 23:42:22 +0000 (UTC) X-FDA: 78798275724.26.87B4FEA Received: from mail-pf1-f201.google.com (mail-pf1-f201.google.com [209.85.210.201]) by imf24.hostedemail.com (Postfix) with ESMTP id AD081B0000B6 for ; Thu, 11 Nov 2021 23:42:21 +0000 (UTC) Received: by mail-pf1-f201.google.com with SMTP id 184-20020a6217c1000000b0049f9aad0040so4639782pfx.21 for ; Thu, 11 Nov 2021 15:42:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=date:in-reply-to:message-id:mime-version:references:subject:from:cc; bh=QKU2zoRZAY9B8wj0r50tOlnkCOTcLxsxIw+JHt9jziI=; b=JocGXKO8vY/Ookh/ASf19pgzF9fbTxKzPIQc9mr3ZW9WLy37prKQp+n3wZnM/xMthM 2KQx2QAwcupd9pCNoZfYj+6FCwVVh6Jkn9m052frBDQ15Ovd03/ja8SLsW+GW7JuTW7/ I3epIUBB2H6nOAIkBN9Txbrt0YOYzxDhPkI1ChBp+uj1WGkwN6tJWejpY2LsYHDbTgct t+eExB3JvbT+XdeGFGYhdFhDmoi9K+yadiin6mJ9215TXb/QussBIvxWorlBaK7Mu5RX 61Yl8hcta58kMpcN4IZPjM68lyv1IVyZSGpliCorVZf2XwliHcMa5DkDnOuoS1MPphyS L0wA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:in-reply-to:message-id:mime-version :references:subject:from:cc; bh=QKU2zoRZAY9B8wj0r50tOlnkCOTcLxsxIw+JHt9jziI=; b=QkiaUGilkG7gC4gpksN2Ri9UpqosshNtNnSh4acOxk/CLK9JJjgxAohysiqWbx6c9L 9CD6WgwWE2r3QMIWZ0VeKNd/Oiu8A0tp6wH1qbkeykh6hzD+Wmo3ZRZt+HMPi6lJFJCY DI57Ku6Xuqi4Ijomk2+WFybInldWQckPumF+M86tLlxk/BOlU5+ZXAsgcsXmKQAyHJvO xYw1ZlN0Ox5PKfisbKW7ZF7n7blwpUk2nER7wLOvH7GRkmHLw0k335xwSflG6mN1UWDL 7s7DyGO+nFz0IisDx78Pe19MMoq9VMu6LdgXLgs+r7GPEGQ8FyoL5rkBonfCv6q1mxfN cL0A== X-Gm-Message-State: AOAM5302HSq7XAw6agK9IJORfa2os7Cs+//PKyIHZl5+P3wwOiKDgD6p qMcQ4ypQPqwQ6vSY2DZPR8JgvMerTIvprlNFwg== X-Google-Smtp-Source: ABdhPJyv18UxWjHYGcxmL0Hv3Vr6h6XrUEROs+TEjWYMoubdPeYAV2S1MsBJ8jE6zKcEwPC+EOBt3F7jMzJb6sulWA== X-Received: from almasrymina.svl.corp.google.com ([2620:15c:2cd:202:672d:70d0:3f83:676d]) (user=almasrymina job=sendgmr) by 2002:a62:8683:0:b0:480:edf9:33c0 with SMTP id x125-20020a628683000000b00480edf933c0mr10265886pfd.11.1636674140761; Thu, 11 Nov 2021 15:42:20 -0800 (PST) Date: Thu, 11 Nov 2021 15:42:02 -0800 In-Reply-To: <20211111234203.1824138-1-almasrymina@google.com> Message-Id: <20211111234203.1824138-4-almasrymina@google.com> Mime-Version: 1.0 References: <20211111234203.1824138-1-almasrymina@google.com> X-Mailer: git-send-email 2.34.0.rc1.387.gb447b232ab-goog Subject: [PATCH v3 3/4] mm, shmem: add tmpfs memcg= option documentation From: Mina Almasry Cc: Mina Almasry , Michal Hocko , "Theodore Ts'o" , Greg Thelen , Shakeel Butt , Andrew Morton , Hugh Dickins , Roman Gushchin , Johannes Weiner , Tejun Heo , Vladimir Davydov , Muchun Song , riel@surriel.com, linux-mm@kvack.org, linux-fsdevel@vger.kernel.org, cgroups@vger.kernel.org X-Rspamd-Server: rspam01 X-Rspamd-Queue-Id: AD081B0000B6 X-Stat-Signature: t96rn3xs1e7ztxifttfh49ytk14srf1q Authentication-Results: imf24.hostedemail.com; dkim=pass header.d=google.com header.s=20210112 header.b=JocGXKO8; spf=pass (imf24.hostedemail.com: domain of 3XKqNYQsKCPkbmnbtsznjobhpphmf.dpnmjovy-nnlwbdl.psh@flex--almasrymina.bounces.google.com designates 209.85.210.201 as permitted sender) smtp.mailfrom=3XKqNYQsKCPkbmnbtsznjobhpphmf.dpnmjovy-nnlwbdl.psh@flex--almasrymina.bounces.google.com; dmarc=pass (policy=reject) header.from=google.com X-HE-Tag: 1636674141-909104 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Signed-off-by: Mina Almasry Cc: Michal Hocko Cc: Theodore Ts'o Cc: Greg Thelen Cc: Shakeel Butt Cc: Andrew Morton Cc: Hugh Dickins Cc: Roman Gushchin Cc: Johannes Weiner Cc: Hugh Dickins Cc: Tejun Heo Cc: Vladimir Davydov Cc: Muchun Song Cc: riel@surriel.com Cc: linux-mm@kvack.org Cc: linux-fsdevel@vger.kernel.org Cc: cgroups@vger.kernel.org --- Documentation/filesystems/tmpfs.rst | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) -- 2.34.0.rc1.387.gb447b232ab-goog diff --git a/Documentation/filesystems/tmpfs.rst b/Documentation/filesystems/tmpfs.rst index 0408c245785e3..1ab04e8fa9222 100644 --- a/Documentation/filesystems/tmpfs.rst +++ b/Documentation/filesystems/tmpfs.rst @@ -137,6 +137,23 @@ mount options. It can be added later, when the tmpfs is already mounted on MountPoint, by 'mount -o remount,mpol=Policy:NodeList MountPoint'. +If CONFIG_MEMCG is enabled, tmpfs has a mount option to specify the memory +cgroup to be charged for page allocations. + +memcg=/sys/fs/cgroup/unified/test/: data page allocations are charged to +cgroup /sys/fs/cgroup/unified/test/. + +When charging memory to the remote memcg (memcg specified with memcg=) and +hitting the limit, the oom-killer will be invoked and will attempt to kill +a process in the remote memcg. If no such processes are found, the remote +charging process gets an ENOMEM. If the remote charging process is in the +pagefault path, it gets killed. + +Only processes that have access to /sys/fs/cgroup/unified/test/cgroup.procs can +mount a tmpfs with memcg=/sys/fs/cgroup/unified/test. Thus, a process is able +to charge memory to a cgroup only if it itself is able to enter that cgroup. + + To specify the initial root directory you can use the following mount options: