Re: [RFC v2 1/2] cgroup: sev: Add misc cgroup controller

Vipin Sharma
2021-03-04T06:14:32Z

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