shuveb / loti

Lord of the io_uring: io_uring tutorial, examples and reference
MIT License
72 stars 16 forks source link

Why do we need 3 mmap calls? #1

Closed quangIO closed 4 years ago

quangIO commented 4 years ago

I just read the introduction article and it mentions we need to use call mmap 3 times. But shouldn't it be only two?

reddwarf69 commented 4 years ago

No, it's 3. The next chapter, https://unixism.net/loti/low_level.html, shows an example.

But I agree it's confusing. You have just read "There are 2 ring buffers, one for submission of requests (submission queue or SQ) and the other that informs you about completion of those requests (completion queue or CQ).", then there is a reference to "submission queue entry (SQE)" which you obviously think "is refers to an entry in the SQ, not something requiring its own mmap" and finally you reach the 3 mmaps thing. "One mmap for the SQ and one for the SQEs" is not self-explanatory.

shuveb commented 4 years ago

The text and examples have been updated. There are now only 2 mmap() calls. However, for code and explanation has been added on how to support older kernels as well. Essentially, 2 mmap() calls are supported only on kernel v5.4+

Thanks!