Skip to content

Commit 7b98435

Browse files
Hou TaoAlexei Starovoitov
authored andcommitted
bpf: Remove migrate_{disable|enable} from bpf_local_storage_free()
bpf_local_storage_free() has three callers: 1) bpf_local_storage_alloc() Its caller must have disabled migration. 2) bpf_local_storage_destroy() Its four callers (bpf_{cgrp|inode|task|sk}_storage_free()) have already invoked migrate_disable() before invoking bpf_local_storage_destroy(). 3) bpf_selem_unlink() Its callers include: cgrp/inode/task/sk storage ->map_delete_elem callbacks, bpf_{cgrp|inode|task|sk}_storage_delete() helpers and bpf_local_storage_map_free(). All of these callers have already disabled migration before invoking bpf_selem_unlink(). Therefore, it is OK to remove migrate_{disable|enable} pair from bpf_local_storage_free(). Signed-off-by: Hou Tao <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Alexei Starovoitov <[email protected]>
1 parent 4855a75 commit 7b98435

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

kernel/bpf/bpf_local_storage.c

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -172,17 +172,14 @@ static void bpf_local_storage_free(struct bpf_local_storage *local_storage,
172172
return;
173173
}
174174

175-
if (smap) {
176-
migrate_disable();
175+
if (smap)
177176
bpf_mem_cache_free(&smap->storage_ma, local_storage);
178-
migrate_enable();
179-
} else {
177+
else
180178
/* smap could be NULL if the selem that triggered
181179
* this 'local_storage' creation had been long gone.
182180
* In this case, directly do call_rcu().
183181
*/
184182
call_rcu(&local_storage->rcu, bpf_local_storage_free_rcu);
185-
}
186183
}
187184

188185
/* rcu tasks trace callback for bpf_ma == false */

0 commit comments

Comments
 (0)