OpenVZ Forum


Home » Mailing lists » Devel » [PATCH] vt: Rework the console spawning variables.
Re: [PATCH] vt: Rework the console spawning variables. [message #16666 is a reply to message #16657] Sun, 10 September 2006 20:33 Go to previous messageGo to previous message
Oleg Nesterov is currently offline  Oleg Nesterov
Messages: 143
Registered: August 2006
Senior Member
On 09/10, Eric W. Biederman wrote:
>
> Oleg Nesterov <oleg@tv-sign.ru> writes:
> 
> > On 09/09, Eric W. Biederman wrote:
> >> 
> >> This patch does several things.
> >> - The variables used are moved into a structure and declared in vt_kern.h
> >> - A spinlock is added so we don't have SMP races updating the values.
> >> - Instead of raw pid_t value a struct_pid is used to guard against
> >>   pid wrap around issues, if the daemon to spawn a new console dies.
> >
> > I am not arguing against this patch, but it's a pity we can't use 'struct pid'
> > lockless. What dou you think about this:
> 
> Actually with xchg I can use a reference counted struct pid lockless.
>
> ...
>
> Perhaps:
> void update_pid(struct pid **ref, struct pid *new)
> {
>         struct pid *old;
>         get_pid(new);
>         old = xchg(ref, new);
>         put_pid(old);
> }

This can't work. This put_pid() can actually free the memory, while
'old' is still in use (lockless).

> rcu is definitely not the solution in these cases as the struct pid
> is stored for a long time so we need the reference count.

Surely we need the reference count, I don't understand you.
Look at put_pid_rcu().

That said,

> In the general case you have more then one variable you want to keep
> in sync and you need the lock for that.

Yes.

> But since I can write it as a moderately clear one liner in the
> case that matters I don't much care.

Ok.

Oleg.

_______________________________________________
Containers mailing list
Containers@lists.osdl.org
https://lists.osdl.org/mailman/listinfo/containers
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: [PATCH] file: Add locking to f_getown
Next Topic: [PATCH] usb: Fixup usb so it uses struct pid
Goto Forum:
  


Current Time: Sun Oct 12 20:52:24 GMT 2025

Total time taken to generate the page: 0.33455 seconds