views:

32

answers:

1

I'm playing with this code on Linux 2.6.16.46:

io.aio_fildes = open(name, O_CREAT | O_TRUNC | O_WRONLY | O_SYNC, 00300);

io.aio_buf = buffer;
io.aio_nbytes = size;
io.aio_sigevent = sigev;
io.aio_lio_opcode = LIO_WRITE;

aio_write( &io );

This should use the memory pointed by buffer for the IO operation. Still, I see the number of dirty pages go up as if I was writing to cache. Why is that?

On the build machine, there's no O_DIRECT support in open(). But since I'm not using write(), should that still be a problem?

I'm pretty sure there's direct IO support on the target.

A: 

figured this out. Direct/buffered IO is one thing, sync/async is another. To have async writes avoid cache one still needs to give O_DIRECT to the open() call, even if write() is not used.

There will likely be compiler errors at first - read man 2 open carefully.

n-alexander