mirror of
https://github.com/scylladb/scylladb.git
synced 2026-04-23 01:50:35 +00:00
virtio: reduce rx allocations when preparing buffers (part 2)
Instead of producing a range of buffer chains, produce a range of buffer arrays (std::array<buffer>). These do not require any allocations.
This commit is contained in:
@@ -490,7 +490,6 @@ virtio_net_device::rxq::prepare_buffers() {
|
||||
count += opportunistic;
|
||||
}
|
||||
auto make_buffer_chain = [this] {
|
||||
vring::buffer_chain bc;
|
||||
std::unique_ptr<char[]> buf(new char[4096]);
|
||||
vring::buffer b;
|
||||
b.addr = virt_to_phys(buf.get());
|
||||
@@ -524,8 +523,7 @@ virtio_net_device::rxq::prepare_buffers() {
|
||||
});
|
||||
}
|
||||
});
|
||||
bc.push_back(std::move(b));
|
||||
return bc;
|
||||
return std::array<vring::buffer, 1>{std::move(b)};
|
||||
};
|
||||
auto start = make_function_input_iterator(make_buffer_chain, 0U);
|
||||
auto finish = make_function_input_iterator(make_buffer_chain, count);
|
||||
|
||||
Reference in New Issue
Block a user