[Devel] [PATCH rh7 3/3] ve: Use wait_on_bit() to wait attaching is completed

Vladimir Davydov vdavydov at virtuozzo.com
Wed Oct 28 05:58:18 PDT 2015


On Wed, Oct 28, 2015 at 12:54:31PM +0300, Kirill Tkhai wrote:
> On 27.10.2015 19:22, Vladimir Davydov wrote:
> > On Fri, Oct 16, 2015 at 07:25:15PM +0300, Kirill Tkhai wrote:
> >> wait_on_bit() prevents excess schedule_timeout() looping
> >> (i.e. cpu time waisting and possible livelocks)
> > 
> > I think a completion would suit the purpose much better.
> > 
> 
> There is already bits in task_ve_nr_works while completion
> requires more of memory.

One more reason to use kmalloc.

> The readability is near the similar.

You mean this

+       atomic_set_mask(VE_WAIT_BIAS, nr);
+       smp_mb__after_atomic();
+
+       if (atomic_read(nr) & ~VE_WAIT_BIAS)
+               wait_on_bit(nr, VE_WAIT_BIT, ve_wait_action,TASK_UNINTERRUPTIBLE);
+       else
+               atomic_clear_mask(VE_WAIT_BIAS, nr);

is as readable as this

	wait_on_completion(&attach_work->complete);

?

I beg to disagree.

> 
> I don't think it's better.



More information about the Devel mailing list