Skip to content

Commit f3438bc

Browse files
KAGA-KOKOIngo Molnar
authored andcommitted
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: Thomas Gleixner <[email protected]> Reviewed-by: Frederic Weisbecker <[email protected]> Cc: Arjan van de Ven <[email protected]> Cc: Chris Mason <[email protected]> Cc: Eric Dumazet <[email protected]> Cc: George Spelvin <[email protected]> Cc: Josh Triplett <[email protected]> Cc: Len Brown <[email protected]> Cc: Linus Torvalds <[email protected]> Cc: Paul E. McKenney <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Rik van Riel <[email protected]> Cc: [email protected] Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Ingo Molnar <[email protected]>
1 parent 853f90d commit f3438bc

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

net/ipv4/inet_connection_sock.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -603,7 +603,7 @@ static void reqsk_timer_handler(unsigned long data)
603603
if (req->num_timeout++ == 0)
604604
atomic_dec(&queue->young);
605605
timeo = min(TCP_TIMEOUT_INIT << req->num_timeout, TCP_RTO_MAX);
606-
mod_timer_pinned(&req->rsk_timer, jiffies + timeo);
606+
mod_timer(&req->rsk_timer, jiffies + timeo);
607607
return;
608608
}
609609
drop:
@@ -617,8 +617,9 @@ static void reqsk_queue_hash_req(struct request_sock *req,
617617
req->num_timeout = 0;
618618
req->sk = NULL;
619619

620-
setup_timer(&req->rsk_timer, reqsk_timer_handler, (unsigned long)req);
621-
mod_timer_pinned(&req->rsk_timer, jiffies + timeout);
620+
setup_pinned_timer(&req->rsk_timer, reqsk_timer_handler,
621+
(unsigned long)req);
622+
mod_timer(&req->rsk_timer, jiffies + timeout);
622623

623624
inet_ehash_insert(req_to_sk(req), NULL);
624625
/* before letting lookups find us, make sure all req fields

net/ipv4/inet_timewait_sock.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,8 @@ struct inet_timewait_sock *inet_twsk_alloc(const struct sock *sk,
188188
tw->tw_prot = sk->sk_prot_creator;
189189
atomic64_set(&tw->tw_cookie, atomic64_read(&sk->sk_cookie));
190190
twsk_net_set(tw, sock_net(sk));
191-
setup_timer(&tw->tw_timer, tw_timer_handler, (unsigned long)tw);
191+
setup_pinned_timer(&tw->tw_timer, tw_timer_handler,
192+
(unsigned long)tw);
192193
/*
193194
* Because we use RCU lookups, we should not set tw_refcnt
194195
* 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)
248249

249250
tw->tw_kill = timeo <= 4*HZ;
250251
if (!rearm) {
251-
BUG_ON(mod_timer_pinned(&tw->tw_timer, jiffies + timeo));
252+
BUG_ON(mod_timer(&tw->tw_timer, jiffies + timeo));
252253
atomic_inc(&tw->tw_dr->tw_count);
253254
} else {
254255
mod_timer_pending(&tw->tw_timer, jiffies + timeo);

0 commit comments

Comments
 (0)