Commit 4b7e7cd
bpf: Disable migration before calling ops->map_free()
The freeing of all map elements may invoke bpf_obj_free_fields() to free
the special fields in the map value. Since these special fields may be
allocated from bpf memory allocator, migrate_{disable|enable} pairs are
necessary for the freeing of these special fields.
To simplify reasoning about when migrate_disable() is needed for the
freeing of these special fields, let the caller to guarantee migration
is disabled before invoking bpf_obj_free_fields(). Therefore, disabling
migration before calling ops->map_free() to simplify the freeing of map
values or special fields allocated from bpf memory allocator.
After disabling migration in bpf_map_free(), there is no need for
additional migration_{disable|enable} pairs in these ->map_free()
callbacks. Remove these redundant invocations.
The migrate_{disable|enable} pairs in the underlying implementation of
bpf_obj_free_fields() will be removed by the following patch.
Signed-off-by: Hou Tao <houtao1@huawei.com>
Link: https://lore.kernel.org/r/20250108010728.207536-11-houtao@huaweicloud.com
Signed-off-by: Alexei Starovoitov <ast@kernel.org>1 parent 090d7f2 commit 4b7e7cd
4 files changed
Lines changed: 11 additions & 13 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
905 | 905 | | |
906 | 906 | | |
907 | 907 | | |
908 | | - | |
909 | | - | |
| 908 | + | |
910 | 909 | | |
911 | | - | |
912 | 910 | | |
913 | | - | |
| 911 | + | |
914 | 912 | | |
915 | | - | |
916 | | - | |
917 | 913 | | |
918 | 914 | | |
919 | 915 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1500 | 1500 | | |
1501 | 1501 | | |
1502 | 1502 | | |
1503 | | - | |
1504 | | - | |
| 1503 | + | |
| 1504 | + | |
1505 | 1505 | | |
1506 | | - | |
1507 | 1506 | | |
1508 | 1507 | | |
1509 | 1508 | | |
| |||
1515 | 1514 | | |
1516 | 1515 | | |
1517 | 1516 | | |
1518 | | - | |
1519 | 1517 | | |
1520 | 1518 | | |
1521 | 1519 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
259 | 259 | | |
260 | 260 | | |
261 | 261 | | |
262 | | - | |
263 | 262 | | |
264 | | - | |
265 | 263 | | |
266 | 264 | | |
267 | 265 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
835 | 835 | | |
836 | 836 | | |
837 | 837 | | |
838 | | - | |
| 838 | + | |
| 839 | + | |
| 840 | + | |
| 841 | + | |
| 842 | + | |
839 | 843 | | |
| 844 | + | |
| 845 | + | |
840 | 846 | | |
841 | 847 | | |
842 | 848 | | |
| |||
0 commit comments