Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp654031pxa; Tue, 11 Aug 2020 11:35:47 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyLRuEXy177ns82NjJK8i+zRjQFyFjdEfqyu6dx8iv2Ej1PAp15h0yDCx7U6JywqmJER0iC X-Received: by 2002:a17:906:7c4f:: with SMTP id g15mr2574539ejp.82.1597170947706; Tue, 11 Aug 2020 11:35:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597170947; cv=none; d=google.com; s=arc-20160816; b=SPEjUanPGRJ2htrpIYTI8X7RcWRtbBErxrXNZj3fQ0wz89m+371Cin5ltdPEoJOcgz kggar7Fpx5rdoTjXXcavdN172eR3S93+u4lSRc/vrwaZ24AgRJNBBM1rz/9oEUY6YI8Z UzN5KA7KtjX/chNyRley6JZHxtD4wSKwIxe7vIhq0US9lLZAAjRhTR8h6ZMfFEdvOiZY L36+U8P9XRXQqOFZfEkfN/Mie4obQDzDbskf+anhLVHYrX+Owfo4H8DaapD37VoX4s3U vG/HOumaVlIv+aoicG6fD48haHzqAdHhIsH1c8qvfOhccpB6k3eBNIBftdqTl+Y1b0KR wOoQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=zLw7YCxQ4FyIeYc1Zr5iwamPnDd5Ir9wpfeIxjtezUo=; b=jGy73ItfBbEVHP/gsLu+KXbeMzKBPHS3ONE1m7bTAr/8gCrMk8pUsYUbgYpVIZi020 zYhaoqTeXwR0mR8ERicXkBDkHfN5w3i41Gn4KwjRA0+7cai29eqjxDYKS6qqhI6V0Or2 Hc+SNKVp0OPFmBR1w2vXgKrqilhy9izPcDZPodiExOpkwn3Poimp1Tuh5+RixvtEHxSe SElzhV0/1q5CHcfvdIqKm0U4fHBctSBkhQjNFlJcK84XJ1av4BSjXHgvSbQrCqSZ7xZL RS+k9LFKGvr47sl0LWQ832gzf26qAGUD2fN4f70GMhcdpJ24xGzkcNtfqouG1buNqRiy j8Ew== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id 17si13563199ejw.686.2020.08.11.11.35.24; Tue, 11 Aug 2020 11:35:47 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725987AbgHKScc (ORCPT + 99 others); Tue, 11 Aug 2020 14:32:32 -0400 Received: from mx2.suse.de ([195.135.220.15]:59904 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725862AbgHKScc (ORCPT ); Tue, 11 Aug 2020 14:32:32 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 87132AC82; Tue, 11 Aug 2020 18:32:51 +0000 (UTC) Date: Tue, 11 Aug 2020 20:32:25 +0200 From: Michal =?iso-8859-1?Q?Koutn=FD?= To: Roman Gushchin Cc: Andrew Morton , Dennis Zhou , Tejun Heo , Christoph Lameter , Johannes Weiner , Michal Hocko , Shakeel Butt , linux-mm@kvack.org, kernel-team@fb.com, linux-kernel@vger.kernel.org Subject: Re: [PATCH v3 4/5] mm: memcg: charge memcg percpu memory to the parent cgroup Message-ID: <20200811183225.GA62582@blackbook> References: <20200623184515.4132564-1-guro@fb.com> <20200623184515.4132564-5-guro@fb.com> <20200729171039.GA22229@blackbody.suse.cz> <20200806211603.195727c03995c3a25ffc6d76@linux-foundation.org> <20200807043717.GA1231562@carbon.DHCP.thefacebook.com> <20200811144754.GA45201@blackbook> <20200811165527.GA1507044@carbon.DHCP.thefacebook.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="k1lZvvs/B4yU6o8G" Content-Disposition: inline In-Reply-To: <20200811165527.GA1507044@carbon.DHCP.thefacebook.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --k1lZvvs/B4yU6o8G Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Aug 11, 2020 at 09:55:27AM -0700, Roman Gushchin wrot= e: > As I said, there are 2 problems with charging systemd (or a similar daemo= n): > 1) It often belongs to the root cgroup. This doesn't hold for systemd (if we agree that systemd is the most common case). > 2) OOMing or failing some random memory allocations is a bad way > to "communicate" a memory shortage to the daemon. > What we really want is to prevent creating a huge number of cgroups There's cgroup.max.descendants for that... > (including dying cgroups) in some specific sub-tree(s). =2E..oh, so is this limiting the number of cgroups or limiting resources used? > OOMing the daemon or returning -ENOMEM to some random syscalls > will not help us to reach the goal and likely will bring a bad > experience to a user. If we reach the situation when memory for cgroup operations is tight, it'll disappoint the user either way. My premise is that a running workload is more valuable than the accompanying manager. > In a generic case I don't see how we can charge the cgroup which > creates cgroups without solving these problems first. In my understanding, "onbehalveness" is a concept useful for various kernel threads doing deferred work. Here it's promoted to user processes managing cgroups. > And if there is a very special case where we have to limit it, > we can just add an additional layer: >=20 > ` root or delegated root > ` manager-parent-cgroup-with-a-limit > ` manager-cgroup (systemd, docker, ...) > ` [aggregation group(s)] > ` job-group-1 > ` ... > ` job-group-n If the charge goes to the parent of created cgroup (job-cgroup-i here), then the layer adds nothing. Am I missing something? > I'd definitely charge the parent cgroup in all similar cases. (This would mandate the controllers on the unified hierarchy, which is fine IMO.) Then the order of enabling controllers on a subtree (e.g. cpu,memory vs memory,cpu) by the manager would yield different charging. This seems wrong^W confusing to me.=20 Thanks, Michal --k1lZvvs/B4yU6o8G Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEEoQaUCWq8F2Id1tNia1+riC5qSgFAl8y5DUACgkQia1+riC5 qShkEQ/+Nm08BsWmxXI72rR1oe/Tct4+M6N4pnmGnkh53373/NHFMIFRIVPANXyO bgafqQlVbpSnTT6wemU9fj/DCZp/CCR3fepcT7aoauQacOlPvlf579Hrhj7RU8hI h3PwqWwoUD9iK1V1hHZk+kEysHQx3y4N7UQfav4LtjlIqnHvzb9VfK8hjARtR1R+ i2t15zS9EEscmctY5Fx1uvnjzbpllj6MSJH8fhOi/5axW8b5pCfrvZ4pFUnB2t9Q CuKwWSidDmg9+Q+/xegZ12h3t+X+a/T+O+g9uH2D0R/28VexpI0MpzaOtpsXlQIb V4CPOGK9Glx3iPNc4IAPl1NHcusink/2RWBHKRkzCPS8gTywLKDFrilAtQ11y010 C0jjixQXO8of8OmktELfaqV7XUNgDru8TFpCQMAJOuyZ8Kt+1MxywRfNlieIsChJ NaMtXA6N72GrIIC+IFK1W+e4rTeuAnrolBg+KG7cgSAF1HgopyfyQvskaIlJcSzb qxawQebRsJx52Wz3NmHuHabefaua2n6Zuw8k/Ac0GBum4D7vxvmgpuKPXQjhqs5l plYP7ueHP3gxRSW32ho0sHtW9qB7+cReHPXN/FFTye7ICZ50N4bT4oWQpZh8vNBM ws9M9jzGjB+9QKDeECIDA7s0H9XJDMKVkXIS4RbdhLe2twuexOs= =4/65 -----END PGP SIGNATURE----- --k1lZvvs/B4yU6o8G--