mirror of
https://github.com/RGBCube/serenity
synced 2025-05-19 00:25:07 +00:00
Kernel: Avoid allocating and then freeing packet buffers
We already have another limit for the total number of packet buffers allowed (max_packet_buffers). This second limit caused us to repeatedly allocate and then free buffers.
This commit is contained in:
parent
55c3a5969c
commit
76deda802d
1 changed files with 2 additions and 4 deletions
|
@ -199,10 +199,8 @@ size_t NetworkAdapter::dequeue_packet(u8* buffer, size_t buffer_size, Time& pack
|
|||
size_t packet_size = packet.size();
|
||||
VERIFY(packet_size <= buffer_size);
|
||||
memcpy(buffer, packet.data(), packet_size);
|
||||
if (m_unused_packet_buffers_count < 100) {
|
||||
m_unused_packet_buffers.append(packet);
|
||||
++m_unused_packet_buffers_count;
|
||||
}
|
||||
m_unused_packet_buffers.append(packet);
|
||||
++m_unused_packet_buffers_count;
|
||||
return packet_size;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue