]>
Commit | Line | Data |
---|---|---|
82094b55 AF |
1 | From: Gerald Schaefer <geraldsc@de.ibm.com> |
2 | Subject: [PATCH] zfcp: optimize zfcp_qdio_account | |
3 | References: bnc#532063,LTC#55526 | |
4 | ||
5 | From: Heiko Carstens <heiko.carstens@de.ibm.com> | |
6 | ||
7 | Remove expensive ktime_get()/ktime_us_delta() functions from the hot | |
8 | path and use get_clock_monotonic() instead. | |
9 | This elimates seven function calls and avoids a lot of unnecessary | |
10 | calculations. | |
11 | ||
12 | Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com> | |
13 | ||
14 | Acked-by: John Jolly <jjolly@suse.de> | |
15 | --- | |
16 | ||
17 | drivers/s390/scsi/zfcp_def.h | 2 +- | |
18 | drivers/s390/scsi/zfcp_qdio.c | 11 +++++------ | |
19 | 2 files changed, 6 insertions(+), 7 deletions(-) | |
20 | ||
21 | Index: linux-sles11/drivers/s390/scsi/zfcp_def.h | |
22 | =================================================================== | |
23 | --- linux-sles11.orig/drivers/s390/scsi/zfcp_def.h 2009-08-17 15:31:27.000000000 +0200 | |
24 | +++ linux-sles11/drivers/s390/scsi/zfcp_def.h 2009-08-17 15:31:29.000000000 +0200 | |
25 | @@ -472,7 +472,7 @@ | |
26 | spinlock_t req_q_lock; /* for operations on queue */ | |
27 | int req_q_pci_batch; /* SBALs since PCI indication | |
28 | was last set */ | |
29 | - ktime_t req_q_time; /* time of last fill level change */ | |
30 | + unsigned long long req_q_time; /* time of last fill level change */ | |
31 | u64 req_q_util; /* for accounting */ | |
32 | spinlock_t qdio_stat_lock; | |
33 | u32 fsf_req_seq_no; /* FSF cmnd seq number */ | |
34 | Index: linux-sles11/drivers/s390/scsi/zfcp_qdio.c | |
35 | =================================================================== | |
36 | --- linux-sles11.orig/drivers/s390/scsi/zfcp_qdio.c 2009-08-17 15:31:27.000000000 +0200 | |
37 | +++ linux-sles11/drivers/s390/scsi/zfcp_qdio.c 2009-08-17 15:31:29.000000000 +0200 | |
38 | @@ -77,16 +77,15 @@ | |
39 | } | |
40 | ||
41 | /* this needs to be called prior to updating the queue fill level */ | |
42 | -static void zfcp_qdio_account(struct zfcp_adapter *adapter) | |
43 | +static inline void zfcp_qdio_account(struct zfcp_adapter *adapter) | |
44 | { | |
45 | - ktime_t now; | |
46 | - s64 span; | |
47 | + unsigned long long now, span; | |
48 | int free, used; | |
49 | ||
50 | spin_lock(&adapter->qdio_stat_lock); | |
51 | - now = ktime_get(); | |
52 | - span = ktime_us_delta(now, adapter->req_q_time); | |
53 | - free = max(0, atomic_read(&adapter->req_q.count)); | |
54 | + now = get_clock_monotonic(); | |
55 | + span = (now - adapter->req_q_time) >> 12; | |
56 | + free = atomic_read(&adapter->req_q.count); | |
57 | used = QDIO_MAX_BUFFERS_PER_Q - free; | |
58 | adapter->req_q_util += used * span; | |
59 | adapter->req_q_time = now; |