mirror of
				https://github.com/torvalds/linux.git
				synced 2025-11-04 02:30:34 +02:00 
			
		
		
		
	dma-buf: make dma_fence structure a bit smaller v2
We clear the callback list on kref_put so that by the time we release the fence it is unused. No one should be adding to the cb_list that they don't themselves hold a reference for. This small change is actually making the structure 16% smaller. v2: add the comment to the code as well. Signed-off-by: Christian König <christian.koenig@amd.com> Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk> Link: https://patchwork.freedesktop.org/patch/322916/
This commit is contained in:
		
							parent
							
								
									a84ddb8380
								
							
						
					
					
						commit
						0e2f733add
					
				
					 1 changed files with 8 additions and 2 deletions
				
			
		| 
						 | 
					@ -65,8 +65,14 @@ struct dma_fence_cb;
 | 
				
			||||||
struct dma_fence {
 | 
					struct dma_fence {
 | 
				
			||||||
	struct kref refcount;
 | 
						struct kref refcount;
 | 
				
			||||||
	const struct dma_fence_ops *ops;
 | 
						const struct dma_fence_ops *ops;
 | 
				
			||||||
	struct rcu_head rcu;
 | 
						/* We clear the callback list on kref_put so that by the time we
 | 
				
			||||||
	struct list_head cb_list;
 | 
						 * release the fence it is unused. No one should be adding to the cb_list
 | 
				
			||||||
 | 
						 * that they don't themselves hold a reference for.
 | 
				
			||||||
 | 
						 */
 | 
				
			||||||
 | 
						union {
 | 
				
			||||||
 | 
							struct rcu_head rcu;
 | 
				
			||||||
 | 
							struct list_head cb_list;
 | 
				
			||||||
 | 
						};
 | 
				
			||||||
	spinlock_t *lock;
 | 
						spinlock_t *lock;
 | 
				
			||||||
	u64 context;
 | 
						u64 context;
 | 
				
			||||||
	u64 seqno;
 | 
						u64 seqno;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in a new issue