mirror of
				https://github.com/torvalds/linux.git
				synced 2025-11-04 10:40:15 +02:00 
			
		
		
		
	net: xen-netback: hash.c: Use built-in RCU list checking
list_for_each_entry_rcu has built-in RCU and lock checking. Pass cond argument to list_for_each_entry_rcu. Signed-off-by: Madhuparna Bhowmik <madhuparnabhowmik04@gmail.com> Acked-by: Wei Liu <wei.liu@kernel.org> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
		
							parent
							
								
									6bc8038035
								
							
						
					
					
						commit
						f3265971de
					
				
					 1 changed files with 4 additions and 2 deletions
				
			
		| 
						 | 
					@ -51,7 +51,8 @@ static void xenvif_add_hash(struct xenvif *vif, const u8 *tag,
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	found = false;
 | 
						found = false;
 | 
				
			||||||
	oldest = NULL;
 | 
						oldest = NULL;
 | 
				
			||||||
	list_for_each_entry_rcu(entry, &vif->hash.cache.list, link) {
 | 
						list_for_each_entry_rcu(entry, &vif->hash.cache.list, link,
 | 
				
			||||||
 | 
									lockdep_is_held(&vif->hash.cache.lock)) {
 | 
				
			||||||
		/* Make sure we don't add duplicate entries */
 | 
							/* Make sure we don't add duplicate entries */
 | 
				
			||||||
		if (entry->len == len &&
 | 
							if (entry->len == len &&
 | 
				
			||||||
		    memcmp(entry->tag, tag, len) == 0)
 | 
							    memcmp(entry->tag, tag, len) == 0)
 | 
				
			||||||
| 
						 | 
					@ -102,7 +103,8 @@ static void xenvif_flush_hash(struct xenvif *vif)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	spin_lock_irqsave(&vif->hash.cache.lock, flags);
 | 
						spin_lock_irqsave(&vif->hash.cache.lock, flags);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	list_for_each_entry_rcu(entry, &vif->hash.cache.list, link) {
 | 
						list_for_each_entry_rcu(entry, &vif->hash.cache.list, link,
 | 
				
			||||||
 | 
									lockdep_is_held(&vif->hash.cache.lock)) {
 | 
				
			||||||
		list_del_rcu(&entry->link);
 | 
							list_del_rcu(&entry->link);
 | 
				
			||||||
		vif->hash.cache.count--;
 | 
							vif->hash.cache.count--;
 | 
				
			||||||
		kfree_rcu(entry, rcu);
 | 
							kfree_rcu(entry, rcu);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in a new issue