OpenVZ Forum


Home » Mailing lists » Devel » [PATCH] vt: Rework the console spawning variables.
Re: [PATCH] vt: Rework the console spawning variables. [message #16661 is a reply to message #16650] Sun, 10 September 2006 14:29 Go to previous messageGo to previous message
Oleg Nesterov is currently offline  Oleg Nesterov
Messages: 143
Registered: August 2006
Senior Member
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:

	void delayed_free_pid(struct rcu_head *rhp)
	{
		struct pid *pid = container_of(rhp, struct pid, rcu);
		kmem_cache_free(pid_cachep, pid);
	}

	void put_pid_rcu(struct pid *pid)
	{
		if (atomic_dec_and_test(&pid->count))
			// this can happen only if delayed_put_pid()
			// was already fired, we can re-use pid->rcu
			call_rcu(&pid->rcu, delayed_free_pid);
	}

Now,

	update_pid()
	{
		// still needs some locking
		put_pid_rcu(pid);
		pid = get_pid(...);
	}

	use_pid()
	{
		rcu_read_lock();
		do_something(pid);
		rcu_read_unock();
	}

Thoughts?

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: Tue Oct 14 06:54:52 GMT 2025

Total time taken to generate the page: 0.12949 seconds