mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
synced 2025-01-15 11:17:50 +00:00
bpf: Remove migrate_{disable|enable} in bpf_obj_free_fields()
The callers of bpf_obj_free_fields() have already guaranteed that the migration is disabled, therefore, there is no need to invoke migrate_{disable,enable} pair in bpf_obj_free_fields()'s underly implementation. This patch removes unnecessary migrate_{disable|enable} pairs from bpf_obj_free_fields() and its callees: bpf_list_head_free() and bpf_rb_root_free(). Signed-off-by: Hou Tao <houtao1@huawei.com> Link: https://lore.kernel.org/r/20250108010728.207536-12-houtao@huaweicloud.com Signed-off-by: Alexei Starovoitov <ast@kernel.org>
This commit is contained in:
parent
4b7e7cd1c1
commit
1d2dbe7120
@ -2066,9 +2066,7 @@ unlock:
|
|||||||
/* The contained type can also have resources, including a
|
/* The contained type can also have resources, including a
|
||||||
* bpf_list_head which needs to be freed.
|
* bpf_list_head which needs to be freed.
|
||||||
*/
|
*/
|
||||||
migrate_disable();
|
|
||||||
__bpf_obj_drop_impl(obj, field->graph_root.value_rec, false);
|
__bpf_obj_drop_impl(obj, field->graph_root.value_rec, false);
|
||||||
migrate_enable();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2105,9 +2103,7 @@ void bpf_rb_root_free(const struct btf_field *field, void *rb_root,
|
|||||||
obj -= field->graph_root.node_offset;
|
obj -= field->graph_root.node_offset;
|
||||||
|
|
||||||
|
|
||||||
migrate_disable();
|
|
||||||
__bpf_obj_drop_impl(obj, field->graph_root.value_rec, false);
|
__bpf_obj_drop_impl(obj, field->graph_root.value_rec, false);
|
||||||
migrate_enable();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -796,11 +796,9 @@ void bpf_obj_free_fields(const struct btf_record *rec, void *obj)
|
|||||||
if (!btf_is_kernel(field->kptr.btf)) {
|
if (!btf_is_kernel(field->kptr.btf)) {
|
||||||
pointee_struct_meta = btf_find_struct_meta(field->kptr.btf,
|
pointee_struct_meta = btf_find_struct_meta(field->kptr.btf,
|
||||||
field->kptr.btf_id);
|
field->kptr.btf_id);
|
||||||
migrate_disable();
|
|
||||||
__bpf_obj_drop_impl(xchgd_field, pointee_struct_meta ?
|
__bpf_obj_drop_impl(xchgd_field, pointee_struct_meta ?
|
||||||
pointee_struct_meta->record : NULL,
|
pointee_struct_meta->record : NULL,
|
||||||
fields[i].type == BPF_KPTR_PERCPU);
|
fields[i].type == BPF_KPTR_PERCPU);
|
||||||
migrate_enable();
|
|
||||||
} else {
|
} else {
|
||||||
field->kptr.dtor(xchgd_field);
|
field->kptr.dtor(xchgd_field);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user