]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
Avoid reusing the wrong buffer for a DDP AIO request.
authorjhb <jhb@FreeBSD.org>
Fri, 15 Sep 2017 22:40:57 +0000 (22:40 +0000)
committerjhb <jhb@FreeBSD.org>
Fri, 15 Sep 2017 22:40:57 +0000 (22:40 +0000)
commit46a660444e920cb0c31919a89acc911bb0178ef4
treede7121d84a4d86d697b0390ec26a218dbb7f407c
parent7d70ae38cf7d1643168c0caed167a3fd4e4da095
Avoid reusing the wrong buffer for a DDP AIO request.

To optimize the case of ping-ponging between two buffers, the DDP code
caches the last two buffers used keeping the pages wired and page pods
stored in the NIC's RAM.  If a new aio_read() request uses one of the
same buffers, then the work of holding pages, etc. can be avoided.
However, the starting virtual address of an aio buffer was not saved,
only the page count, length, and initial page offset.  Thus, an
aio_read() request could match a different buffer in the address
space.  (Earlier during development vm_fault_hold_quick_pages() was
always called and the vm_page_t values were compared, but that was
eventually removed without being adequately replaced.)  Fix by storing
the starting virtual address and comparing that (along with other
fields) to determine if a buffer can be reused.

MFC after: 3 days
Sponsored by: Chelsio Communications
sys/dev/cxgbe/tom/t4_ddp.c
sys/dev/cxgbe/tom/t4_tom.h