File tree Expand file tree Collapse file tree 7 files changed +3
-38
lines changed Expand file tree Collapse file tree 7 files changed +3
-38
lines changed Original file line number Diff line number Diff line change @@ -386,13 +386,6 @@ static void array_map_free(struct bpf_map *map)
386
386
{
387
387
struct bpf_array * array = container_of (map , struct bpf_array , map );
388
388
389
- /* at this point bpf_prog->aux->refcnt == 0 and this map->refcnt == 0,
390
- * so the programs (can be more than one that used this map) were
391
- * disconnected from events. Wait for outstanding programs to complete
392
- * and free the array
393
- */
394
- synchronize_rcu ();
395
-
396
389
if (array -> map .map_type == BPF_MAP_TYPE_PERCPU_ARRAY )
397
390
bpf_array_free_percpu (array );
398
391
@@ -546,8 +539,6 @@ static void fd_array_map_free(struct bpf_map *map)
546
539
struct bpf_array * array = container_of (map , struct bpf_array , map );
547
540
int i ;
548
541
549
- synchronize_rcu ();
550
-
551
542
/* make sure it's empty */
552
543
for (i = 0 ; i < array -> map .max_entries ; i ++ )
553
544
BUG_ON (array -> ptrs [i ] != NULL );
Original file line number Diff line number Diff line change @@ -1290,12 +1290,10 @@ static void htab_map_free(struct bpf_map *map)
1290
1290
{
1291
1291
struct bpf_htab * htab = container_of (map , struct bpf_htab , map );
1292
1292
1293
- /* at this point bpf_prog->aux->refcnt == 0 and this map->refcnt == 0,
1294
- * so the programs (can be more than one that used this map) were
1295
- * disconnected from events. Wait for outstanding critical sections in
1296
- * these programs to complete
1293
+ /* bpf_free_used_maps() or close(map_fd) will trigger this map_free callback.
1294
+ * bpf_free_used_maps() is called after bpf prog is no longer executing.
1295
+ * There is no need to synchronize_rcu() here to protect map elements.
1297
1296
*/
1298
- synchronize_rcu ();
1299
1297
1300
1298
/* some of free_htab_elem() callbacks for elements of this map may
1301
1299
* not have executed. Wait for them.
Original file line number Diff line number Diff line change @@ -589,11 +589,6 @@ static void trie_free(struct bpf_map *map)
589
589
struct lpm_trie_node __rcu * * slot ;
590
590
struct lpm_trie_node * node ;
591
591
592
- /* Wait for outstanding programs to complete
593
- * update/lookup/delete/get_next_key and free the trie.
594
- */
595
- synchronize_rcu ();
596
-
597
592
/* Always start at the root and walk down to a node that has no
598
593
* children. Then free that node, nullify its reference in the parent
599
594
* and start over.
Original file line number Diff line number Diff line change @@ -101,13 +101,6 @@ static void queue_stack_map_free(struct bpf_map *map)
101
101
{
102
102
struct bpf_queue_stack * qs = bpf_queue_stack (map );
103
103
104
- /* at this point bpf_prog->aux->refcnt == 0 and this map->refcnt == 0,
105
- * so the programs (can be more than one that used this map) were
106
- * disconnected from events. Wait for outstanding critical sections in
107
- * these programs to complete
108
- */
109
- synchronize_rcu ();
110
-
111
104
bpf_map_area_free (qs );
112
105
}
113
106
Original file line number Diff line number Diff line change @@ -96,8 +96,6 @@ static void reuseport_array_free(struct bpf_map *map)
96
96
struct sock * sk ;
97
97
u32 i ;
98
98
99
- synchronize_rcu ();
100
-
101
99
/*
102
100
* ops->map_*_elem() will not be able to access this
103
101
* array now. Hence, this function only races with
Original file line number Diff line number Diff line change @@ -215,13 +215,6 @@ static void ringbuf_map_free(struct bpf_map *map)
215
215
{
216
216
struct bpf_ringbuf_map * rb_map ;
217
217
218
- /* at this point bpf_prog->aux->refcnt == 0 and this map->refcnt == 0,
219
- * so the programs (can be more than one that used this map) were
220
- * disconnected from events. Wait for outstanding critical sections in
221
- * these programs to complete
222
- */
223
- synchronize_rcu ();
224
-
225
218
rb_map = container_of (map , struct bpf_ringbuf_map , map );
226
219
bpf_ringbuf_free (rb_map -> rb );
227
220
kfree (rb_map );
Original file line number Diff line number Diff line change @@ -604,9 +604,6 @@ static void stack_map_free(struct bpf_map *map)
604
604
{
605
605
struct bpf_stack_map * smap = container_of (map , struct bpf_stack_map , map );
606
606
607
- /* wait for bpf programs to complete before freeing stack map */
608
- synchronize_rcu ();
609
-
610
607
bpf_map_area_free (smap -> elems );
611
608
pcpu_freelist_destroy (& smap -> freelist );
612
609
bpf_map_area_free (smap );
You can’t perform that action at this time.
0 commit comments