OpenVZ Forum


Home » Mailing lists » Devel » Re: [PATCH 3/7] containers (V7): Add generic multi-subsystem API to containers
Re: [PATCH 3/7] containers (V7): Add generic multi-subsystem API to containers [message #10204] Mon, 12 February 2007 15:27 Go to previous message
Srivatsa Vaddagiri is currently offline  Srivatsa Vaddagiri
Messages: 241
Registered: August 2006
Senior Member
On Mon, Feb 12, 2007 at 12:15:24AM -0800, menage@google.com wrote:
> +/*
> + * Call css_get() to hold a reference on the container; following a
> + * return of 0, this container subsystem state object is guaranteed
> + * not to be destroyed until css_put() is called on it. A non-zero
> + * return code indicates that a reference could not be taken.
> + *
> + */
> +

Why can't we reuse container->count (or container_group->ref) to
refcount the per-subsystem object attached to a container? I think
that is how it is done for cpusets? That would make css_get/put
unnecessary?

> +static inline int css_get(struct container_subsys_state *css)
> +{
> + int retval = 0;
> + unsigned long flags;
> + /* Synchronize with container_rmdir() */
> + spin_lock_irqsave(&css->refcnt_lock, flags);
> + if (atomic_read(&css->refcnt) >= 0) {
> + /* Container is still alive */
> + atomic_inc(&css->refcnt);
> + } else {
> + /* Container removal is in progress */
> + retval = -EINVAL;
> + }
> + spin_unlock_irqrestore(&css->refcnt_lock, flags);
> + return retval;
> +}

--
Regards,
vatsa
 
Read Message
Read Message
Read Message
Read Message
Previous Topic: Alt+SysRq+K broken
Next Topic: [PATCH]mm incorrect direct io error handling (v4)
Goto Forum:
  


Current Time: Sun Oct 05 21:46:57 GMT 2025

Total time taken to generate the page: 0.14721 seconds