From: Donald Sharp Date: Fri, 18 Apr 2025 17:50:33 +0000 (-0400) Subject: bgpd: ensure that bgp_generate_updgrp_packets shares nicely X-Git-Url: https://git.puffer.fish/?a=commitdiff_plain;h=refs%2Fpull%2F18689%2Fhead;p=mirror%2Ffrr.git 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 --- diff --git a/bgpd/bgp_packet.c b/bgpd/bgp_packet.c index 16e94d9fe2..62a6a4fbab 100644 --- a/bgpd/bgp_packet.c +++ b/bgpd/bgp_packet.c @@ -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);