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

2021-03-04 Thread Tejun Heo
Hello, On Wed, Mar 03, 2021 at 10:12:32PM -0800, Vipin Sharma wrote: > 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

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

2021-03-03 Thread Vipin Sharma
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 brin

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

2021-03-03 Thread Tejun Heo
Hello, On Tue, Mar 02, 2021 at 12:17:04AM -0800, Vipin Sharma wrote: > +/** > + * struct misc_res: Per cgroup per misc type resource > + * @max: Maximum count of the resource. > + * @usage: Current usage of the resource. > + */ > +struct misc_res { > + unsigned int max; > + atomic_t usage;

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

2021-03-02 Thread Vipin Sharma
The Miscellaneous cgroup provides the resource limiting and tracking mechanism for the scalar resources which cannot be abstracted like the other cgroup resources. Controller is enabled by the CONFIG_CGROUP_MISC config option. The first two resources added to the miscellaneous controller are Secur