From patchwork Mon Nov 8 21:19:58 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mina Almasry X-Patchwork-Id: 12609113 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 C3BCBC433EF for ; Mon, 8 Nov 2021 21:20:16 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 771C461052 for ; Mon, 8 Nov 2021 21:20:16 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 771C461052 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 1FEB26B0074; Mon, 8 Nov 2021 16:20:16 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 1B0C66B0075; Mon, 8 Nov 2021 16:20:16 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 028D96B0078; Mon, 8 Nov 2021 16:20:15 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0210.hostedemail.com [216.40.44.210]) by kanga.kvack.org (Postfix) with ESMTP id E9C646B0074 for ; Mon, 8 Nov 2021 16:20:15 -0500 (EST) Received: from smtpin21.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id A82DE7CA4F for ; Mon, 8 Nov 2021 21:20:15 +0000 (UTC) X-FDA: 78787031190.21.749103D Received: from mail-pf1-f202.google.com (mail-pf1-f202.google.com [209.85.210.202]) by imf30.hostedemail.com (Postfix) with ESMTP id C34F5E0019A4 for ; Mon, 8 Nov 2021 21:19:55 +0000 (UTC) Received: by mail-pf1-f202.google.com with SMTP id x20-20020aa79414000000b0049f9cb19a5fso6530215pfo.17 for ; Mon, 08 Nov 2021 13:20:15 -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=9WU77qiyFJ2kLEsta1yGwcYoFr6WpwZMlTN2QvzNdcQ=; b=XoZ7JWwmBewgPmGjnm10qp+RIw/NVsOqlra/8f6lrdUWEv3z88BW5xl/BmGAZkkpVX z4V26/l0vtZObekIpNQ9FfYR1y+YMbCt1PFXx5zNa2pn3Yras1kBCHo2liM5OI4tMNeS DTeMxphjd6Da/3anBbATiQQCseQmZwrNVBDA7y3+umUoYpuLIvfwNqTR+NH5tPb2JkCw MA5Xi0MH83tKnMBDAkMTLh1Ly8kWbBsL0dWZ5d4jGWmF27bPoDNZHLRR9nffqgmAflmV 79e58VzLJDhg/VKpYqz92xR5sXSmywy2IKW+8FrUBL0lHHTPO3pM0UH/67MUSsX4G/Xa Y1QA== 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=9WU77qiyFJ2kLEsta1yGwcYoFr6WpwZMlTN2QvzNdcQ=; b=fmj0qOnstyAZ2V/+HzWnfMepMku1uOTMI86L6m/93XT/ttX+sxaO95o39Kn4GGTwlP 5eyafoEuJPX4SbW3zYBF9yRHnc++4NKDAokSwPGrL/xi3QJXNooY7vdATN9uXD7lOqCR HWlpn2QbcMGTn7hTXJLCxtQkyXNYIwfRDEvvyjkoCTtOf0CBAX37ucD4jLbi1V+qD1Hf hFbG5l5aD0KKctqfZR05GDRYD9K/WrJBiZGt5TDibocCAwbdVUQK19Sn64bWn4G44XlN Zb6x2McLGWOg6qlCFJpUoFv0T244pWOPdAVZHY2jKCso/y/hsvTnCZ81oYGAJkD9fPFG 8leg== X-Gm-Message-State: AOAM5302pDKFYOQsD+JdLF7+6XaoYFsjHRqhrj0Q5o0ldQ5WZdZbTarJ jJ992x+OrxMCDZxOkkeuRvLdvo9hPCAusKpopw== X-Google-Smtp-Source: ABdhPJyiMnEsbTg2euGguvqj93KbzV4NSrI0GvzmkEHj4Gpa1PgsADOPZu4SL6FQIysaNjHUxKEEy6x0bm2X74pFeg== X-Received: from almasrymina.svl.corp.google.com ([2620:15c:2cd:202:8717:7707:fb59:664e]) (user=almasrymina job=sendgmr) by 2002:a63:82c6:: with SMTP id w189mr1873879pgd.469.1636406414317; Mon, 08 Nov 2021 13:20:14 -0800 (PST) Date: Mon, 8 Nov 2021 13:19:58 -0800 In-Reply-To: <20211108211959.1750915-1-almasrymina@google.com> Message-Id: <20211108211959.1750915-5-almasrymina@google.com> Mime-Version: 1.0 References: <20211108211959.1750915-1-almasrymina@google.com> X-Mailer: git-send-email 2.34.0.rc0.344.g81b53c2807-goog Subject: [PATCH v1 4/5] 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 , riel@surriel.com, linux-mm@kvack.org, linux-fsdevel@vger.kernel.org, cgroups@vger.kernel.org X-Rspamd-Server: rspam05 X-Rspamd-Queue-Id: C34F5E0019A4 X-Stat-Signature: taq6jubiymd9ywtfpjbaj4yguuqairii Authentication-Results: imf30.hostedemail.com; dkim=pass header.d=google.com header.s=20210112 header.b=XoZ7JWwm; dmarc=pass (policy=reject) header.from=google.com; spf=pass (imf30.hostedemail.com: domain of 3jpSJYQsKCO8RcdRjipdZeRXffXcV.TfdcZelo-ddbmRTb.fiX@flex--almasrymina.bounces.google.com designates 209.85.210.202 as permitted sender) smtp.mailfrom=3jpSJYQsKCO8RcdRjipdZeRXffXcV.TfdcZelo-ddbmRTb.fiX@flex--almasrymina.bounces.google.com X-HE-Tag: 1636406395-725055 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.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: