linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] net/ipv4: queue work on power efficient wq
@ 2014-01-22  6:53 Viresh Kumar
  2014-01-22  6:53 ` [PATCH 2/2] net/neighbour: " Viresh Kumar
  2014-01-23  5:58 ` [PATCH 1/2] net/ipv4: " David Miller
  0 siblings, 2 replies; 4+ messages in thread
From: Viresh Kumar @ 2014-01-22  6:53 UTC (permalink / raw)
  To: davem; +Cc: linaro-kernel, patches, netdev, linux-kernel, Viresh Kumar

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 <viresh.kumar@linaro.org>
---
Initial support for power-efficient workqueues was added here:
https://lkml.org/lkml/2013/4/24/215

 net/ipv4/devinet.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/net/ipv4/devinet.c b/net/ipv4/devinet.c
index 646023b..ac2dff3 100644
--- a/net/ipv4/devinet.c
+++ b/net/ipv4/devinet.c
@@ -474,7 +474,7 @@ static int __inet_insert_ifa(struct in_ifaddr *ifa, struct nlmsghdr *nlh,
 	inet_hash_insert(dev_net(in_dev->dev), ifa);
 
 	cancel_delayed_work(&check_lifetime_work);
-	schedule_delayed_work(&check_lifetime_work, 0);
+	queue_delayed_work(system_power_efficient_wq, &check_lifetime_work, 0);
 
 	/* Send message first, then call notifier.
 	   Notifier will trigger FIB update, so that
@@ -684,7 +684,8 @@ static void check_lifetime(struct work_struct *work)
 	if (time_before(next_sched, now + ADDRCONF_TIMER_FUZZ_MAX))
 		next_sched = now + ADDRCONF_TIMER_FUZZ_MAX;
 
-	schedule_delayed_work(&check_lifetime_work, next_sched - now);
+	queue_delayed_work(system_power_efficient_wq, &check_lifetime_work,
+			next_sched - now);
 }
 
 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)
 		ifa = ifa_existing;
 		set_ifa_lifetime(ifa, valid_lft, prefered_lft);
 		cancel_delayed_work(&check_lifetime_work);
-		schedule_delayed_work(&check_lifetime_work, 0);
+		queue_delayed_work(system_power_efficient_wq,
+				&check_lifetime_work, 0);
 		rtmsg_ifa(RTM_NEWADDR, ifa, nlh, NETLINK_CB(skb).portid);
 		blocking_notifier_call_chain(&inetaddr_chain, NETDEV_UP, ifa);
 	}
@@ -2322,7 +2324,7 @@ void __init devinet_init(void)
 	register_gifconf(PF_INET, inet_gifconf);
 	register_netdevice_notifier(&ip_netdev_notifier);
 
-	schedule_delayed_work(&check_lifetime_work, 0);
+	queue_delayed_work(system_power_efficient_wq, &check_lifetime_work, 0);
 
 	rtnl_af_register(&inet_af_ops);
 
-- 
1.7.12.rc2.18.g61b472e


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 2/2] net/neighbour: queue work on power efficient wq
  2014-01-22  6:53 [PATCH 1/2] net/ipv4: queue work on power efficient wq Viresh Kumar
@ 2014-01-22  6:53 ` Viresh Kumar
  2014-01-23  5:58   ` David Miller
  2014-01-23  5:58 ` [PATCH 1/2] net/ipv4: " David Miller
  1 sibling, 1 reply; 4+ messages in thread
From: Viresh Kumar @ 2014-01-22  6:53 UTC (permalink / raw)
  To: davem; +Cc: linaro-kernel, patches, netdev, linux-kernel, Viresh Kumar

Workqueue used in neighbour 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 <viresh.kumar@linaro.org>
---
 net/core/neighbour.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/net/core/neighbour.c b/net/core/neighbour.c
index f8012fe..b9e9e0d 100644
--- a/net/core/neighbour.c
+++ b/net/core/neighbour.c
@@ -828,7 +828,7 @@ out:
 	 * ARP entry timeouts range from 1/2 BASE_REACHABLE_TIME to 3/2
 	 * BASE_REACHABLE_TIME.
 	 */
-	schedule_delayed_work(&tbl->gc_work,
+	queue_delayed_work(system_power_efficient_wq, &tbl->gc_work,
 			      NEIGH_VAR(&tbl->parms, BASE_REACHABLE_TIME) >> 1);
 	write_unlock_bh(&tbl->lock);
 }
@@ -1565,7 +1565,8 @@ static void neigh_table_init_no_netlink(struct neigh_table *tbl)
 
 	rwlock_init(&tbl->lock);
 	INIT_DEFERRABLE_WORK(&tbl->gc_work, neigh_periodic_work);
-	schedule_delayed_work(&tbl->gc_work, tbl->parms.reachable_time);
+	queue_delayed_work(system_power_efficient_wq, &tbl->gc_work,
+			tbl->parms.reachable_time);
 	setup_timer(&tbl->proxy_timer, neigh_proxy_process, (unsigned long)tbl);
 	skb_queue_head_init_class(&tbl->proxy_queue,
 			&neigh_table_proxy_queue_class);
-- 
1.7.12.rc2.18.g61b472e


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH 1/2] net/ipv4: queue work on power efficient wq
  2014-01-22  6:53 [PATCH 1/2] net/ipv4: queue work on power efficient wq Viresh Kumar
  2014-01-22  6:53 ` [PATCH 2/2] net/neighbour: " Viresh Kumar
@ 2014-01-23  5:58 ` David Miller
  1 sibling, 0 replies; 4+ messages in thread
From: David Miller @ 2014-01-23  5:58 UTC (permalink / raw)
  To: viresh.kumar; +Cc: linaro-kernel, patches, netdev, linux-kernel

From: Viresh Kumar <viresh.kumar@linaro.org>
Date: Wed, 22 Jan 2014 12:23:32 +0530

> 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 <viresh.kumar@linaro.org>

Applied.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 2/2] net/neighbour: queue work on power efficient wq
  2014-01-22  6:53 ` [PATCH 2/2] net/neighbour: " Viresh Kumar
@ 2014-01-23  5:58   ` David Miller
  0 siblings, 0 replies; 4+ messages in thread
From: David Miller @ 2014-01-23  5:58 UTC (permalink / raw)
  To: viresh.kumar; +Cc: linaro-kernel, patches, netdev, linux-kernel

From: Viresh Kumar <viresh.kumar@linaro.org>
Date: Wed, 22 Jan 2014 12:23:33 +0530

> Workqueue used in neighbour 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 <viresh.kumar@linaro.org>

Applied.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2014-01-23  5:58 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-01-22  6:53 [PATCH 1/2] net/ipv4: queue work on power efficient wq Viresh Kumar
2014-01-22  6:53 ` [PATCH 2/2] net/neighbour: " Viresh Kumar
2014-01-23  5:58   ` David Miller
2014-01-23  5:58 ` [PATCH 1/2] net/ipv4: " David Miller

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).