Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp1602249pxb; Thu, 4 Mar 2021 16:03:18 -0800 (PST) X-Google-Smtp-Source: ABdhPJyCUIGCnNidB+R0Y9zzJHL18MI4EQ4qCAW2ZRZBP0XxCz+OXd0z1jn6P1GC74IxPPOt5UUh X-Received: by 2002:a05:6e02:1d02:: with SMTP id i2mr6396898ila.30.1614902598687; Thu, 04 Mar 2021 16:03:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1614902598; cv=none; d=google.com; s=arc-20160816; b=z5+bT+LhFWwtK5WAGjzmcD5F5q2jZZO/u8XaywEcv1Iw/DDqk0ijvgqgV5TbJR3I2P NQxSfEfcUxE1PwTTApIOFwQiAqKrpf83GkBrX47GQxTXp25zh0xMdGC7EneDib59ELmG r0v98XD6z8i0RR2tJDnP7GGU8s/1M2AAXWcVwaVq+NiquUGjlAKhxCN3NksM6/Bs0O00 KQRmrniIY/cGDzSNeqobWPP3URfnFcpzmHS+TcvsNxIwjYBYNB3/5xnwFnWcO/r5u5Vd 9MK4hZe2+nyO6WIaJnfENAXEA/doeG+5RE5xSgwq3oX8JqkmYXQ1v1uN0gIvzl9MD4Qw L5MA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=wrRdPDPB3VCRpfnlU4rkj1XLWJk4+xODxpIbuwpHG+Y=; b=QdGRMY9PryVDK/Bi6oIHDrUa30w069nVdLV9/0yzcCAyx0bQ2pDwLnHVxZOmcZEC7/ 0n/ZKtU9yZ0F/jYuKrl2YNsMqSeuIp1ugYq+M+n0R767nu0XKGs0w5ckloon629qoKMI otHTGeLuyQKPrV3AQ6k1NxxpUs18MWmabXthI7DNdLfBWGpV+Zp4ZfNgayX3kNCRoJNQ +rKKeCRTJq2FdN02eqbAYA2ZqcZYYa/iEOah8G1Ei4AthMb16kthHQtSVYGdrfQAXe7e fJFxac+NTNCOo/k1eEX17sZYoCvOpkaXXolkq13iB1bg/67DHPUmnJ6sQeTP9xxtkkyw IgUw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=Mym+BpeR; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id i4si1019992iov.52.2021.03.04.16.03.05; Thu, 04 Mar 2021 16:03:18 -0800 (PST) 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; dkim=pass header.i=@google.com header.s=20161025 header.b=Mym+BpeR; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234525AbhCDGNp (ORCPT + 99 others); Thu, 4 Mar 2021 01:13:45 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40590 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234061AbhCDGNT (ORCPT ); Thu, 4 Mar 2021 01:13:19 -0500 Received: from mail-pj1-x102b.google.com (mail-pj1-x102b.google.com [IPv6:2607:f8b0:4864:20::102b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C9BC4C061574 for ; Wed, 3 Mar 2021 22:12:38 -0800 (PST) Received: by mail-pj1-x102b.google.com with SMTP id ch11so140234pjb.4 for ; Wed, 03 Mar 2021 22:12:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=wrRdPDPB3VCRpfnlU4rkj1XLWJk4+xODxpIbuwpHG+Y=; b=Mym+BpeRKl4ppls7nPY+P84Wq2Ud/GZk6tA0DczxIwInISgM7CE1f2mF7YJfODiqK4 XH3AcCKqc8EP1qDxSnxZfc3OaZgrLZjYhMxoQGdzAX9eRqIwn5TrLUe3aVvj1+95nlc4 t+mWhOGTQervTzGSIfWDK0WpFFPiX1V/GhAgaMZQciXUpe3mRBZ2L2WcSt9gj0fbV+Nn ADWTRRnbMc4R+ee4X2l6udt04Tmxxf/PoypVtrzbHnC99T6/ZF3jFsQeGHxoRLFcd6su kjOdjT8wTHO84LDxBLDEo2trTu7feZ3mQESF3hDu+dWyyHlkU3nAlu8jZB26xsWoMJwP Iv9w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=wrRdPDPB3VCRpfnlU4rkj1XLWJk4+xODxpIbuwpHG+Y=; b=inaC4BMoJzHl/Wz/sIGJFmP5FvI7W6lpZg61iF7PArD+z1AFYg2Sl6jqMbGCuu3BqQ Lqeg6eBwPoPQk/tupw+vUk6he/KfY6czXbn0M8euln78E9OrVUXUwHLZCqFa9JrBSnhL J/N1cC+4tEDtAyjdfaHfpcY8DRnBkKyJhX6xzNxhrVY/65gz4ojbu+Ljh/OQGs3eegiu Qx8BPUIApXsTXBDHFr+B4SB7OSgthNJboUwAsLnXT6C3n7FsbHG3tI38elImO7MBcVio JBN4n7JT5mND6JKaE22I0Otmf2vENWSMA8gBCipscbj2Vz4a/rPhQDOLJcfPMz5jYyEa Wk7A== X-Gm-Message-State: AOAM530djcBLfV9pBQ7qidroBZDtdsHcn1dEEJLISECGNEWFilEemE9w iCLwC3s5HEIT9MOAUs3NT8wNFg== X-Received: by 2002:a17:90a:31cf:: with SMTP id j15mr2749433pjf.41.1614838358171; Wed, 03 Mar 2021 22:12:38 -0800 (PST) Received: from google.com ([2620:0:1008:10:5ddf:a7e:5239:ef47]) by smtp.gmail.com with ESMTPSA id e1sm8477557pjt.10.2021.03.03.22.12.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Mar 2021 22:12:37 -0800 (PST) Date: Wed, 3 Mar 2021 22:12:32 -0800 From: Vipin Sharma To: Tejun Heo Cc: mkoutny@suse.com, rdunlap@infradead.org, thomas.lendacky@amd.com, brijesh.singh@amd.com, jon.grimm@amd.com, eric.vantassell@amd.com, pbonzini@redhat.com, hannes@cmpxchg.org, frankja@linux.ibm.com, borntraeger@de.ibm.com, corbet@lwn.net, seanjc@google.com, vkuznets@redhat.com, wanpengli@tencent.com, jmattson@google.com, joro@8bytes.org, tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, hpa@zytor.com, gingell@google.com, rientjes@google.com, dionnaglaze@google.com, kvm@vger.kernel.org, x86@kernel.org, cgroups@vger.kernel.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [RFC v2 1/2] cgroup: sev: Add misc cgroup controller Message-ID: References: <20210302081705.1990283-1-vipinsh@google.com> <20210302081705.1990283-2-vipinsh@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Mar 03, 2021 at 10:42:37AM -0500, Tejun Heo wrote: > > + atomic_t usage; > > +}; > > Can we do 64bits so that something which counts memory can use this too? > Sure. > > + > > + if (usage > capacity) > > + return -EBUSY; > > I'd rather go with allowing bringing down capacity below usage so that the > users can set it to a lower value to drain existing usages while denying new > ones. It's not like it's difficult to check the current total usage from the > caller side, so I'm not sure it's very useful to shift the condition check > here. > Okay, I will change the code to set new capacity unconditionally. Right now there is no API for the caller to know total usage, unless they keep their own tally, I was thinking it will be useful to add one more API unsigned long misc_cg_res_total_usage(enum misc_res_type type) It will return root_cg usage for "type" resource. Will it be fine? > > + pr_info("cgroup: charge rejected by misc controller for %s resource in ", > > + misc_res_name[type]); > > + pr_cont_cgroup_path(i->css.cgroup); > > + pr_cont("\n"); > > Should have commented on this in the priv thread but don't print something > on every rejection. This often becomes a nuisance and can make an easy DoS > vector at worst. If you wanna do it, print it once per cgroup or sth like > that. I didn't think in that way. Thanks, I will print it once per cgroup. Thanks Vipin