From: Eric Dumazet <eric.dumazet@gmail.com>
To: Matteo Croce <mcroce@redhat.com>,
Wensong Zhang <wensong@linux-vs.org>,
Simon Horman <horms@verge.net.au>, Julian Anastasov <ja@ssi.bg>,
lvs-devel@vger.kernel.org, netdev@vger.kernel.org,
Jozsef Kadlecsik <kadlec@blackhole.kfki.hu>
Cc: Pablo Neira Ayuso <pablo@netfilter.org>,
Florian Westphal <fw@strlen.de>,
netfilter-devel@vger.kernel.org
Subject: Re: [PATCH] ipvs: don't show negative times in ip_vs_conn
Date: Fri, 20 Jul 2018 09:21:03 -0700 [thread overview]
Message-ID: <c5ab4cd8-71d9-c190-7f7a-c85dd1aad91b@gmail.com> (raw)
In-Reply-To: <20180720151957.24791-1-mcroce@redhat.com>
On 07/20/2018 08:19 AM, Matteo Croce wrote:
> Since commit 500462a9de65 ("timers: Switch to a non-cascading wheel"),
> timers duration can last even 12.5% more than the scheduled interval.
>
> Signed-off-by: Matteo Croce <mcroce@redhat.com>
> ---
> net/netfilter/ipvs/ip_vs_conn.c | 22 ++++++++++++++--------
> 1 file changed, 14 insertions(+), 8 deletions(-)
>
> diff --git a/net/netfilter/ipvs/ip_vs_conn.c b/net/netfilter/ipvs/ip_vs_conn.c
> index 99e0aa350dc5..c78c48a6d53f 100644
> --- a/net/netfilter/ipvs/ip_vs_conn.c
> +++ b/net/netfilter/ipvs/ip_vs_conn.c
> @@ -1066,6 +1066,12 @@ static void ip_vs_conn_seq_stop(struct seq_file *seq, void *v)
> rcu_read_unlock();
> }
>
> +static unsigned int time_left(unsigned long time)
> +{
> + return time_is_after_jiffies(time) ?
> + jiffies_to_msecs(time - jiffies) / 1000 : 0;
> +}
I would suggest adding jiffies_delta_to_msecs(), because we will need elsewhere,
like in inet_sk_diag_fill()
diff --git a/include/linux/jiffies.h b/include/linux/jiffies.h
index a27cf66523279c1a5d4aaa0d0087f1e9d48d170f..fa928242567db30769839ac8738be5dc58e372ab 100644
--- a/include/linux/jiffies.h
+++ b/include/linux/jiffies.h
@@ -447,6 +447,11 @@ static inline clock_t jiffies_delta_to_clock_t(long delta)
return jiffies_to_clock_t(max(0L, delta));
}
+static inline unsigned int jiffies_delta_to_msecs(long delta)
+{
+ return jiffies_to_msecs(max(0L, delta));
+}
+
extern unsigned long clock_t_to_jiffies(unsigned long x);
extern u64 jiffies_64_to_clock_t(u64 x);
extern u64 nsec_to_clock_t(u64 x);
prev parent reply other threads:[~2018-07-20 16:21 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-07-20 15:19 [PATCH] ipvs: don't show negative times in ip_vs_conn Matteo Croce
2018-07-20 16:19 ` Eric Dumazet
2018-07-30 17:49 ` Matteo Croce
2018-07-31 5:10 ` Eric Dumazet
2018-07-20 16:21 ` Eric Dumazet [this message]
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=c5ab4cd8-71d9-c190-7f7a-c85dd1aad91b@gmail.com \
--to=eric.dumazet@gmail.com \
--cc=fw@strlen.de \
--cc=horms@verge.net.au \
--cc=ja@ssi.bg \
--cc=kadlec@blackhole.kfki.hu \
--cc=lvs-devel@vger.kernel.org \
--cc=mcroce@redhat.com \
--cc=netdev@vger.kernel.org \
--cc=netfilter-devel@vger.kernel.org \
--cc=pablo@netfilter.org \
--cc=wensong@linux-vs.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).