mirror of
				git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
				synced 2025-10-31 16:54:21 +00:00 
			
		
		
		
	svcrdma: Optimize svc_rdma_cc_init()
The atomic_inc_return() in svc_rdma_send_cid_init() is expensive. Some svc_rdma_chunk_ctxt's now reside in long-lived container structures. They don't need a fresh completion ID for every I/O operation. Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
This commit is contained in:
		
							parent
							
								
									28ee0ec894
								
							
						
					
					
						commit
						2a95ce479e
					
				
					 3 changed files with 7 additions and 6 deletions
				
			
		|  | @ -123,7 +123,7 @@ svc_rdma_recv_ctxt_alloc(struct svcxprt_rdma *rdma) | ||||||
| 	dma_addr_t addr; | 	dma_addr_t addr; | ||||||
| 	void *buffer; | 	void *buffer; | ||||||
| 
 | 
 | ||||||
| 	ctxt = kmalloc_node(sizeof(*ctxt), GFP_KERNEL, node); | 	ctxt = kzalloc_node(sizeof(*ctxt), GFP_KERNEL, node); | ||||||
| 	if (!ctxt) | 	if (!ctxt) | ||||||
| 		goto fail0; | 		goto fail0; | ||||||
| 	buffer = kmalloc_node(rdma->sc_max_req_size, GFP_KERNEL, node); | 	buffer = kmalloc_node(rdma->sc_max_req_size, GFP_KERNEL, node); | ||||||
|  |  | ||||||
|  | @ -154,7 +154,10 @@ static int svc_rdma_rw_ctx_init(struct svcxprt_rdma *rdma, | ||||||
| void svc_rdma_cc_init(struct svcxprt_rdma *rdma, | void svc_rdma_cc_init(struct svcxprt_rdma *rdma, | ||||||
| 		      struct svc_rdma_chunk_ctxt *cc) | 		      struct svc_rdma_chunk_ctxt *cc) | ||||||
| { | { | ||||||
| 	svc_rdma_send_cid_init(rdma, &cc->cc_cid); | 	struct rpc_rdma_cid *cid = &cc->cc_cid; | ||||||
|  | 
 | ||||||
|  | 	if (unlikely(!cid->ci_completion_id)) | ||||||
|  | 		svc_rdma_send_cid_init(rdma, cid); | ||||||
| 
 | 
 | ||||||
| 	INIT_LIST_HEAD(&cc->cc_rwctxts); | 	INIT_LIST_HEAD(&cc->cc_rwctxts); | ||||||
| 	cc->cc_sqecount = 0; | 	cc->cc_sqecount = 0; | ||||||
|  | @ -221,15 +224,13 @@ svc_rdma_write_info_alloc(struct svcxprt_rdma *rdma, | ||||||
| { | { | ||||||
| 	struct svc_rdma_write_info *info; | 	struct svc_rdma_write_info *info; | ||||||
| 
 | 
 | ||||||
| 	info = kmalloc_node(sizeof(*info), GFP_KERNEL, | 	info = kzalloc_node(sizeof(*info), GFP_KERNEL, | ||||||
| 			    ibdev_to_node(rdma->sc_cm_id->device)); | 			    ibdev_to_node(rdma->sc_cm_id->device)); | ||||||
| 	if (!info) | 	if (!info) | ||||||
| 		return info; | 		return info; | ||||||
| 
 | 
 | ||||||
| 	info->wi_rdma = rdma; | 	info->wi_rdma = rdma; | ||||||
| 	info->wi_chunk = chunk; | 	info->wi_chunk = chunk; | ||||||
| 	info->wi_seg_off = 0; |  | ||||||
| 	info->wi_seg_no = 0; |  | ||||||
| 	svc_rdma_cc_init(rdma, &info->wi_cc); | 	svc_rdma_cc_init(rdma, &info->wi_cc); | ||||||
| 	info->wi_cc.cc_cqe.done = svc_rdma_write_done; | 	info->wi_cc.cc_cqe.done = svc_rdma_write_done; | ||||||
| 	return info; | 	return info; | ||||||
|  |  | ||||||
|  | @ -122,7 +122,7 @@ svc_rdma_send_ctxt_alloc(struct svcxprt_rdma *rdma) | ||||||
| 	void *buffer; | 	void *buffer; | ||||||
| 	int i; | 	int i; | ||||||
| 
 | 
 | ||||||
| 	ctxt = kmalloc_node(struct_size(ctxt, sc_sges, rdma->sc_max_send_sges), | 	ctxt = kzalloc_node(struct_size(ctxt, sc_sges, rdma->sc_max_send_sges), | ||||||
| 			    GFP_KERNEL, node); | 			    GFP_KERNEL, node); | ||||||
| 	if (!ctxt) | 	if (!ctxt) | ||||||
| 		goto fail0; | 		goto fail0; | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		
		Reference in a new issue
	
	 Chuck Lever
						Chuck Lever