From patchwork Wed Nov 10 21:19:49 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mina Almasry X-Patchwork-Id: 12613085 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 21C47C433FE for ; Wed, 10 Nov 2021 21:20:06 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id B62DD61207 for ; Wed, 10 Nov 2021 21:20:05 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org B62DD61207 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 497F66B0072; Wed, 10 Nov 2021 16:20:05 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 447DE6B0074; Wed, 10 Nov 2021 16:20:05 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 30D686B0075; Wed, 10 Nov 2021 16:20:05 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0198.hostedemail.com [216.40.44.198]) by kanga.kvack.org (Postfix) with ESMTP id 230A26B0072 for ; Wed, 10 Nov 2021 16:20:05 -0500 (EST) Received: from smtpin17.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id D86E081CDF for ; Wed, 10 Nov 2021 21:20:04 +0000 (UTC) X-FDA: 78794288328.17.404B092 Received: from mail-pj1-f74.google.com (mail-pj1-f74.google.com [209.85.216.74]) by imf25.hostedemail.com (Postfix) with ESMTP id F1343B000196 for ; Wed, 10 Nov 2021 21:19:52 +0000 (UTC) Received: by mail-pj1-f74.google.com with SMTP id p8-20020a17090a748800b001a6cceee8afso1684431pjk.4 for ; Wed, 10 Nov 2021 13:20:04 -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=ht251uoyJjMbFDL2TxmjV/XN4/hXafLiuH05NGnumYk=; b=k0TTN636enCe/ZMmeDII0J/CegZ6ncDK7yKWw7ZeBWMxbKHHazE2DId/yW7TYXbfi8 O5Yq9ZpclOX9PDD/9UKpxnBf8phr0BrRtW8oaGV0zz7VwAvHi+HacqJd9Ybi1dbenSIQ G2rDRoKgXjSvJCuLpzq8xVzz5f+YfSB6NtLHQRKgAIQkIMQUjoaENBgNO2hmVTk/CgU+ 4GOME56bKNUHCfHCryFmpcs8fxuv+Ly8oFnLIxdtYd+35ExNUXICX9Xb04z4oxz0uqoT fHBB0jJUl1W6L0lcuF4pEp/RzaEu5oBCvoLucY+O0LjmYUulutUJEWpPV00TsQo+hwkM iDgw== 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=ht251uoyJjMbFDL2TxmjV/XN4/hXafLiuH05NGnumYk=; b=kdWDHt9uVyrThHWYf5WJvudIighKcYeM5hS8YcAI01BzG3bMDLCpRt192phS/B5v53 9gYsOWQkFyrloyN0qqaIs+25MEsEYtgYMuy2V/8EYiHoifEVxt/a3SuDJRUxbmufgnmL B9eR2xr0XV4cjwfPrTEYXErGC+pftsNCK4QEAnThwAFjbS5SfK5ZI2MigBPp4JEzBalg ZBNtqnsv6iZL+pnDpIIFZ/4eJX8i50m2RLanlGssqqX833uL2iHZpI8k2q24l86QJ6cE nUffQ1nF7rS0QJHASKNunRxxd7jV9JlCOiPXjKvAv/ZUA9W9lSKOozYvdi9KN3Dhr0dB xhxA== X-Gm-Message-State: AOAM531wIFGbpdhAKsZ4H+XMSprcdjtIQ7fMGNTpcFd7hYScp3n4o+GQ YyFFBFrWHMSUcFvCFo5oZsQh7Ka63dn2qfz2AQ== X-Google-Smtp-Source: ABdhPJyA3J75PZdpM4VEzqJ7LUuXb4mr7PMVvzXz4Bmi7qX1+EffLpI4N/pFRQh4ef5Qi9/IqgodmGo1/Z2akphvVQ== X-Received: from almasrymina.svl.corp.google.com ([2620:15c:2cd:202:59c8:7b4e:e859:9db0]) (user=almasrymina job=sendgmr) by 2002:a63:2acb:: with SMTP id q194mr1266568pgq.384.1636579203523; Wed, 10 Nov 2021 13:20:03 -0800 (PST) Date: Wed, 10 Nov 2021 13:19:49 -0800 In-Reply-To: <20211110211951.3730787-1-almasrymina@google.com> Message-Id: <20211110211951.3730787-4-almasrymina@google.com> Mime-Version: 1.0 References: <20211110211951.3730787-1-almasrymina@google.com> X-Mailer: git-send-email 2.34.0.rc0.344.g81b53c2807-goog Subject: [PATCH v2 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 , Dave Chinner , 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: rspam02 X-Rspamd-Queue-Id: F1343B000196 X-Stat-Signature: 9bm95cg6umgwmihh1d55yqstbirb64oy Authentication-Results: imf25.hostedemail.com; dkim=pass header.d=google.com header.s=20210112 header.b=k0TTN636; spf=pass (imf25.hostedemail.com: domain of 3gzeMYQsKCDYSdeSkjqeafSYggYdW.Ugedafmp-eecnSUc.gjY@flex--almasrymina.bounces.google.com designates 209.85.216.74 as permitted sender) smtp.mailfrom=3gzeMYQsKCDYSdeSkjqeafSYggYdW.Ugedafmp-eecnSUc.gjY@flex--almasrymina.bounces.google.com; dmarc=pass (policy=reject) header.from=google.com X-HE-Tag: 1636579192-67810 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: Dave Chinner 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.rc0.344.g81b53c2807-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: