lkml.org 
[lkml]   [2009]   [Mar]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [patch] eventfd - remove fput() call from possible IRQ context (2nd rev)
Jeff Moyer a écrit :
> Eric Dumazet <dada1@cosmosbay.com> writes:
>
>
>>> rwfd = open("rwfile", O_RDWR|O_DIRECT); assert(rwfd != -1);
>>> if (posix_memalign((void **)&buf, getpagesize(), SIZE) < 0) {
>>> perror("posix_memalign");
>>> exit(1);
>>> }
>>> memset(buf, 0x42, SIZE);
>>>
>>> /* Write test. */
>>> res = io_queue_init(1024, &io_ctx); assert(res == 0);
>>> io_prep_pwrite(&iocb, rwfd, buf, SIZE, 0);
>>> io_set_eventfd(&iocb, efd);
>>> res = io_submit(io_ctx, 1, iocbs); assert(res == 1);
>> yes but io_submit() is blocking. so your close(efd) will come after the release in fs/aio.c
>
> I'm not sure why you think io_submit is blocking. In my setup, I
> preallocated the file, and the test code opens it with O_DIRECT. So,
> io_submit should return after the dio is issued, and the I/O size is
> large enough that it should still be outstanding when io_submit returns.

Hmm.. io_submit() is a blocking syscall, this is how I understood fs/aio.c

Then, using strace -tt -T on your program, I can confirm it is quite a long syscall (3.5 seconds,
about time needed to write a 256 MB file on my disk ;) )

16:33:15.861301 eventfd(0) = 3 <0.000010>
16:33:15.861344 open("rwfile", O_RDWR|O_DIRECT) = 4 <0.000010>
16:33:15.861444 mmap(NULL, 268443648, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f08eec55000 <0.000008>
16:33:16.100040 io_setup(1024, {139676618563584}) = 0 <0.000047>
16:33:16.100149 io_submit(139676618563584, 1, {...}) = 1 <3.558085>
16:33:19.658292 io_getevents(139676618563584, 1, 1, {...}NULL) = 1 <0.258104>
16:33:19.916486 fstat(1, {st_mode=S_IFCHR|0600, st_rdev=makedev(136, 0), ...}) = 0 <0.000007>
16:33:19.916559 mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f08ff3b9000 <0.000009>
16:33:19.916607 write(1, "eventfd write test [SUCCESS]\n"..., 29eventfd write test [SUCCESS]
) = 29 <0.000008>
16:33:19.916653 exit_group(0) = ?

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

\
 
 \ /
  Last update: 2009-03-18 16:47    [from the cache]
©2003-2011 Jasper Spaans