Re: [RFC] Add mempressure cgroup

From: Anton Vorontsov
Date: Thu Nov 29 2012 - 01:24:09 EST


On Thu, Nov 29, 2012 at 08:14:13AM +0200, Kirill A. Shutemov wrote:
> On Wed, Nov 28, 2012 at 02:29:08AM -0800, Anton Vorontsov wrote:
> > +static int mpc_pre_destroy(struct cgroup *cg)
> > +{
> > + struct mpc_state *mpc = cg2mpc(cg);
> > + int ret = 0;
> > +
> > + mutex_lock(&mpc->lock);
> > +
> > + if (mpc->eventfd)
> > + ret = -EBUSY;
>
> cgroup_rmdir() will unregister all events for you. No need to handle it
> here.

Okie, thanks!

[...]
> > +static int mpc_register_level_event(struct cgroup *cg, struct cftype *cft,
> > + struct eventfd_ctx *eventfd,
> > + const char *args)
> > +{
> > + struct mpc_state *mpc = cg2mpc(cg);
> > + int i;
> > + int ret;
> > +
> > + mutex_lock(&mpc->lock);
> > +
> > + /*
> > + * It's easy to implement multiple thresholds, but so far we don't
> > + * need it.
> > + */
> > + if (mpc->eventfd) {
> > + ret = -EBUSY;
> > + goto out_unlock;
> > + }
>
> One user which listen for one threashold per cgroup?
> I think it's wrong. It's essensial for API to serve multiple users.

Yea, if we'll consider merging this, I'll definitely fix this. Just didn't
want to bring the complexity into the code.

Thanks,
Anton.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/