From 929fb51612016f97b3d5dface339ae3c06fe06f0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Sur=C3=BD?= Date: Wed, 10 Apr 2024 22:57:01 +0200 Subject: [PATCH] add an isc_loop_rcu_barrier() for memory cleanup to finish when adding data to the cache while over memory limits, add an RCU barrier to ensure that memory is cleaned right away. --- lib/dns/qpcache.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/dns/qpcache.c b/lib/dns/qpcache.c index 81d293ef5b..b1bd1d7452 100644 --- a/lib/dns/qpcache.c +++ b/lib/dns/qpcache.c @@ -3459,6 +3459,11 @@ addrdataset(dns_db_t *db, dns_dbnode_t *node, dns_qpread_destroy(qpdb->tree, &modctx.qpr); } + if (cache_is_overmem) { + /* Trigger memory cleaning */ + isc_loop_rcu_barrier(isc_loop()); + } + return (result); }