bgpd: ensure that bgp_generate_updgrp_packets shares nicely

The bgp_generate_updgrp_packet function will attempt to write
up to `write quanta 64` packets at one time.  This is extremely
expensive at scale and is causing CPU_HOGS as well as STARVATION
messages.  Check to see if we should yield the CPU to allow
something else in BGP to continue working.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
This commit is contained in:
Donald Sharp 2025-04-18 13:50:33 -04:00
parent 0850ae7db7
commit 681caee944

View file

@ -601,8 +601,8 @@ void bgp_generate_updgrp_packets(struct event *thread)
bgp_packet_add(connection, peer, s);
bpacket_queue_advance_peer(paf);
}
} while (s && (++generated < wpq) &&
(connection->obuf->count <= bm->outq_limit));
} while (s && (++generated < wpq) && (connection->obuf->count <= bm->outq_limit) &&
!event_should_yield(thread));
if (generated)
bgp_writes_on(connection);