Re: [take25 1/6] kevent: Description.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Nov 22, 2006 at 03:46:42PM -0800, Ulrich Drepper ([email protected]) wrote:
> Evgeniy Polyakov wrote:
> >+ int kevent_wait(int ctl_fd, unsigned int num, __u64 timeout);
> >+
> >+ctl_fd - file descriptor referring to the kevent queue 
> >+num - number of processed kevents 
> >+timeout - this timeout specifies number of nanoseconds to wait until 
> >there is +		free space in kevent queue 
> >+
> >+Return value:
> >+ number of events copied into ring buffer or negative error value.
> 
> This is not quite sufficient.  What we also need is a parameter which 
> specifies which ring buffer the code assumes is currently active.  This 
> is just like the EWOULDBLOCK error in the futex.  I.e., the kernel 
> doesn't move the thread on the wait list if the index has changed. 
> Otherwise asynchronous ring buffer filling is impossible.  Assume this
> 
>     thread                             kernel
> 
>     get current ring buffer idx
> 
>     front and tail pointer the same
> 
>                                        add new entry to ring buffer
> 
>                                        bump front pointer
> 
>     call kevent_wait()
> 
> 
> With the interface above this leads to a deadlock.  The kernel delivered 
> the event and is done with it.

Kernel does not put there a new entry, it is only done inside
kevent_wait(). Entries are put into queue (in any context), where they can be obtained
from only kevent_wait() or kevent_get_events().

-- 
	Evgeniy Polyakov
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux