Skip to content

Commit 681caee

Browse files
committed
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 <[email protected]>
1 parent 0850ae7 commit 681caee

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

bgpd/bgp_packet.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -601,8 +601,8 @@ void bgp_generate_updgrp_packets(struct event *thread)
601601
bgp_packet_add(connection, peer, s);
602602
bpacket_queue_advance_peer(paf);
603603
}
604-
} while (s && (++generated < wpq) &&
605-
(connection->obuf->count <= bm->outq_limit));
604+
} while (s && (++generated < wpq) && (connection->obuf->count <= bm->outq_limit) &&
605+
!event_should_yield(thread));
606606

607607
if (generated)
608608
bgp_writes_on(connection);

0 commit comments

Comments
 (0)