]> www.infradead.org Git - users/jedix/linux-maple.git/commit
sif: pqp: Be less aggressive in invoking cond_resched()
authorKnut Omang <knut.omang@oracle.com>
Fri, 22 Jul 2016 12:30:24 +0000 (14:30 +0200)
committerSantosh Shilimkar <santosh.shilimkar@oracle.com>
Wed, 27 Jul 2016 17:24:23 +0000 (10:24 -0700)
commitf022c32a8059afc20c22463c533bae0039ac697a
treea5759a478cf465afeb05b44f20118b8e8154013a
parentd4cec32ea7186cb4353c690726d2d66924697bb6
sif: pqp: Be less aggressive in invoking cond_resched()

This commit attempts to avoid unnecessary or potentially dangerous
calls to cond_resched() in the privileged QP completion polling code.

Privileged QP requests typically takes a few microseconds to
complete. Since we usually need the result of the operation
to be able to continue, user code usually calls poll_cq_waitfor()
to busy wait for the completion of the request. This commit
adds two measures to make this logic better:

1) Avoid rescheduling while interrupts have been turned off:
The driver was using the in_interrupt() test to avoid calling
cond_resched() from interrupt context, and leaving the rest of
the decision making of whether or not to reschedule to cond_resched().
Testing indicates that this could lead to deadlock prone calls to
schedule(), as cond_resched() would actually allow rescheduling if interrupts
have been disabled. Switch this logic to use irqs_disabled() instead, which will
cover both the interrupt case and the cases where interrupts have been disabled
by the caller.

2) Busywait for the completion for a few cycles before even trying to reschedule
or cpu_relax. Measurements indicate that 10 tries are enough to cover
a large fraction of cases on a lightly loaded system.

Orabug: 23733539

Change-Id: Ief35e1828d4dde9b692640f259c3df80ccdb553b
Signed-off-by: Knut Omang <knut.omang@oracle.com>
Reviewed-by: Francisco Trivino-Garcia <francisco.trivino@oracle.com>
drivers/infiniband/hw/sif/sif_pqp.c