K 10 svn:author V 7 glebius K 8 svn:date V 27 2014-03-07T22:53:29.532395Z K 7 svn:log V 887 Provide a hack to workaround the following condition: two sendfile(2) calls are issues on the same object, with ranges overlapping on at least one page. One of them grabs all pages, schedules I/O and returns. The second one encounters an overlapping page in a busy state. It sleeps with 'pgrbwt' wait channel, and sleep time is effectively the I/O time. Thus, second syscall is degenerating to the blocking on disk I/O mode. To avoid this, a sysctl kern.ipc.sendfile.pgrabnowait is provided (default to off). When sysctl is on and userland supplies SF_NODISKIO flag, then we are calling vm_page_grab(VM_ALLOC_NOWAIT). In case of a failure we return EAGAIN, hinting userland that it should continue monitor the socket via select/kevent/whatever. If the socket has zero data to send, then we have to notify it immediately, to avoid stall. Sponsored by: Netflix Sponsored by: Nginx, Inc. END