Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753875AbdIDOWG (ORCPT ); Mon, 4 Sep 2017 10:22:06 -0400 Received: from mx0a-00082601.pphosted.com ([67.231.145.42]:47492 "EHLO mx0a-00082601.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753774AbdIDOWC (ORCPT ); Mon, 4 Sep 2017 10:22:02 -0400 From: Roman Gushchin To: CC: Roman Gushchin , Michal Hocko , Vladimir Davydov , Johannes Weiner , Tetsuo Handa , Andrew Morton , David Rientjes , Tejun Heo , , , , Subject: [v7 4/5] mm, oom, docs: describe the cgroup-aware OOM killer Date: Mon, 4 Sep 2017 15:21:07 +0100 Message-ID: <20170904142108.7165-5-guro@fb.com> X-Mailer: git-send-email 2.13.5 In-Reply-To: <20170904142108.7165-1-guro@fb.com> References: <20170904142108.7165-1-guro@fb.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [2620:10d:c092:200::1:6ba5] X-ClientProxiedBy: HE1PR05CA0180.eurprd05.prod.outlook.com (2603:10a6:3:f8::28) To DM3PR15MB1084.namprd15.prod.outlook.com (2603:10b6:0:12::10) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: b8f202f6-963e-45fc-81bc-08d4f3a04765 X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(300000500095)(300135000095)(300000501095)(300135300095)(22001)(300000502095)(300135100095)(2017030254152)(300000503095)(300135400095)(2017052603199)(201703131423075)(201703031133081)(201702281549075)(300000504095)(300135200095)(300000505095)(300135600095)(300000506095)(300135500095);SRVR:DM3PR15MB1084; X-Microsoft-Exchange-Diagnostics: 1;DM3PR15MB1084;3:NWgfris5rZ/iAoaAYIUaKXOxbn8/ny6BvJxKZaU2HLahGjxTvkAgkjN9PMFjBxY5XpXl2boEoW/n/I+DhPyOyYboTAuWk2TXhvQx7VcjAgFH40EjRmt5rKmhD28GLTxr3Dz9yTBIHsHvtSLDbEN6Z4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yKtQWdEprvO19iK5TJloC6DV99rxY2T/o4VkNC8oDfkkGSC19IzRes3iHm1T+XWKT9ov8jrQP/N3cOnI0mtWfiy+TKvA76TBf25aEkhWKE13qA5aLXwC6Fb7q6d5yAUCsXKOuEK3tLDOrZbmTzHXh9l8+rdDOw9Dvy7PvSM5rwPC1TA8IIL+zdRTxnp X-Exchange-Antispam-Report-Test: UriScan:(60795455431006)(9452136761055)(67672495146484)(211936372134217)(153496737603132); X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(2401047)(8121501046)(5005006)(100000703101)(100105400095)(3002001)(93006095)(93001095)(10201501046)(920507026)(6041248)(20161123564025)(20161123555025)(20161123560025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123562025)(20161123558100)(6072148)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095);SRVR:DM3PR15MB1084;BCL:0;PCL:0;RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095);SRVR:DM3PR15MB1084; X-Microsoft-Exchange-Diagnostics: 1;DM3PR15MB1084;4:DWhADMj9pzaoaD4p4B3VkclrAb/zASpoP5vnNtUgbcc8RR7E7cnAOh3JNU2Ts6ZqdZE5/qIxmkZu08YWJxNquaSZauV29phHfkk5CqHAFUspN7h0wqiZPcJsprSV5/lIVwAwg4VKzxPRXmfxPCEOU6JcXuVgRViRWinrtgsuFonbFJeehb2UuLPCI8u/Qj0im5n7nB6TLl5xM9p6pmONk/RFsYkLr+8RInkkmmRbLO4PQLnTxrsUp81ElF5Zq4lsSFANStxHAL6WgCIeBViVsSDZNp7mG15g9renU03rZQjCO0ESFWT54kMd8SBlPayPsm7RNvtLGRhjFdYAsOvEtxflM8ovlRr2Uj4pcmzbiHSZWT8p7vLqy6HFHqzlRQcCgTOnewoOb8lYcXEc25PTJW0Hz1Wx8zF3dwj1Sx+3NMnhv8RnQFZo7lcUVf1OD3TX X-Forefront-PRVS: 0420213CCD X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10019020)(6009001)(189002)(199003)(86362001)(6666003)(53936002)(1076002)(5890100001)(48376002)(33646002)(50466002)(189998001)(7416002)(69596002)(97736004)(305945005)(6506006)(7736002)(6486002)(5660300001)(6916009)(2950100002)(34040400001)(101416001)(105586002)(6512007)(25786009)(5003940100001)(4326008)(76176999)(50986999)(81156014)(54906002)(36756003)(53416004)(8936002)(2361001)(81166006)(106356001)(2351001)(42186005)(8676002)(110136004)(47776003)(2906002)(39060400002)(50226002)(478600001)(68736007)(6116002)(42262002);DIR:OUT;SFP:1102;SCL:1;SRVR:DM3PR15MB1084;H:castle.thefacebook.com;FPR:;SPF:None;PTR:InfoNoRecords;MX:1;A:1;LANG:en; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1;DM3PR15MB1084;23:X5lNC9KQsSLSCxNMQvDxvEzvARLxQsjWdDMHmmuXy?= =?us-ascii?Q?UTezvNuWUjBocdoXKWeMHZAGbST+UiJxYGYNrkFjwPGLTh3SfFay6iKi7jVA?= =?us-ascii?Q?kqOQO9NXBujiPTllQZ+zj3OWDNEsCDIXHY+XDFWaudGRM6WCK6Tf+7jq1pBT?= =?us-ascii?Q?cy/MjJw78J1VUxjJQQ5SNtVtC/jWa33wLJ9QaDlR5WfvyR7MhBAbimtALrcc?= =?us-ascii?Q?jt+LIuDZF/+Oa5b2+/P5ejQ6AFe8sdh7ZbYnUtd4BBVpltEgvxGe3fVU0whr?= =?us-ascii?Q?wRYjaDz0AfmkqCfMkJU4bJHR/61rdIifO3nGH/JHXH55UEc8lINe8Fwtl58N?= =?us-ascii?Q?eL3Oinc3TB3APtCyJPcYMGEuavr7jClkZrLH7W5jFLQ+01Afnd/ABrU2y2GA?= =?us-ascii?Q?Q7pEH7FqlNh2PCL29NRygnT0gTcIJtdXJSZJ1BamFDV44XOOeJ0bUsQq/PNz?= =?us-ascii?Q?blnAdqkHcGZiebQnnvHjBDsKW+vAHCRvVbc3S/nUQ6L965EfTcC6e06a5FdH?= =?us-ascii?Q?WeMeFNmAAw2oe2QiZIIDJfyx3rMxAcZWymkLgVk74mJAfp4Jd4gq0BDmNoOU?= =?us-ascii?Q?vVMog8Avt2JIKALMIZNH42/J1Kx+46OM6K/hky7LzFNoT2bpGtG0ta05w152?= =?us-ascii?Q?zedYi4JBr1ESGaYd0W8vl3ZCfe+bOwYrgkB9UdgpekvZQGMsmFWaQ4JNbYVZ?= =?us-ascii?Q?ju+vFELuQykjCXqzdzDcIWELtU8i18SpNNiBTWw0ohlYY3IYRzevmMPfUxsk?= =?us-ascii?Q?JtgEji08OpW1V2/m187ZAQ1sazFi/ghbgKVAQzZ2SwQTKuWUz10yi+3OeVKU?= =?us-ascii?Q?rrx0qnYdSJjB2d44fTYs4+7rC2JNUaXOx4QBfdPLV4J3m3Yea+EJ51FKjHH5?= =?us-ascii?Q?V150foSUBtsPkz1WZzacoQEZPzJYwuKInAWp9uzuBvyb+Bf74mxWBj0EzS8B?= =?us-ascii?Q?WxNc7+TzEpBUWTauYnBOZ6AZMhNE7VKKcmmFXlGxo2tEsfo22774Cw2U2HUW?= =?us-ascii?Q?+oTQT8PZBr15/kG6t0NekW9TFG5xePNMsf5Kzz/rypmhmq9z0s1gYT/USV3u?= =?us-ascii?Q?RHUZagXWo2VeL0jV8rGnIeB+Lsi2I+hD5bGthrm8jvqrgvxISBGtrANvCs/S?= =?us-ascii?Q?0zQb9vEuilyzojI/Qw41emg2wH3TXjCY3v/+BrqKPb+boVd4w9HiQ6u9/BQf?= =?us-ascii?Q?D6E29cAm161b/tK0Z7NPmbggepqZY/Wird7iCdR/EXgboYy5DKCzFCq/Q=3D?= =?us-ascii?Q?=3D?= X-Microsoft-Exchange-Diagnostics: 1;DM3PR15MB1084;6:U5l9eQhzPym/rvCXE8qUpMYgOW6J7wmLPRZMgTlVMxayEdYuQ406meJjanbfPYvDi3PEFEX2fN8HaMyk88v2nnu1Jza+7KNQRlHYdlegT5GvX5obk9WiJYeKaJGAbdZpeYu/bB8PHtGHBBW/auNb36CJoAb+/WnctzTSvZtcUPfYbpayOIlYI1nIQHHQKLsYIRnKyZCuFJJuAdyOVjXlxu5FA6ZznwWoWm+V60RfO2on56MZEhhedonara6bEk0FoVJAZEbBZ4CGUC/m2e+nCUG9rxbe1ajwYtwY/plQpkZjKUc2aeuhwU/eUywbg7SPS06x9CzvnkpCPoOPlIV1cg==;5:vcSblum2VpHdol9VdFTKm2pZyL5XEwGumVAp7Fr+1vuMN3d3CtocF+CjBqTAeNn6VM13tG29xqMRjmXusG22sfBWh8SZ189vdRWnZ9rHBNCLFaeWOYBGTiX92diya0cHVbTDvY0r+Rd8bEZDVc38dA==;24:D+M9RSwFX3UHe08QjIhgNbv6SLJP20D9BaAifz/A1YVRl2rV8S/vbQQcr/tubIA2aWmbcQ6Qa2GOz3hJsz4qiTFmlj/WsJFyzbIentYl5tc=;7:cl2VZprVcNo+zlb4IWQVrsUS79PiQ/j8fJY3E935joPWFeMTP0TKw2mujFhRRE6HCU7POgvKQywFzW8+hQR9CPoA+rGvvmJj9yQlEW2kw07eMINYZhSFJgfZVLAmvPSQw5ZaEI7G+dfhW05vyOOcCW/BMpSJWr4GazM+Gi8UODqf9U6O2gszmStsK5jiRqq3VfzwCd/oVq8vUD7w1fR5eDM7ifmD+XsY9NuOSaCTb6k= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1;DM3PR15MB1084;20:mkKBKQ7bpiMfgk1qVDbw8JtuoPDTB8da2p39qatInNpvS6iCAbet7nR2cJxvxUFdzM08Hc9Fw8w338HBlqhFsH/C8PGYpBafTZYteqfHPJ66gOKxfjRwZ5QFSsy9IJLKdgAdBtVKBkEVWSI7jfJPozt1EhiensFDi9tZHytXImo= X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Sep 2017 14:21:45.5482 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 8ae927fe-1255-47a7-a2af-5f3a069daaa2 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM3PR15MB1084 X-OriginatorOrg: fb.com X-Proofpoint-Spam-Reason: safe X-FB-Internal: Safe X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2017-09-04_09:,, signatures=0 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 3518 Lines: 102 Update cgroups v2 docs. Signed-off-by: Roman Gushchin Cc: Michal Hocko Cc: Vladimir Davydov Cc: Johannes Weiner Cc: Tetsuo Handa Cc: Andrew Morton Cc: David Rientjes Cc: Tejun Heo Cc: kernel-team@fb.com Cc: cgroups@vger.kernel.org Cc: linux-doc@vger.kernel.org Cc: linux-kernel@vger.kernel.org Cc: linux-mm@kvack.org --- Documentation/cgroup-v2.txt | 56 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) diff --git a/Documentation/cgroup-v2.txt b/Documentation/cgroup-v2.txt index a86f3cb88125..5d21bd2e7d55 100644 --- a/Documentation/cgroup-v2.txt +++ b/Documentation/cgroup-v2.txt @@ -44,6 +44,7 @@ CONTENTS 5-2-1. Memory Interface Files 5-2-2. Usage Guidelines 5-2-3. Memory Ownership + 5-2-4. OOM Killer 5-3. IO 5-3-1. IO Interface Files 5-3-2. Writeback @@ -799,6 +800,33 @@ PAGE_SIZE multiple when read back. high limit is used and monitored properly, this limit's utility is limited to providing the final safety net. + memory.oom_group + + A read-write single value file which exists on non-root + cgroups. The default is "0". + + If set, OOM killer will kill all processes attached to the cgroup + if selected as an OOM victim. + + OOM killer respects the /proc/pid/oom_score_adj value -1000, + and will never kill the unkillable task, even if memory.oom_group + is set. + + memory.oom_priority + + A read-write single value file which exists on non-root + cgroups. The default is "0". + + An integer number, which defines the order in which + the OOM killer selects victim memory cgroups. + + OOM killer prefers memory cgroups with larger priority if they + are populated with eligible tasks. + + The oom_priority value is compared within sibling cgroups. + + The root cgroup has the oom_priority 0, which cannot be changed. + memory.events A read-only flat-keyed file which exists on non-root cgroups. @@ -1028,6 +1056,34 @@ POSIX_FADV_DONTNEED to relinquish the ownership of memory areas belonging to the affected files to ensure correct memory ownership. +5-2-4. OOM Killer + +Cgroup v2 memory controller implements a cgroup-aware OOM killer. +It means that it treats cgroups as first class OOM entities. + +Under OOM conditions the memory controller tries to make the best +choice of a victim, hierarchically looking for a cgroup with the +largest oom_priority. If sibling cgroups have the same priority, +the OOM killer selects one which is the largest memory consumer. + +By default, OOM killer will kill the biggest task in the selected +memory cgroup. A user can change this behavior by enabling +the per-cgroup oom_group option. If set, it causes the OOM killer +to kill all processes attached to the cgroup. + +Tasks in the root cgroup are treated as independent memory consumers, +and are compared with other memory consumers (memory cgroups and +other tasks in root cgroup). +The root cgroup doesn't support the oom_group feature. + +This affects both system- and cgroup-wide OOMs. For a cgroup-wide OOM +the memory controller considers only cgroups belonging to the sub-tree +of the OOM'ing cgroup. + +If there are no cgroups with the enabled memory controller, +the OOM killer is using the "traditional" process-based approach. + + 5-3. IO The "io" controller regulates the distribution of IO resources. This -- 2.13.5