From: Pablo Neira Ayuso <pablo@netfilter.org>
To: Max Kellermann <max@duempel.org>
Cc: netfilter-failover@lists.netfilter.org,
Netfilter Development Mailinglist
<netfilter-devel@vger.kernel.org>
Subject: Re: [nf-failover] [conntrack-utils PATCH r7254 04/14] fix misoptimization for next_alarm calculation
Date: Mon, 21 Jan 2008 01:05:32 +0100 [thread overview]
Message-ID: <4793E1CC.2010300@netfilter.org> (raw)
In-Reply-To: <20080118105309.4444.78574.stgit@woodpecker.roonstrasse.net>
Max Kellermann wrote:
> do_alarm_run() determines the next_alarm time. there is however a
> condition where this result comes wrong, because of "unsafe" side
> effects of list_for_each_entry_safe(). Example: imagine there are two
> alarms: A is due now, and B is due in 5 minutes.
>
> When do_alarm_run() runs alarm A, list_for_each_entry_safe() remembers
> B as the alarm for the next loop iteration.
>
> Now A re-schedules itself in 1 minute. It is again the first entry in
> the alarm_list queue, but list_for_each_entry_safe() will not handle
> it in this loop.
>
> Instead, do_alarm_run() sees B and returns "5 minutes" as the
> next_alarm time.
>
> Solve this by breaking from the loop when a late event is detected,
> and letting get_next_alarm() do all the work.
Good point. I noticed this while rewriting the alarm scheduler, in the
rewrite it should handle this case correctly.
--
"Los honestos son inadaptados sociales" -- Les Luthiers
next prev parent reply other threads:[~2008-01-21 0:05 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20080118104935.4444.26673.stgit@woodpecker.roonstrasse.net>
[not found] ` <20080118105309.4444.14927.stgit@woodpecker.roonstrasse.net>
2008-01-20 23:53 ` [nf-failover] [conntrack-utils PATCH r7254 01/14] merge mod_alarm() into add_alarm() Pablo Neira Ayuso
[not found] ` <20080118105309.4444.74440.stgit@woodpecker.roonstrasse.net>
2008-01-20 23:57 ` [nf-failover] [conntrack-utils PATCH r7254 02/14] remove duplicate init_alarm() invocations Pablo Neira Ayuso
[not found] ` <20080118105309.4444.78574.stgit@woodpecker.roonstrasse.net>
2008-01-21 0:05 ` Pablo Neira Ayuso [this message]
[not found] ` <20080118105309.4444.39660.stgit@woodpecker.roonstrasse.net>
2008-01-21 0:10 ` [nf-failover] [conntrack-utils PATCH r7254 08/14] check alarms even if select()!=0 Pablo Neira Ayuso
[not found] ` <20080118105309.4444.65188.stgit@woodpecker.roonstrasse.net>
2008-01-21 0:14 ` [nf-failover] [conntrack-utils PATCH r7254 05/14] make the "tv" parameter const Pablo Neira Ayuso
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4793E1CC.2010300@netfilter.org \
--to=pablo@netfilter.org \
--cc=max@duempel.org \
--cc=netfilter-devel@vger.kernel.org \
--cc=netfilter-failover@lists.netfilter.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.