2006-03-21 18:55:11

by Dave Hansen

[permalink] [raw]
Subject: Re: [RFC] [PATCH 1/7] Add process virtualisation umbrella structure (vx_info)

On Tue, 2006-03-21 at 18:13 +1200, Sam Vilain wrote:
> +static inline void release_vx_info(struct vx_info *vxi,
> + struct task_struct *task)
> +{
> + might_sleep();
> +
> + if (atomic_dec_and_test(&vxi->vx_tasks))
> + unhash_vx_info(vxi);
> +}

Are these better handled by krefs and their destructors?

-- Dave


2006-03-21 21:52:48

by Sam Vilain

[permalink] [raw]
Subject: Re: [RFC] [PATCH 1/7] Add process virtualisation umbrella structure (vx_info)

Dave Hansen wrote:

>On Tue, 2006-03-21 at 18:13 +1200, Sam Vilain wrote:
>
>
>>+static inline void release_vx_info(struct vx_info *vxi,
>>+ struct task_struct *task)
>>+{
>>+ might_sleep();
>>+
>>+ if (atomic_dec_and_test(&vxi->vx_tasks))
>>+ unhash_vx_info(vxi);
>>+}
>>
>>
>
>Are these better handled by krefs and their destructors?
>
>

It does seem a little clumsy, doesn't it. I've found
Documentation/kref.txt and will rewrite those functions to use this API.

Sam.

2006-03-22 02:03:01

by Herbert Poetzl

[permalink] [raw]
Subject: Re: [RFC] [PATCH 1/7] Add process virtualisation umbrella structure (vx_info)

On Tue, Mar 21, 2006 at 10:53:05AM -0800, Dave Hansen wrote:
> On Tue, 2006-03-21 at 18:13 +1200, Sam Vilain wrote:
> > +static inline void release_vx_info(struct vx_info *vxi,
> > + struct task_struct *task)
> > +{
> > + might_sleep();
> > +
> > + if (atomic_dec_and_test(&vxi->vx_tasks))
> > + unhash_vx_info(vxi);
> > +}
>
> Are these better handled by krefs and their destructors?

well, those were there long before krefs got
into the kernel, IIRC :)

best,
Herbert

> -- Dave