All of lore.kernel.org
 help / color / mirror / Atom feed
From: Vipin Sharma <vipinsh-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org>
To: Tejun Heo <tj-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
Cc: mkoutny-IBi9RG/b67k@public.gmane.org,
	rdunlap-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org,
	thomas.lendacky-5C7GfCeVMHo@public.gmane.org,
	brijesh.singh-5C7GfCeVMHo@public.gmane.org,
	jon.grimm-5C7GfCeVMHo@public.gmane.org,
	eric.vantassell-5C7GfCeVMHo@public.gmane.org,
	pbonzini-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org,
	hannes-druUgvl0LCNAfugRpC6u6w@public.gmane.org,
	frankja-tEXmvtCZX7AybS5Ee8rs3A@public.gmane.org,
	borntraeger-tA70FqPdS9bQT0dZR+AlfA@public.gmane.org,
	corbet-T1hC0tSOHrs@public.gmane.org,
	seanjc-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org,
	vkuznets-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org,
	wanpengli-1Nz4purKYjRBDgjK7y7TUQ@public.gmane.org,
	jmattson-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org,
	joro-zLv9SwRftAIdnm+yROfE0A@public.gmane.org,
	tglx-hfZtesqFncYOwBW4kG4KsQ@public.gmane.org,
	mingo-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org,
	bp-Gina5bIWoIWzQB+pC5nmwQ@public.gmane.org,
	hpa-YMNOUZJC4hwAvxtiuMwx3w@public.gmane.org,
	gingell-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org,
	rientjes-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org,
	dionnaglaze-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org,
	kvm-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	x86-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org,
	cgroups-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-doc-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: [RFC v2 1/2] cgroup: sev: Add misc cgroup controller
Date: Wed, 3 Mar 2021 22:12:32 -0800	[thread overview]
Message-ID: <YEB6ULUgbf+s8ydd@google.com> (raw)
In-Reply-To: <YD+ubbB4Tz0ZlVvp-NiLfg/pYEd1N0TnZuCh8vA@public.gmane.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

WARNING: multiple messages have this Message-ID (diff)
From: Vipin Sharma <vipinsh@google.com>
To: Tejun Heo <tj@kernel.org>
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
Date: Wed, 3 Mar 2021 22:12:32 -0800	[thread overview]
Message-ID: <YEB6ULUgbf+s8ydd@google.com> (raw)
In-Reply-To: <YD+ubbB4Tz0ZlVvp@slm.duckdns.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

  parent reply	other threads:[~2021-03-04  6:12 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-02  8:17 [RFC v2 0/2] cgroup: New misc cgroup controller Vipin Sharma
2021-03-02  8:17 ` [RFC v2 1/2] cgroup: sev: Add " Vipin Sharma
2021-03-03 15:42   ` Tejun Heo
     [not found]     ` <YD+ubbB4Tz0ZlVvp-NiLfg/pYEd1N0TnZuCh8vA@public.gmane.org>
2021-03-04  6:12       ` Vipin Sharma [this message]
2021-03-04  6:12         ` Vipin Sharma
2021-03-04  8:53         ` Tejun Heo
2021-03-02  8:17 ` [RFC v2 2/2] cgroup: sev: Miscellaneous cgroup documentation Vipin Sharma
2021-03-04  2:55   ` Jacob Pan
2021-03-04  2:55     ` Jacob Pan
2021-03-04  6:22     ` Vipin Sharma
     [not found]       ` <YEB8i6Chq4K/GGF6-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org>
2021-03-04  8:51         ` Tejun Heo
2021-03-04  8:51           ` Tejun Heo
2021-03-12 20:58           ` Jacob Pan
2021-03-12 20:58             ` Jacob Pan
2021-03-12 21:15             ` Vipin Sharma
2021-03-12 21:15               ` Vipin Sharma
2021-03-12 22:59               ` Jacob Pan
2021-03-12 22:59                 ` Jacob Pan
2021-03-13 10:20                 ` Tejun Heo
2021-03-13 10:20                   ` Tejun Heo
2021-03-13 16:57                   ` Jacob Pan
2021-03-13 16:57                     ` Jacob Pan
2021-03-13 18:05                     ` Tejun Heo
2021-03-13 18:05                       ` Tejun Heo
2021-03-15 22:11                       ` Jacob Pan
2021-03-15 22:11                         ` Jacob Pan
2021-03-15 22:19                         ` Tejun Heo
2021-03-15 22:19                           ` Tejun Heo
2021-03-15 23:40                           ` Jacob Pan
2021-03-15 23:40                             ` Jacob Pan
2021-03-15 23:54                             ` Tejun Heo
2021-03-15 23:54                               ` Tejun Heo
     [not found]                               ` <YE/zvLkL1vM8/Cdm-NiLfg/pYEd1N0TnZuCh8vA@public.gmane.org>
2021-03-16  1:30                                 ` Jacob Pan
2021-03-16  1:30                                   ` Jacob Pan
2021-03-16  2:22                                   ` Tejun Heo
2021-03-16  2:22                                     ` Tejun Heo
     [not found]                                     ` <YFAWVJrM86FB17Lk-NiLfg/pYEd1N0TnZuCh8vA@public.gmane.org>
2021-03-16 18:19                                       ` Jacob Pan
2021-03-16 18:19                                         ` Jacob Pan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YEB6ULUgbf+s8ydd@google.com \
    --to=vipinsh-hpiqsd4aklfqt0dzr+alfa@public.gmane.org \
    --cc=borntraeger-tA70FqPdS9bQT0dZR+AlfA@public.gmane.org \
    --cc=bp-Gina5bIWoIWzQB+pC5nmwQ@public.gmane.org \
    --cc=brijesh.singh-5C7GfCeVMHo@public.gmane.org \
    --cc=cgroups-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=corbet-T1hC0tSOHrs@public.gmane.org \
    --cc=dionnaglaze-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org \
    --cc=eric.vantassell-5C7GfCeVMHo@public.gmane.org \
    --cc=frankja-tEXmvtCZX7AybS5Ee8rs3A@public.gmane.org \
    --cc=gingell-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org \
    --cc=hannes-druUgvl0LCNAfugRpC6u6w@public.gmane.org \
    --cc=hpa-YMNOUZJC4hwAvxtiuMwx3w@public.gmane.org \
    --cc=jmattson-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org \
    --cc=jon.grimm-5C7GfCeVMHo@public.gmane.org \
    --cc=joro-zLv9SwRftAIdnm+yROfE0A@public.gmane.org \
    --cc=kvm-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-doc-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=mingo-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
    --cc=mkoutny-IBi9RG/b67k@public.gmane.org \
    --cc=pbonzini-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
    --cc=rdunlap-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org \
    --cc=rientjes-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org \
    --cc=seanjc-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org \
    --cc=tglx-hfZtesqFncYOwBW4kG4KsQ@public.gmane.org \
    --cc=thomas.lendacky-5C7GfCeVMHo@public.gmane.org \
    --cc=tj-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
    --cc=vkuznets-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
    --cc=wanpengli-1Nz4purKYjRBDgjK7y7TUQ@public.gmane.org \
    --cc=x86-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.