Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752060AbdHPOoT (ORCPT ); Wed, 16 Aug 2017 10:44:19 -0400 Received: from mx0b-00082601.pphosted.com ([67.231.153.30]:54618 "EHLO mx0b-00082601.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751461AbdHPOoQ (ORCPT ); Wed, 16 Aug 2017 10:44:16 -0400 Date: Wed, 16 Aug 2017 15:43:44 +0100 From: Roman Gushchin To: David Rientjes CC: , Michal Hocko , Vladimir Davydov , Johannes Weiner , Tetsuo Handa , Tejun Heo , , , , Subject: Re: [v5 4/4] mm, oom, docs: describe the cgroup-aware OOM killer Message-ID: <20170816144344.GA29131@castle.DHCP.thefacebook.com> References: <20170814183213.12319-1-guro@fb.com> <20170814183213.12319-5-guro@fb.com> <20170815141350.GA4510@castle.DHCP.thefacebook.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.8.3 (2017-05-23) X-Originating-IP: [2620:10d:c092:200::1:b605] X-ClientProxiedBy: VI1PR09CA0061.eurprd09.prod.outlook.com (2603:10a6:802:28::29) To CO1PR15MB1078.namprd15.prod.outlook.com (2a01:111:e400:7b66::8) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 38f8e5a2-a73c-405d-0026-08d4e4b53bd8 X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(300000500095)(300135000095)(300000501095)(300135300095)(22001)(300000502095)(300135100095)(2017030254152)(300000503095)(300135400095)(201703131423075)(201703031133081)(201702281549075)(300000504095)(300135200095)(300000505095)(300135600095)(300000506095)(300135500095);SRVR:CO1PR15MB1078; X-Microsoft-Exchange-Diagnostics: 1;CO1PR15MB1078;3:z3ab0g9GJUfqk13x+Lr44bDf3bo43M9Sf2iv1nIHKoOezkDoKgFlh4DTT4ME7mqoIRNYf7FPCQUsMFMkt7yImfI/X5uLKCIaZaBv/XnsZ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OHgElcavQXKa/OPcsc5+7akuS1H6hBcwCTL69uzVYm9WFq979wLSqR0sTc0FdEv4ZwcBhUVwBBwADZnZcIwt930ssKBv+L2Az6CZvcc8T+oBK+AC5i+a0+vRbj+6qKlAk/Ew6ZAVaygDwygknBgrQ+1ZDtsjoYf9IpKEhrquOi3BTD2ZC7hwrN/KXEhs2wXsZQpOcMHmV4ACRmu0l7M8Ho5Vwv94pN9ZZk1aIPfo/9JW4JVKWGdHTsrMJ;4:EjetVfG3gUEAT72cpBHtBDa/fWjwhMfMY5bsO5nPz6tSvBsTQ8AIiXhOMcQ+a7l7xPQfDf41jveQhSJJe3d3NbE1orES5PTkW0dt9/VeD1pEXwr2FVvqd7Hxg7yShhM2qGfC355mkyB+9Sden9glgDAjz8Y2N+r23WQONx7HwV62aL+uus/dqioNYgJ1ij/Yx0h4AInOqX7gMOHCUQT7QqkooTDky0eiYLK214NmqyomiAQclmk3JFIFH+tRwBPNFKL/tVj2TmSVyWn9GnxJfBB03XiUWP6aJyzWOh0frSc= X-Exchange-Antispam-Report-Test: UriScan:(60795455431006); X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(601004)(2401047)(8121501046)(5005006)(93006095)(93001095)(10201501046)(100000703101)(100105400095)(3002001)(6041248)(20161123558100)(20161123555025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123562025)(20161123560025)(20161123564025)(6072148)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095);SRVR:CO1PR15MB1078;BCL:0;PCL:0;RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095);SRVR:CO1PR15MB1078; X-Forefront-PRVS: 0401647B7F X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10019020)(4630300001)(7370300001)(6009001)(24454002)(199003)(189002)(81166006)(47776003)(101416001)(81156014)(105586002)(8676002)(6246003)(42186005)(50466002)(2906002)(97736004)(305945005)(76176999)(7736002)(50986999)(54356999)(4326008)(54906002)(55016002)(9686003)(478600001)(229853002)(5890100001)(106356001)(53936002)(83506001)(110136004)(6506006)(25786009)(5660300001)(7416002)(6116002)(7350300001)(1076002)(189998001)(23726003)(2950100002)(6916009)(86362001)(6666003)(33656002)(68736007)(4001350100001)(93886004)(18370500001)(42262002);DIR:OUT;SFP:1102;SCL:1;SRVR:CO1PR15MB1078;H:castle.DHCP.thefacebook.com;FPR:;SPF:None;PTR:InfoNoRecords;A:1;MX:1;LANG:en; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1;CO1PR15MB1078;23:acW28jvni7CRizuHI5SisgD0k+QVGLEIDeay7KrCu?= =?us-ascii?Q?tR+Rqy7vw85pNSFjNqkG0dy9ERJMKo0pDDsqnjauET8JeTyn00d8TvlEGq10?= =?us-ascii?Q?prtP1FZWhdetKFD/7GnfJTQT8HY/9fLxIu5eEo7tJBKY+iwr9IxifkKP4etW?= =?us-ascii?Q?bJnOxtC+wVh4hx77vvgs78sZQrWat7iiE32NJU0QFLI3cANUrawSyUmgtkcF?= =?us-ascii?Q?TZ4kdMHWhHOLPVMC+ZhwrHKZDGXw7FcNGuEb6vvUoEQ5XOxgAVVJQBC07Acl?= =?us-ascii?Q?WEP/88at3vcPAsRdso4MdmWE+iZFdpqR/AM/r+ngvkNQB+3pJqgFvT616AZD?= =?us-ascii?Q?eIa6ZAmD9cDp/QlL+BuEuFDL3XAFDfBoEc2ncBBHV2PTaw5bQBTqCsDJoSpQ?= =?us-ascii?Q?OTd1IDvRLHe4RCRCHSE14NYv6Snpx8mDToVTKKGY9q8CjWOOwCRmrxnS7ism?= =?us-ascii?Q?m1Ukh7uMDwcBZFnSKM7e/8Nw1GuLw2KmVcN1v1M5ENsz5WdcUJi2zqbFlbcC?= =?us-ascii?Q?+2/6YX5Ozixn8EEu7C2zFRYYYyt8arswUNuvcCx105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U9XMPFE5syoJXaOOm2m5AKHipcMYNpqOLXqxAmlrPqVt+teRfZmiP/uB36gqCdHp4l0qxulAMmDlUzjRU2FEsWPf38Q2P1nOvwQ3uvPc0CoyQ/Nb2tFv2rCepLW+xM8Ff1+PCRKf6/zBkgpgdjBwb6iGzEhFb1PAGyXCt7vuDUSGGxF5zMky7dVARHgVg2vg==;5:IfSGn7V3jr7HR8V+njyXGsAXXZarKJeFkQuGe0h/s0q8Tak9pXQtHD2BL0deh8z3URcdHaWQ3vprUBQE1ljp0aRnNgf2NIJkG2MoFMAD/7DCLCUxUmAu/e22PxcvcEjuwj4Rzq94s+iTigal6c+bDQ==;24:/0BTTNUzAja9d9S8X8hPwsDGrp++cx7sYmh4ZCKGSKwyThe2NBOvNZb8wQ4Mj+ysguzjsyOPptOXnLuegHuwrZsQHg7lwNsioSq4x6YvygI=;7:PekIUU5IRaxr7heF4fzbQzCvpDMOh+kdq55u0bmRWUA7TZSryY9ITj0E58aX5ZlUcHsx4NWbdI4ZDZzxbqae6iR4ALmCDqxnj/Vyd9E+fWSvpG0/ziPfyuZnBbchhg/u5jjNaQLfKeIi2Hwq+/pAkZDY17w5KZivdQYzk/k56E5RnI/fd58gVUGu/8FYmQ/A0AYCaNLWlAUo9wJPbZglePxiX9VgPs8FNJyFHxHydGs= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1;CO1PR15MB1078;20:e5ZEtMao82lM4Mtws93AB0jxIUksVMuN3p7UHSPIg35qcw3FYA1nv8PajhhLFuZ5lfq5c9HOGNvzqOUXA2zEP44Iy6IrMVMB5hrYxCWakJBCSSrr25hTk7nkyc44iN940DiIEJRw8Rw9AayKSUCtFpAuX/d4e6UUh5zuhhEC6y8= X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Aug 2017 14:43:57.9994 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: CO1PR15MB1078 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-08-16_05:,, signatures=0 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 3768 Lines: 86 On Tue, Aug 15, 2017 at 01:56:24PM -0700, David Rientjes wrote: > On Tue, 15 Aug 2017, Roman Gushchin wrote: > > > > > diff --git a/Documentation/cgroup-v2.txt b/Documentation/cgroup-v2.txt > > > > index dec5afdaa36d..22108f31e09d 100644 > > > > --- a/Documentation/cgroup-v2.txt > > > > +++ b/Documentation/cgroup-v2.txt > > > > @@ -48,6 +48,7 @@ v1 is available under Documentation/cgroup-v1/. > > > > 5-2-1. Memory Interface Files > > > > 5-2-2. Usage Guidelines > > > > 5-2-3. Memory Ownership > > > > + 5-2-4. Cgroup-aware OOM Killer > > > > > > Random curiousness, why cgroup-aware oom killer and not memcg-aware oom > > > killer? > > > > I don't think we use the term "memcg" somewhere in v2 docs. > > Do you think that "Memory cgroup-aware OOM killer" is better? > > > > I think it would be better to not describe it as its own entity, but > rather a part of how the memory cgroup works, so simply describing it in > section 5-2, perhaps as its own subsection, as how the oom killer works > when using the memory cgroup is sufficient. I wouldn't separate it out as > a distinct cgroup feature in the documentation. Ok I've got the idea, let me look, what I can do. I'll post an updated version soon. > > > > > + cgroups. The default is "0". > > > > + > > > > + Defines whether the OOM killer should treat the cgroup > > > > + as a single entity during the victim selection. > > > > > > Isn't this true independent of the memory.oom_kill_all_tasks setting? > > > The cgroup aware oom killer will consider memcg's as logical units when > > > deciding what to kill with or without memory.oom_kill_all_tasks, right? > > > > > > I think you cover this fact in the cgroup aware oom killer section below > > > so this might result in confusion if described alongside a setting of > > > memory.oom_kill_all_tasks. > > > > > I assume this is fixed so that it's documented that memory cgroups are > considered logical units by the oom killer and that > memory.oom_kill_all_tasks is separate? The former defines the policy on > how a memory cgroup is targeted and the latter defines the mechanism it > uses to free memory. Yes, I've fixed this. Thanks! > > > > +Cgroup-aware OOM Killer > > > > +~~~~~~~~~~~~~~~~~~~~~~~ > > > > + > > > > +Cgroup v2 memory controller implements a cgroup-aware OOM killer. > > > > +It means that it treats memory cgroups as first class OOM entities. > > > > + > > > > +Under OOM conditions the memory controller tries to make the best > > > > +choise of a victim, hierarchically looking for the largest memory > > > > +consumer. By default, it will look for the biggest task in the > > > > +biggest leaf cgroup. > > > > + > > > > +Be default, all cgroups have oom_priority 0, and OOM killer will > > > > +chose the largest cgroup recursively on each level. For non-root > > > > +cgroups it's possible to change the oom_priority, and it will cause > > > > +the OOM killer to look athe the priority value first, and compare > > > > +sizes only of cgroups with equal priority. > > > > > > Maybe some description of "largest" would be helpful here? I think you > > > could briefly describe what is accounted for in the decisionmaking. > > > > I'm afraid that it's too implementation-defined to be described. > > Do you have an idea, how to describe it without going too much into details? > > > > The point is that "largest cgroup" is ambiguous here: largest in what > sense? The cgroup with the largest number of processes attached? Using > the largest amount of memory? > > I think the documentation should clearly define that the oom killer > selects the memory cgroup that has the most memory managed at each level. No problems, I'll add a clarification. Thank you!