Commit f2fa9b90 authored by Menglong Dong's avatar Menglong Dong Committed by Alexei Starovoitov
Browse files

bpf: use rcu_read_lock_dont_migrate() for bpf_inode_storage_free()



Use rcu_read_lock_dont_migrate() and rcu_read_unlock_migrate() in
bpf_inode_storage_free to obtain better performance when PREEMPT_RCU is
not enabled.

Signed-off-by: default avatarMenglong Dong <dongml2@chinatelecom.cn>
Link: https://lore.kernel.org/r/20250821090609.42508-4-dongml2@chinatelecom.cn


Signed-off-by: default avatarAlexei Starovoitov <ast@kernel.org>
parent 8c0afc7c
Loading
Loading
Loading
Loading
+2 −4
Original line number Diff line number Diff line
@@ -62,8 +62,7 @@ void bpf_inode_storage_free(struct inode *inode)
	if (!bsb)
		return;

	migrate_disable();
	rcu_read_lock();
	rcu_read_lock_dont_migrate();

	local_storage = rcu_dereference(bsb->storage);
	if (!local_storage)
@@ -71,8 +70,7 @@ void bpf_inode_storage_free(struct inode *inode)

	bpf_local_storage_destroy(local_storage);
out:
	rcu_read_unlock();
	migrate_enable();
	rcu_read_unlock_migrate();
}

static void *bpf_fd_inode_storage_lookup_elem(struct bpf_map *map, void *key)