On Thu, 19 Apr 2018 18:01:32 -0700 Eric Dumazet <eric.duma...@gmail.com> wrote:
> We can keep mmap() nice interface, granted we can add one hook like in > following patch. > > David, do you think such patch would be acceptable by lkml and mm/fs > maintainers ? > > Alternative would be implementing an ioctl() or getsockopt() operation, > but it seems less natural... So I have little standing here, but what the heck, not letting that bother me has earned me a living for the last 20 years or so...:) I think you should consider switching over to an interface where you mmap() the region once, and use ioctl() to move the data into that region, for a couple of reasons beyond the locking issues you've already found: - The "mmap() consumes data" semantics are a bit ... strange, IMO. That's not what mmap() normally does. People expect ioctl() to do magic things, instead. - I would expect it to be a tiny bit faster, since you wouldn't be doing the VMA setup and teardown each time. Thanks, jon