Commit f3438bc7 authored by Thomas Gleixner's avatar Thomas Gleixner Committed by Ingo Molnar

timers, net/ipv4/inet: Initialize connection request timers as pinned

Pinned timers must carry the pinned attribute in the timer structure
itself, so convert the code to the new API.

No functional change.
Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
Reviewed-by: default avatarFrederic Weisbecker <fweisbec@gmail.com>
Cc: Arjan van de Ven <arjan@infradead.org>
Cc: Chris Mason <clm@fb.com>
Cc: Eric Dumazet <edumazet@google.com>
Cc: George Spelvin <linux@sciencehorizons.net>
Cc: Josh Triplett <josh@joshtriplett.org>
Cc: Len Brown <lenb@kernel.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Rik van Riel <riel@redhat.com>
Cc: rt@linutronix.de
Link: http://lkml.kernel.org/r/20160704094341.617891430@linutronix.deSigned-off-by: default avatarIngo Molnar <mingo@kernel.org>
parent 853f90d4
...@@ -603,7 +603,7 @@ static void reqsk_timer_handler(unsigned long data) ...@@ -603,7 +603,7 @@ static void reqsk_timer_handler(unsigned long data)
if (req->num_timeout++ == 0) if (req->num_timeout++ == 0)
atomic_dec(&queue->young); atomic_dec(&queue->young);
timeo = min(TCP_TIMEOUT_INIT << req->num_timeout, TCP_RTO_MAX); timeo = min(TCP_TIMEOUT_INIT << req->num_timeout, TCP_RTO_MAX);
mod_timer_pinned(&req->rsk_timer, jiffies + timeo); mod_timer(&req->rsk_timer, jiffies + timeo);
return; return;
} }
drop: drop:
...@@ -617,8 +617,9 @@ static void reqsk_queue_hash_req(struct request_sock *req, ...@@ -617,8 +617,9 @@ static void reqsk_queue_hash_req(struct request_sock *req,
req->num_timeout = 0; req->num_timeout = 0;
req->sk = NULL; req->sk = NULL;
setup_timer(&req->rsk_timer, reqsk_timer_handler, (unsigned long)req); setup_pinned_timer(&req->rsk_timer, reqsk_timer_handler,
mod_timer_pinned(&req->rsk_timer, jiffies + timeout); (unsigned long)req);
mod_timer(&req->rsk_timer, jiffies + timeout);
inet_ehash_insert(req_to_sk(req), NULL); inet_ehash_insert(req_to_sk(req), NULL);
/* before letting lookups find us, make sure all req fields /* before letting lookups find us, make sure all req fields
......
...@@ -188,7 +188,8 @@ struct inet_timewait_sock *inet_twsk_alloc(const struct sock *sk, ...@@ -188,7 +188,8 @@ struct inet_timewait_sock *inet_twsk_alloc(const struct sock *sk,
tw->tw_prot = sk->sk_prot_creator; tw->tw_prot = sk->sk_prot_creator;
atomic64_set(&tw->tw_cookie, atomic64_read(&sk->sk_cookie)); atomic64_set(&tw->tw_cookie, atomic64_read(&sk->sk_cookie));
twsk_net_set(tw, sock_net(sk)); twsk_net_set(tw, sock_net(sk));
setup_timer(&tw->tw_timer, tw_timer_handler, (unsigned long)tw); setup_pinned_timer(&tw->tw_timer, tw_timer_handler,
(unsigned long)tw);
/* /*
* Because we use RCU lookups, we should not set tw_refcnt * Because we use RCU lookups, we should not set tw_refcnt
* to a non null value before everything is setup for this * to a non null value before everything is setup for this
...@@ -248,7 +249,7 @@ void __inet_twsk_schedule(struct inet_timewait_sock *tw, int timeo, bool rearm) ...@@ -248,7 +249,7 @@ void __inet_twsk_schedule(struct inet_timewait_sock *tw, int timeo, bool rearm)
tw->tw_kill = timeo <= 4*HZ; tw->tw_kill = timeo <= 4*HZ;
if (!rearm) { if (!rearm) {
BUG_ON(mod_timer_pinned(&tw->tw_timer, jiffies + timeo)); BUG_ON(mod_timer(&tw->tw_timer, jiffies + timeo));
atomic_inc(&tw->tw_dr->tw_count); atomic_inc(&tw->tw_dr->tw_count);
} else { } else {
mod_timer_pending(&tw->tw_timer, jiffies + timeo); mod_timer_pending(&tw->tw_timer, jiffies + timeo);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment