Skip to content

Commit 906e073

Browse files
vireshkdavem330
authored andcommitted
net/ipv4: queue work on power efficient wq
Workqueue used in ipv4 layer have no real dependency of scheduling these on the cpu which scheduled them. On a idle system, it is observed that an idle cpu wakes up many times just to service this work. It would be better if we can schedule it on a cpu which the scheduler believes to be the most appropriate one. This patch replaces normal workqueues with power efficient versions. This doesn't change existing behavior of code unless CONFIG_WQ_POWER_EFFICIENT is enabled. Signed-off-by: Viresh Kumar <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 7c90cc2 commit 906e073

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

net/ipv4/devinet.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -474,7 +474,7 @@ static int __inet_insert_ifa(struct in_ifaddr *ifa, struct nlmsghdr *nlh,
474474
inet_hash_insert(dev_net(in_dev->dev), ifa);
475475

476476
cancel_delayed_work(&check_lifetime_work);
477-
schedule_delayed_work(&check_lifetime_work, 0);
477+
queue_delayed_work(system_power_efficient_wq, &check_lifetime_work, 0);
478478

479479
/* Send message first, then call notifier.
480480
Notifier will trigger FIB update, so that
@@ -684,7 +684,8 @@ static void check_lifetime(struct work_struct *work)
684684
if (time_before(next_sched, now + ADDRCONF_TIMER_FUZZ_MAX))
685685
next_sched = now + ADDRCONF_TIMER_FUZZ_MAX;
686686

687-
schedule_delayed_work(&check_lifetime_work, next_sched - now);
687+
queue_delayed_work(system_power_efficient_wq, &check_lifetime_work,
688+
next_sched - now);
688689
}
689690

690691
static void set_ifa_lifetime(struct in_ifaddr *ifa, __u32 valid_lft,
@@ -842,7 +843,8 @@ static int inet_rtm_newaddr(struct sk_buff *skb, struct nlmsghdr *nlh)
842843
ifa = ifa_existing;
843844
set_ifa_lifetime(ifa, valid_lft, prefered_lft);
844845
cancel_delayed_work(&check_lifetime_work);
845-
schedule_delayed_work(&check_lifetime_work, 0);
846+
queue_delayed_work(system_power_efficient_wq,
847+
&check_lifetime_work, 0);
846848
rtmsg_ifa(RTM_NEWADDR, ifa, nlh, NETLINK_CB(skb).portid);
847849
blocking_notifier_call_chain(&inetaddr_chain, NETDEV_UP, ifa);
848850
}
@@ -2322,7 +2324,7 @@ void __init devinet_init(void)
23222324
register_gifconf(PF_INET, inet_gifconf);
23232325
register_netdevice_notifier(&ip_netdev_notifier);
23242326

2325-
schedule_delayed_work(&check_lifetime_work, 0);
2327+
queue_delayed_work(system_power_efficient_wq, &check_lifetime_work, 0);
23262328

23272329
rtnl_af_register(&inet_af_ops);
23282330

0 commit comments

Comments
 (0)