diff options
author | Julian Wiedmann <jwi@linux.ibm.com> | 2019-04-26 10:37:41 +0300 |
---|---|---|
committer | Martin Schwidefsky <schwidefsky@de.ibm.com> | 2019-05-08 16:01:23 +0300 |
commit | a698e1372800b7e5dde2e461c1d3948c2e06032a (patch) | |
tree | 2570ab3dd23f29f1f61a774ac7eb04e17b3aa528 /drivers/s390/cio | |
parent | 5a19d67027283c77f51b971485c3e579d94b5a2f (diff) | |
download | linux-a698e1372800b7e5dde2e461c1d3948c2e06032a.tar.xz |
s390/qdio: optimize state inspection of HW-owned SBALs
When get_buf_states() gets called with count > 1, it scans the
corresponding number of SBAL states until it encounters a mismatch.
But when these SBALs are in a HW-owned state, the callers don't actually
care _how many_ such SBALs are on the queue. If we can't process the
first SBAL, we can't process any of the following SBALs either. So when
the first SBAL is HW-owned, skip the scan of the remaining SBALs and
thus save some CPU time.
Signed-off-by: Julian Wiedmann <jwi@linux.ibm.com>
Reviewed-by: Jens Remus <jremus@linux.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Diffstat (limited to 'drivers/s390/cio')
-rw-r--r-- | drivers/s390/cio/qdio_main.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/drivers/s390/cio/qdio_main.c b/drivers/s390/cio/qdio_main.c index be93172555ec..7b7620de2acd 100644 --- a/drivers/s390/cio/qdio_main.c +++ b/drivers/s390/cio/qdio_main.c @@ -205,17 +205,22 @@ static inline int get_buf_states(struct qdio_q *q, unsigned int bufnr, int auto_ack, int merge_pending) { unsigned char __state = 0; - int i; + int i = 1; if (is_qebsm(q)) return qdio_do_eqbs(q, state, bufnr, count, auto_ack); /* get initial state: */ __state = q->slsb.val[bufnr]; + + /* Bail out early if there is no work on the queue: */ + if (__state & SLSB_OWNER_CU) + goto out; + if (merge_pending && __state == SLSB_P_OUTPUT_PENDING) __state = SLSB_P_OUTPUT_EMPTY; - for (i = 1; i < count; i++) { + for (; i < count; i++) { bufnr = next_buf(bufnr); /* merge PENDING into EMPTY: */ @@ -228,6 +233,8 @@ static inline int get_buf_states(struct qdio_q *q, unsigned int bufnr, if (q->slsb.val[bufnr] != __state) break; } + +out: *state = __state; return i; } |