summaryrefslogtreecommitdiffstats
path: root/include/net
diff options
context:
space:
mode:
authorEliezer Tamir <eliezer.tamir@linux.intel.com>2013-06-28 15:59:35 +0300
committerDavid S. Miller <davem@davemloft.net>2013-07-01 14:06:47 -0700
commit91e2fd337839319c7745e2cb84cfbf8cf1426a1a (patch)
tree1a832c8fb04fc687dfd40e4a4b69b15d60049172 /include/net
parentad6276e0fe724b1c8ac3a0bf138d151665ab2349 (diff)
downloadop-kernel-dev-91e2fd337839319c7745e2cb84cfbf8cf1426a1a.zip
op-kernel-dev-91e2fd337839319c7745e2cb84cfbf8cf1426a1a.tar.gz
net: avoid calling sched_clock when LLS is off
Change Low Latency Sockets code for select and poll so that when LLS is disabled sched_clock() is never called. Also, avoid sending POLL_LL to sockets if disabled. Reported-by: Andi Kleen <andi@firstfloor.org> Signed-off-by: Eliezer Tamir <eliezer.tamir@linux.intel.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/net')
-rw-r--r--include/net/ll_poll.h17
1 files changed, 15 insertions, 2 deletions
diff --git a/include/net/ll_poll.h b/include/net/ll_poll.h
index 6d45e6f..6c06f7c 100644
--- a/include/net/ll_poll.h
+++ b/include/net/ll_poll.h
@@ -37,6 +37,11 @@ extern unsigned int sysctl_net_ll_poll __read_mostly;
#define LL_FLUSH_FAILED -1
#define LL_FLUSH_BUSY -2
+static inline unsigned int ll_get_flag(void)
+{
+ return sysctl_net_ll_poll ? POLL_LL : 0;
+}
+
/* a wrapper to make debug_smp_processor_id() happy
* we can use sched_clock() because we don't care much about precision
* we only care that the average is bounded
@@ -67,10 +72,14 @@ static inline u64 ll_sk_end_time(struct sock *sk)
return ((u64)ACCESS_ONCE(sk->sk_ll_usec) << 10) + ll_sched_clock();
}
-/* in poll/select we use the global sysctl_net_ll_poll value */
+/* in poll/select we use the global sysctl_net_ll_poll value
+ * only call sched_clock() if enabled
+ */
static inline u64 ll_end_time(void)
{
- return ((u64)ACCESS_ONCE(sysctl_net_ll_poll) << 10) + ll_sched_clock();
+ u64 end_time = ACCESS_ONCE(sysctl_net_ll_poll);
+
+ return end_time ? (end_time << 10) + ll_sched_clock() : 0;
}
static inline bool sk_valid_ll(struct sock *sk)
@@ -141,6 +150,10 @@ static inline void sk_mark_ll(struct sock *sk, struct sk_buff *skb)
}
#else /* CONFIG_NET_LL_RX_POLL */
+static inline unsigned long ll_get_flag(void)
+{
+ return 0;
+}
static inline u64 sk_ll_end_time(struct sock *sk)
{
OpenPOWER on IntegriCloud