提交 41e05a12 编写于 作者: H Heiko Carstens 提交者: James Bottomley

[SCSI] zfcp: optimize zfcp_qdio_account

Remove expensive ktime_get()/ktime_us_delta() functions from the hot
path and use get_clock_monotonic() instead. This elimates seven
function calls and avoids a lot of unnecessary calculations.
Signed-off-by: NHeiko Carstens <heiko.carstens@de.ibm.com>
Signed-off-by: NChristof Schmitt <christof.schmitt@de.ibm.com>
Signed-off-by: NJames Bottomley <James.Bottomley@suse.de>
上级 b592e89a
...@@ -438,7 +438,7 @@ struct zfcp_qdio { ...@@ -438,7 +438,7 @@ struct zfcp_qdio {
struct zfcp_qdio_queue req_q; struct zfcp_qdio_queue req_q;
spinlock_t stat_lock; spinlock_t stat_lock;
spinlock_t req_q_lock; spinlock_t req_q_lock;
ktime_t req_q_time; unsigned long long req_q_time;
u64 req_q_util; u64 req_q_util;
atomic_t req_q_full; atomic_t req_q_full;
wait_queue_head_t req_q_wq; wait_queue_head_t req_q_wq;
......
...@@ -56,16 +56,15 @@ static void zfcp_qdio_zero_sbals(struct qdio_buffer *sbal[], int first, int cnt) ...@@ -56,16 +56,15 @@ static void zfcp_qdio_zero_sbals(struct qdio_buffer *sbal[], int first, int cnt)
} }
/* this needs to be called prior to updating the queue fill level */ /* this needs to be called prior to updating the queue fill level */
static void zfcp_qdio_account(struct zfcp_qdio *qdio) static inline void zfcp_qdio_account(struct zfcp_qdio *qdio)
{ {
ktime_t now; unsigned long long now, span;
s64 span;
int free, used; int free, used;
spin_lock(&qdio->stat_lock); spin_lock(&qdio->stat_lock);
now = ktime_get(); now = get_clock_monotonic();
span = ktime_us_delta(now, qdio->req_q_time); span = (now - qdio->req_q_time) >> 12;
free = max(0, atomic_read(&qdio->req_q.count)); free = atomic_read(&qdio->req_q.count);
used = QDIO_MAX_BUFFERS_PER_Q - free; used = QDIO_MAX_BUFFERS_PER_Q - free;
qdio->req_q_util += used * span; qdio->req_q_util += used * span;
qdio->req_q_time = now; qdio->req_q_time = now;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册