~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/tools/testing/radix-tree/regression4.c

Version: ~ [ linux-6.11-rc3 ] ~ [ linux-6.10.4 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.45 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.104 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.164 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.223 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.281 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.319 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.9 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

Diff markup

Differences between /tools/testing/radix-tree/regression4.c (Version linux-6.11-rc3) and /tools/testing/radix-tree/regression4.c (Version linux-4.17.19)


  1 // SPDX-License-Identifier: GPL-2.0                 1 
  2 #include <linux/kernel.h>                         
  3 #include <linux/gfp.h>                            
  4 #include <linux/slab.h>                           
  5 #include <linux/radix-tree.h>                     
  6 #include <linux/rcupdate.h>                       
  7 #include <stdlib.h>                               
  8 #include <pthread.h>                              
  9 #include <stdio.h>                                
 10 #include <assert.h>                               
 11                                                   
 12 #include "regression.h"                           
 13                                                   
 14 static pthread_barrier_t worker_barrier;          
 15 static int obj0, obj1;                            
 16 static RADIX_TREE(mt_tree, GFP_KERNEL);           
 17                                                   
 18 static void *reader_fn(void *arg)                 
 19 {                                                 
 20         int i;                                    
 21         void *entry;                              
 22                                                   
 23         rcu_register_thread();                    
 24         pthread_barrier_wait(&worker_barrier);    
 25                                                   
 26         for (i = 0; i < 1000000; i++) {           
 27                 rcu_read_lock();                  
 28                 entry = radix_tree_lookup(&mt_    
 29                 rcu_read_unlock();                
 30                 if (entry != &obj0) {             
 31                         printf("iteration %d b    
 32                         abort();                  
 33                 }                                 
 34         }                                         
 35                                                   
 36         rcu_unregister_thread();                  
 37                                                   
 38         return NULL;                              
 39 }                                                 
 40                                                   
 41 static void *writer_fn(void *arg)                 
 42 {                                                 
 43         int i;                                    
 44                                                   
 45         rcu_register_thread();                    
 46         pthread_barrier_wait(&worker_barrier);    
 47                                                   
 48         for (i = 0; i < 1000000; i++) {           
 49                 radix_tree_insert(&mt_tree, 1,    
 50                 radix_tree_delete(&mt_tree, 1)    
 51         }                                         
 52                                                   
 53         rcu_unregister_thread();                  
 54                                                   
 55         return NULL;                              
 56 }                                                 
 57                                                   
 58 void regression4_test(void)                       
 59 {                                                 
 60         pthread_t reader, writer;                 
 61                                                   
 62         printv(1, "regression test 4 starting\    
 63                                                   
 64         radix_tree_insert(&mt_tree, 0, &obj0);    
 65         pthread_barrier_init(&worker_barrier,     
 66                                                   
 67         if (pthread_create(&reader, NULL, read    
 68             pthread_create(&writer, NULL, writ    
 69                 perror("pthread_create");         
 70                 exit(1);                          
 71         }                                         
 72                                                   
 73         if (pthread_join(reader, NULL) || pthr    
 74                 perror("pthread_join");           
 75                 exit(1);                          
 76         }                                         
 77                                                   
 78         printv(1, "regression test 4 passed\n"    
 79 }                                                 
 80                                                   

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php