diff options
author | Michael S. Tsirkin <mst@redhat.com> | 2017-04-12 18:35:39 +0300 |
---|---|---|
committer | Michael S. Tsirkin <mst@redhat.com> | 2017-04-24 20:32:34 +0300 |
commit | d635daaa99c687d92964d7c8ed930ceaf617bcff (patch) | |
tree | 8cae57f0674a8b7511dc8ca62139728df4e10343 /drivers/scsi | |
parent | 6006e71f07d6c54c5acb09ac5e0a1e18afc75299 (diff) |
ptr_ring: batched ring producer
A known weakness in ptr_ring design is that it does not handle well the
situation when ring is almost empty: as entries are consumed they are
immediately used again by the producer, so consumer and producer are
writing to a shared cache line.
Batching seems to help somewhat but only if consumer is not
faster than producer. If it's faster, we still see lots of
cache line bounces.
Detect that consumer is fast by checking that there's enough space in
the ring for the whole batch. In that case, hold consumer back by
writing entries out in the reverse order. This reduces number of
write-write cache conflicts.
Notes:
- as these are batched calls, it does not seem to be
worth-while to micro-optimize saving flags,
so a single _any variant is provided for now
- vhost/tun would have to learn to use the batched
version if possible. We might need a producer_peek
variant that reports amount of space available.
Let me know and I'll write that.
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Diffstat (limited to 'drivers/scsi')
0 files changed, 0 insertions, 0 deletions