[openib-general] Re: [Andrew Morton] inappropriate use of in_atomic()

Libor Michalek libor at topspin.com
Tue Mar 29 16:05:19 PST 2005


On Fri, Mar 11, 2005 at 03:43:16PM -0800, Libor Michalek wrote:
> On Fri, Mar 11, 2005 at 09:31:08AM +0200, Michael S. Tsirkin wrote:
> > 
> > Sdp also has a couple of uses.
> > Maybe we can use the atomic branch in all cases here, as well?
> > Libor?
> 
>   Yes, the case in sdp_iocb.c can probably always take the atomic
> path. The kmap/kunmap cases really only care whether we're in an
> interrupt, so switching to in_interrupt() should be sufficient.

  Patch to remove in_atomic in sdp_iocb.c for spawning a thread to
execute iocb completion. Instead we always spawn the completion.


-Libor

Index: sdp_iocb.c
===================================================================
--- sdp_iocb.c	(revision 2071)
+++ sdp_iocb.c	(working copy)
@@ -437,7 +437,7 @@
 	 * register IOCBs physical memory
 	 */
 	iocb->mem = ib_fmr_pool_map_phys(conn->fmr_pool,
-					 (u64 *)iocb->addr_array,
+					 iocb->addr_array,
 					 iocb->page_count,
 					 &iocb->io_addr);
 	if (IS_ERR(iocb->mem)) {
@@ -539,11 +539,8 @@
 {
 	iocb->status = status;
 	
-	if (in_atomic() || irqs_disabled()) {
-		INIT_WORK(&iocb->completion, do_iocb_complete, (void *)iocb);
-		schedule_work(&iocb->completion);
-	} else
-		do_iocb_complete(iocb);
+	INIT_WORK(&iocb->completion, do_iocb_complete, (void *)iocb);
+	schedule_work(&iocb->completion);
 	
 	return 0;
 }



More information about the general mailing list