From patchwork Thu Jan 5 13:16:34 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bagas Sanjaya X-Patchwork-Id: 39535 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp297904wrt; Thu, 5 Jan 2023 05:22:11 -0800 (PST) X-Google-Smtp-Source: AMrXdXsRY4GLoGoPS8C8tFIQrmU2pU5DiO8/THsQD7lNXHKpF2XaimbJiutRh/Kiv0zKlLKRe2TR X-Received: by 2002:a17:903:3052:b0:192:fc11:2826 with SMTP id u18-20020a170903305200b00192fc112826mr3058599pla.13.1672924931385; Thu, 05 Jan 2023 05:22:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672924931; cv=none; d=google.com; s=arc-20160816; b=qH79rUT4+rN9+3TuP5QmC0hE31Xdq9H4bDIHSk4P9Qt8P5ljUVKD/vc+CvcaV6tBuW l50Cdya5q33NDeSzglQJvNkm2qEuz5fvbwfbs02mFfcolDiB3ODxQ6FFBsPtezQHwhnw YoQVKdCQxCHRyTp+1P71rv3i04/2NiVXTEzDkqhe8Z+uFSDEHwPMLjzI3oPpCZZ36tBM SS68xVGVCndOmzJmnuwrz/O381weWY9B6oQPoj+VVAZHIJwMdBDj2m4gL/I/UE0mIMO6 JNaG0rC9MUkIFwtXzbbzjawRzTcejZcy9HndIx+H3icBmyxoZa0nJKXBaFf3VvdZG6Kd jMxg== 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 :dkim-signature; bh=/8J8qW+Vq8pd6T9oMP3SU6TUuvWLiPg70zvs+kZ90og=; b=fE9P+/TzHd8Tzftgwvx20kJ4Mcn4ZGhqu5dDS4f9FGOvmADyNEZ4kO+E2NGlUs0Q8L mywmczp/8R1tPNoTcVLYEUkaGwrN80zfa9AHrnxtfe9x3lX+Zp8x93x1m8EESRuDPKjB vNfoGOcq6pc6Nc5fsVoXDyHk6QBDVz6b7h6rssvaEggmFc+d18wzp+XZ+sfwdnGXC87B 05CnBbSGV5nV6P45Du3h7sOUy9ioTxGZxxQz+VnM9UT9ojfrxfVFAlLuCnJ3MCFLO/SV mLQmoGXmoUe3Qirp77pjJ7nrCB3PSkU6/5pSTyGN/pZjNzXdfTTm4P44+98H6A3IDV+6 NlMw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=iCXg4LXU; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u11-20020a170902e5cb00b0017e20ec5490si40010578plf.301.2023.01.05.05.21.58; Thu, 05 Jan 2023 05:22:11 -0800 (PST) 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; dkim=pass header.i=@gmail.com header.s=20210112 header.b=iCXg4LXU; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234104AbjAENSM (ORCPT + 99 others); Thu, 5 Jan 2023 08:18:12 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36888 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234315AbjAENR0 (ORCPT ); Thu, 5 Jan 2023 08:17:26 -0500 Received: from mail-pl1-x630.google.com (mail-pl1-x630.google.com [IPv6:2607:f8b0:4864:20::630]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B5EBE5C1C6; Thu, 5 Jan 2023 05:17:10 -0800 (PST) Received: by mail-pl1-x630.google.com with SMTP id jn22so39264114plb.13; Thu, 05 Jan 2023 05:17:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=/8J8qW+Vq8pd6T9oMP3SU6TUuvWLiPg70zvs+kZ90og=; b=iCXg4LXUCBckmKqWrrrxIf26SHrZFmi22auf4ZaicKRigcxRH4J1pPKSfOGqGrx+70 2Dz9hHlbyfiE4Ej5uw8WLiINWCrDAzbB2ANP3+/gbqzdOwBY6PAVA7BUZTzjTjN9cnpk w7tPekaV9ZL3vtm3yJhU/niRomQUa/kb4CWyJH8y8iuAh/qLPl6JCDrc6ste8rMI94Vb txsfBlJ+2NXRQscx4WGe5FgfV4qryQy/us+G8v74ohmJ9dZ1/1Yydjnm5pMDR4CGIFWd rFyAaog+Q+WI+4vFL84NNY7n+NkZ1tRC3x6sboqGdsT7/ikXBHb5637YYaiNJOQxgOy1 wIXQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=/8J8qW+Vq8pd6T9oMP3SU6TUuvWLiPg70zvs+kZ90og=; b=1EsZW3jg+Lf7iiDSD0QtAfimZyq0pJG0IFjY74GLcjXT61X/zVcK7cBnGCnyY/o2hk g4S3O/gKxwlFuVYri4roj/bOFmayCuuxL0IjuBmjihfwo2/X/5rtvic7ZXBctHG98DXs fHwcnbXBfkbVEn32VS7taymR9klF8Ab+46CzXRld21Pi2OST5SsoJRo9WEIK4PIWzLVl Lvw+Reu1hESXcaLEQv2XFxXuL08iQz18lSzpdRBiHSMZqQGms9XybTTL661/zBwcctGp naXpMZjeQ9cjx8Q9PSG2j/z9Qy7IOyguSWbWkHmwLU60Us6MJbtdSlJWVwvzuIy03H4S IRgg== X-Gm-Message-State: AFqh2kqy1Ygx2AwCzP0gaM2iJju4J3hQr4y6AqSvlGq4oifLN9HtBsVl 5lzZUK6keEHo2mx2+BfJqvc= X-Received: by 2002:a05:6a20:4295:b0:a8:8714:233b with SMTP id o21-20020a056a20429500b000a88714233bmr80647372pzj.57.1672924630106; Thu, 05 Jan 2023 05:17:10 -0800 (PST) Received: from debian.me (subs02-180-214-232-68.three.co.id. [180.214.232.68]) by smtp.gmail.com with ESMTPSA id q7-20020a170902a3c700b0018997f6fc88sm10893264plb.34.2023.01.05.05.17.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 05 Jan 2023 05:17:09 -0800 (PST) Received: by debian.me (Postfix, from userid 1000) id 8148B105232; Thu, 5 Jan 2023 20:17:00 +0700 (WIB) From: Bagas Sanjaya To: Linux CGroups , Linux Documentation , LKML , Linux Memory Management List Cc: Tejun Heo , Zefan Li , Johannes Weiner , Jonathan Corbet , Michal Hocko , Andrew Morton , Hugh Dickins , Shakeel Butt , Bagas Sanjaya Subject: [PATCH v2 9/9] docs: cgroup-v1: use numbered lists for user interface setup Date: Thu, 5 Jan 2023 20:16:34 +0700 Message-Id: <20230105131633.553574-10-bagasdotme@gmail.com> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230105131633.553574-1-bagasdotme@gmail.com> References: <20230105131633.553574-1-bagasdotme@gmail.com> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=3017; i=bagasdotme@gmail.com; h=from:subject; bh=nysWUkfThi/UCTzfZAv3ZXQWTYDkn/SrXnv8ebwTGco=; b=owGbwMvMwCX2bWenZ2ig32LG02pJDMnbzm5cWtCq0ng04TEHZ7mB8SLVvBOR8ztZH9yf/zX6aJlM um9YRykLgxgXg6yYIsukRL6m07uMRC60r3WEmcPKBDKEgYtTACbibcPwT83d3Ur0YVzhzYLHnCdO+i /VN2/wf6tmmSycLGTr8LlwKsN/L4kJ/ZbNi2Kc+F4s8DBN49CYLV1rXfH+fJz40j4rB2VOAA== X-Developer-Key: i=bagasdotme@gmail.com; a=openpgp; fpr=701B806FDCA5D3A58FFB8F7D7C276C64A5E44A1D X-Spam-Status: No, score=-0.6 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,RCVD_IN_SORBS_WEB,SPF_HELO_NONE,SPF_PASS 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1754188932884354001?= X-GMAIL-MSGID: =?utf-8?q?1754188932884354001?= Setup instructions for memory resource controller UI uses a mix of section headings and normal paragraphs, whereas numbered lists are better fit for this purpose. While at it, also slightly reword the instructions and add reference to "Why are cgroups needed?" in the main cgroups documentation. Signed-off-by: Bagas Sanjaya --- .../admin-guide/cgroup-v1/cgroups.rst | 2 ++ .../admin-guide/cgroup-v1/memory.rst | 26 ++++++++----------- 2 files changed, 13 insertions(+), 15 deletions(-) diff --git a/Documentation/admin-guide/cgroup-v1/cgroups.rst b/Documentation/admin-guide/cgroup-v1/cgroups.rst index b0688011ed06de..9343148ee99366 100644 --- a/Documentation/admin-guide/cgroup-v1/cgroups.rst +++ b/Documentation/admin-guide/cgroup-v1/cgroups.rst @@ -80,6 +80,8 @@ access. For example, cpusets (see Documentation/admin-guide/cgroup-v1/cpusets.rs you to associate a set of CPUs and a set of memory nodes with the tasks in each cgroup. +.. _cgroups-why-needed: + 1.2 Why are cgroups needed ? ---------------------------- diff --git a/Documentation/admin-guide/cgroup-v1/memory.rst b/Documentation/admin-guide/cgroup-v1/memory.rst index 16d938abe69f81..27d89495ac880a 100644 --- a/Documentation/admin-guide/cgroup-v1/memory.rst +++ b/Documentation/admin-guide/cgroup-v1/memory.rst @@ -387,30 +387,30 @@ U != 0, K >= U: 3. User Interface ================= -3.0. Configuration ------------------- +To use the user interface: -a. Enable CONFIG_CGROUPS -b. Enable CONFIG_MEMCG - -3.1. Prepare the cgroups (see cgroups.txt, Why are cgroups needed?) -------------------------------------------------------------------- - -:: +1. Enable CONFIG_CGROUPS and CONFIG_MEMCG options +2. Prepare the cgroups (see :ref:`Why are cgroups needed? + ` for the background information):: # mount -t tmpfs none /sys/fs/cgroup # mkdir /sys/fs/cgroup/memory # mount -t cgroup none /sys/fs/cgroup/memory -o memory -3.2. Make the new group and move bash into it:: +3. Make the new group and move bash into it:: # mkdir /sys/fs/cgroup/memory/0 # echo $$ > /sys/fs/cgroup/memory/0/tasks -Since now we're in the 0 cgroup, we can alter the memory limit:: +4. Since now we're in the 0 cgroup, we can alter the memory limit:: # echo 4M > /sys/fs/cgroup/memory/0/memory.limit_in_bytes + The limit can now be queried:: + + # cat /sys/fs/cgroup/memory/0/memory.limit_in_bytes + 4194304 + .. note:: We can use a suffix (k, K, m, M, g or G) to indicate values in kilo, mega or gigabytes. (Here, Kilo, Mega, Giga are Kibibytes, Mebibytes, @@ -422,10 +422,6 @@ Since now we're in the 0 cgroup, we can alter the memory limit:: .. note:: We cannot set limits on the root cgroup any more. -:: - - # cat /sys/fs/cgroup/memory/0/memory.limit_in_bytes - 4194304 We can check the usage::