@@ -540,8 +540,11 @@ static void rds_ib_cq_comp_handler_fastreg(struct ib_cq *cq, void *context)
540
540
{
541
541
struct rds_ib_device * rds_ibdev = context ;
542
542
543
- queue_work_on (smp_processor_id (),
544
- rds_evt_wq , & rds_ibdev -> fastreg_w );
543
+ if (rds_ib_preferred_cpu & RDS_IB_PREFER_CPU_TASKLET )
544
+ tasklet_schedule (& rds_ibdev -> fastreg_tasklet );
545
+ else
546
+ queue_work_on (smp_processor_id (),
547
+ rds_evt_wq , & rds_ibdev -> fastreg_w );
545
548
}
546
549
547
550
@@ -613,8 +616,11 @@ static void rds_ib_cq_comp_handler_send(struct ib_cq *cq, void *context)
613
616
& ic -> i_cq_follow_affinity_w ,
614
617
msecs_to_jiffies (RDS_IB_CQ_FOLLOW_AFFINITY_THROTTLE ));
615
618
616
- queue_work_on (ic -> i_preferred_cpu ,
617
- rds_evt_wq , & ic -> i_send_w );
619
+ if (rds_ib_preferred_cpu & RDS_IB_PREFER_CPU_TASKLET )
620
+ tasklet_schedule (& ic -> i_stasklet );
621
+ else
622
+ queue_work_on (ic -> i_preferred_cpu ,
623
+ rds_evt_wq , & ic -> i_send_w );
618
624
}
619
625
620
626
static void rds_ib_cq_comp_handler_recv (struct ib_cq * cq , void * context )
@@ -631,8 +637,11 @@ static void rds_ib_cq_comp_handler_recv(struct ib_cq *cq, void *context)
631
637
& ic -> i_cq_follow_affinity_w ,
632
638
msecs_to_jiffies (RDS_IB_CQ_FOLLOW_AFFINITY_THROTTLE ));
633
639
634
- queue_work_on (ic -> i_preferred_cpu ,
635
- rds_evt_wq , & ic -> i_recv_w );
640
+ if (rds_ib_preferred_cpu & RDS_IB_PREFER_CPU_TASKLET )
641
+ tasklet_schedule (& ic -> i_rtasklet );
642
+ else
643
+ queue_work_on (ic -> i_preferred_cpu ,
644
+ rds_evt_wq , & ic -> i_recv_w );
636
645
}
637
646
638
647
static void poll_fcq (struct rds_ib_device * rds_ibdev , struct ib_cq * cq ,
@@ -699,6 +708,15 @@ static void poll_rcq(struct rds_ib_connection *ic, struct ib_cq *cq,
699
708
}
700
709
}
701
710
711
+ static void rds_ib_tasklet_fn_fastreg (unsigned long data )
712
+ {
713
+ struct rds_ib_device * rds_ibdev = (struct rds_ib_device * )data ;
714
+
715
+ poll_fcq (rds_ibdev , rds_ibdev -> fastreg_cq , rds_ibdev -> fastreg_wc );
716
+ ib_req_notify_cq (rds_ibdev -> fastreg_cq , IB_CQ_NEXT_COMP );
717
+ poll_fcq (rds_ibdev , rds_ibdev -> fastreg_cq , rds_ibdev -> fastreg_wc );
718
+ }
719
+
702
720
static void rds_ib_cq_comp_handler_fastreg_w (struct work_struct * work )
703
721
{
704
722
struct rds_ib_device * rds_ibdev = container_of (work ,
@@ -710,11 +728,8 @@ static void rds_ib_cq_comp_handler_fastreg_w(struct work_struct *work)
710
728
poll_fcq (rds_ibdev , rds_ibdev -> fastreg_cq , rds_ibdev -> fastreg_wc );
711
729
}
712
730
713
- void rds_ib_send_w (struct work_struct * work )
731
+ static void rds_ib_send_cb (struct rds_ib_connection * ic )
714
732
{
715
- struct rds_ib_connection * ic = container_of (work ,
716
- struct rds_ib_connection ,
717
- i_send_w );
718
733
struct rds_connection * conn = ic -> conn ;
719
734
720
735
rds_ib_stats_inc (s_ib_tasklet_call );
@@ -733,6 +748,22 @@ void rds_ib_send_w(struct work_struct *work)
733
748
rds_send_xmit (& ic -> conn -> c_path [0 ]);
734
749
}
735
750
751
+ void rds_ib_tasklet_fn_send (unsigned long data )
752
+ {
753
+ struct rds_ib_connection * ic = (struct rds_ib_connection * ) data ;
754
+
755
+ rds_ib_send_cb (ic );
756
+ }
757
+
758
+ void rds_ib_send_w (struct work_struct * work )
759
+ {
760
+ struct rds_ib_connection * ic = container_of (work ,
761
+ struct rds_ib_connection ,
762
+ i_send_w );
763
+
764
+ rds_ib_send_cb (ic );
765
+ }
766
+
736
767
/*
737
768
* Note: rds_ib_rx(): don't call with irqs disabled.
738
769
* It calls rds_send_drop_acked() which calls other
@@ -788,12 +819,8 @@ static void rds_ib_rx(struct rds_ib_connection *ic)
788
819
}
789
820
}
790
821
791
- void rds_ib_recv_w (struct work_struct * work )
822
+ static void rds_ib_recv_cb (struct rds_ib_connection * ic )
792
823
{
793
- struct rds_ib_connection * ic = container_of (work ,
794
- struct rds_ib_connection ,
795
- i_recv_w );
796
-
797
824
spin_lock_bh (& ic -> i_rx_lock );
798
825
if (ic -> i_rx_wait_for_handler )
799
826
goto out ;
@@ -802,6 +829,22 @@ void rds_ib_recv_w(struct work_struct *work)
802
829
spin_unlock_bh (& ic -> i_rx_lock );
803
830
}
804
831
832
+ void rds_ib_tasklet_fn_recv (unsigned long data )
833
+ {
834
+ struct rds_ib_connection * ic = (struct rds_ib_connection * ) data ;
835
+
836
+ rds_ib_recv_cb (ic );
837
+ }
838
+
839
+ void rds_ib_recv_w (struct work_struct * work )
840
+ {
841
+ struct rds_ib_connection * ic = container_of (work ,
842
+ struct rds_ib_connection ,
843
+ i_recv_w );
844
+
845
+ rds_ib_recv_cb (ic );
846
+ }
847
+
805
848
static void rds_ib_rx_handler (struct work_struct * _work )
806
849
{
807
850
struct rds_ib_rx_work * work =
@@ -2208,8 +2251,11 @@ void rds_ib_conn_path_shutdown_prepare(struct rds_conn_path *cp)
2208
2251
the recv work to drain the RX CQ.
2209
2252
*/
2210
2253
wait_for_completion (& ic -> i_last_wqe_complete );
2211
- queue_work_on (smp_processor_id (),
2212
- rds_evt_wq , & ic -> i_recv_w );
2254
+ if (rds_ib_preferred_cpu & RDS_IB_PREFER_CPU_TASKLET )
2255
+ tasklet_schedule (& ic -> i_rtasklet );
2256
+ else
2257
+ queue_work_on (smp_processor_id (),
2258
+ rds_evt_wq , & ic -> i_recv_w );
2213
2259
}
2214
2260
}
2215
2261
}
@@ -2249,6 +2295,8 @@ void rds_ib_conn_path_shutdown_final(struct rds_conn_path *cp)
2249
2295
if (ic -> i_cm_id ) {
2250
2296
cancel_delayed_work_sync (& ic -> i_rx_w .work );
2251
2297
2298
+ tasklet_kill (& ic -> i_stasklet );
2299
+ tasklet_kill (& ic -> i_rtasklet );
2252
2300
flush_workqueue (rds_evt_wq );
2253
2301
2254
2302
ic -> i_flags &= ~RDS_IB_CQ_ERR ;
@@ -2362,6 +2410,8 @@ int rds_ib_conn_alloc(struct rds_connection *conn, gfp_t gfp)
2362
2410
INIT_LIST_HEAD (& ic -> ib_node );
2363
2411
init_rwsem (& ic -> i_cm_id_free_lock );
2364
2412
2413
+ tasklet_init (& ic -> i_stasklet , rds_ib_tasklet_fn_send , (unsigned long ) ic );
2414
+ tasklet_init (& ic -> i_rtasklet , rds_ib_tasklet_fn_recv , (unsigned long ) ic );
2365
2415
INIT_WORK (& ic -> i_send_w , rds_ib_send_w );
2366
2416
INIT_WORK (& ic -> i_recv_w , rds_ib_recv_w );
2367
2417
mutex_init (& ic -> i_recv_mutex );
@@ -2451,7 +2501,9 @@ void rds_ib_destroy_fastreg(struct rds_ib_device *rds_ibdev)
2451
2501
*/
2452
2502
WARN_ON (atomic_read (& rds_ibdev -> fastreg_wrs ) != RDS_IB_DEFAULT_FREG_WR );
2453
2503
2504
+ tasklet_kill (& rds_ibdev -> fastreg_tasklet );
2454
2505
flush_workqueue (rds_evt_wq );
2506
+
2455
2507
if (rds_ibdev -> fastreg_qp ) {
2456
2508
/* Destroy qp */
2457
2509
if (ib_destroy_qp (rds_ibdev -> fastreg_qp ))
@@ -2612,6 +2664,9 @@ int rds_ib_setup_fastreg(struct rds_ib_device *rds_ibdev)
2612
2664
"moved qp to RTS state for device" ,
2613
2665
0 );
2614
2666
2667
+ tasklet_init (& rds_ibdev -> fastreg_tasklet , rds_ib_tasklet_fn_fastreg ,
2668
+ (unsigned long )rds_ibdev );
2669
+
2615
2670
INIT_WORK (& rds_ibdev -> fastreg_w , rds_ib_cq_comp_handler_fastreg_w );
2616
2671
atomic_set (& rds_ibdev -> fastreg_wrs , RDS_IB_DEFAULT_FREG_WR );
2617
2672
0 commit comments