]> git.puffer.fish Git - mirror/frr.git/commitdiff
bgpd: ensure that bgp_generate_updgrp_packets shares nicely 18689/head
authorDonald Sharp <sharpd@nvidia.com>
Fri, 18 Apr 2025 17:50:33 +0000 (13:50 -0400)
committerDonald Sharp <sharpd@nvidia.com>
Fri, 18 Apr 2025 17:50:33 +0000 (13:50 -0400)
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>
bgpd/bgp_packet.c

index 16e94d9fe22d2420664bc5e674f358abdad75526..62a6a4fbab8d044d2d3dad10ed1341e1d3bcd98c 100644 (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);