diff options
author | Kevin Darbyshire-Bryant <ldir@darbyshire-bryant.me.uk> | 2019-03-09 08:40:57 +0000 |
---|---|---|
committer | Kevin Darbyshire-Bryant <ldir@darbyshire-bryant.me.uk> | 2019-07-25 12:23:46 +0100 |
commit | e9eec39aacde450ba87598d85987b374ce6aed95 (patch) | |
tree | 3823546edc4d7228951ea9e37f55f6fea3f06833 /package/network/services/dnsmasq/patches/0035-lease-prune-lease-as-soon-as-expired.patch | |
parent | 7d684b7673a7cb4f3fef366dd4f621f62fc4019c (diff) | |
download | upstream-e9eec39aacde450ba87598d85987b374ce6aed95.tar.gz upstream-e9eec39aacde450ba87598d85987b374ce6aed95.tar.bz2 upstream-e9eec39aacde450ba87598d85987b374ce6aed95.zip |
dnsmasq: backport latest patches
Backport upstream patches pre 2.81rc for testing purposes.
Let's see what falls out!
Signed-off-by: Kevin Darbyshire-Bryant <ldir@darbyshire-bryant.me.uk>
Diffstat (limited to 'package/network/services/dnsmasq/patches/0035-lease-prune-lease-as-soon-as-expired.patch')
-rw-r--r-- | package/network/services/dnsmasq/patches/0035-lease-prune-lease-as-soon-as-expired.patch | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/package/network/services/dnsmasq/patches/0035-lease-prune-lease-as-soon-as-expired.patch b/package/network/services/dnsmasq/patches/0035-lease-prune-lease-as-soon-as-expired.patch new file mode 100644 index 0000000000..e1cfde86ba --- /dev/null +++ b/package/network/services/dnsmasq/patches/0035-lease-prune-lease-as-soon-as-expired.patch @@ -0,0 +1,42 @@ +From df6636bff61aa53ed7ad4b34d940805193c0bc74 Mon Sep 17 00:00:00 2001 +From: Florent Fourcot <florent.fourcot@wifirst.fr> +Date: Mon, 11 Feb 2019 17:04:44 +0100 +Subject: [PATCH 35/57] lease: prune lease as soon as expired + +We detected a performance issue on a dnsmasq running many dhcp sessions +(more than 10 000). At the end of the day, the server was only releasing +old DHCP leases but was consuming a lot of CPU. + +It looks like curent dhcp pruning: + 1) it's pruning old sessions (iterate on all current leases). It's + important to note that it's only pruning session expired since more + than one second + 2) it's looking for next lease to expire (iterate on all current leases + again) + 3) it launchs an alarm to catch next expiration found in step 2). This + value can be zero for leases just expired (but not pruned). + +So, for a second, dnsmasq could fall in a "prune loop" by doing: + * Not pruning anything, since difftime() is not > 0 + * Run alarm again with zero as argument + +On a server with very large number of leases and releasing often +sessions, that can waste a very big CPU time. + +Signed-off-by: Florent Fourcot <florent.fourcot@wifirst.fr> +Signed-off-by: Kevin Darbyshire-Bryant <ldir@darbyshire-bryant.me.uk> +--- + src/lease.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/src/lease.c ++++ b/src/lease.c +@@ -558,7 +558,7 @@ void lease_prune(struct dhcp_lease *targ + for (lease = leases, up = &leases; lease; lease = tmp) + { + tmp = lease->next; +- if ((lease->expires != 0 && difftime(now, lease->expires) > 0) || lease == target) ++ if ((lease->expires != 0 && difftime(now, lease->expires) >= 0) || lease == target) + { + file_dirty = 1; + if (lease->hostname) |