-
Notifications
You must be signed in to change notification settings - Fork 151
Replace BPF memory allocator with kmalloc_nolock() in local storage #10285
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: bpf-next_base
Are you sure you want to change the base?
Conversation
|
Upstream branch: 93ce3be |
4752827 to
05f2f03
Compare
|
Upstream branch: c1da3df |
d629934 to
1bd3b3c
Compare
05f2f03 to
c343f72
Compare
|
Upstream branch: e5d2e34 |
1bd3b3c to
bcc816f
Compare
c343f72 to
6a32d09
Compare
|
Upstream branch: fea3f5e |
bcc816f to
b5a312a
Compare
6a32d09 to
b967d93
Compare
|
Upstream branch: 63066b7 |
b5a312a to
48cf085
Compare
b967d93 to
250c35a
Compare
|
Upstream branch: c133390 |
48cf085 to
6733d10
Compare
250c35a to
5630fb8
Compare
|
Upstream branch: ef2c0b2 |
6733d10 to
b6314d3
Compare
5630fb8 to
f815251
Compare
|
Upstream branch: a4d31f4 |
b6314d3 to
d88f47c
Compare
f815251 to
eb66b0c
Compare
|
Upstream branch: 4f7bc83 |
d88f47c to
96e8d2d
Compare
eb66b0c to
bfad2ee
Compare
|
Upstream branch: 6cc73f3 |
96e8d2d to
3505cd7
Compare
bfad2ee to
4a6b8b7
Compare
|
Upstream branch: 4722981 |
3505cd7 to
e3999ad
Compare
|
Upstream branch: 4722981 |
e3999ad to
0e600ce
Compare
|
Upstream branch: 4722981 |
0e600ce to
1075666
Compare
…elements Since commit a96a44a ("bpf: bpf_sk_storage: Fix invalid wait context lockdep report"), {charge,uncharge}_mem are always true when allocating a bpf_local_storage_elem or unlinking a bpf_local_storage_elem from local storage, so drop these arguments. No functional change. Signed-off-by: Amery Hung <[email protected]> Reviewed-by: Martin KaFai Lau <[email protected]>
Since selem already saves a pointer to smap, use it instead of an additional argument in bpf_selem_free(). This requires moving the SDATA(selem)->smap assignment from bpf_selem_link_map() to bpf_selem_alloc() since bpf_selem_free() may be called without the selem being linked to smap in bpf_local_storage_update(). Signed-off-by: Amery Hung <[email protected]> Reviewed-by: Martin KaFai Lau <[email protected]>
Save the memory allocation method used for bpf_local_storage in the struct explicitly so that we don't need to go through the hassle to find out the info. When a later patch replaces BPF memory allocator with kmalloc_noloc(), bpf_local_storage_free() will no longer need smap->storage_ma to return the memory and completely remove the dependency on smap in bpf_local_storage_free(). Signed-off-by: Amery Hung <[email protected]> Reviewed-by: Martin KaFai Lau <[email protected]>
|
Upstream branch: 4722981 |
Replace bpf memory allocator with kmalloc_nolock() to reduce memory wastage due to preallocation. In bpf_selem_free(), an selem now needs to wait for a RCU grace period before being freed when reuse_now == true. Therefore, rcu_barrier() should be always be called in bpf_local_storage_map_free(). In bpf_local_storage_free(), since smap->storage_ma is no longer needed to return the memory, the function is now independent from smap. Remove the outdated comment in bpf_local_storage_alloc(). We already free selem after an RCU grace period in bpf_local_storage_update() when bpf_local_storage_alloc() failed the cmpxchg since commit c0d63f3 ("bpf: Add bpf_selem_free()"). Signed-off-by: Amery Hung <[email protected]> Reviewed-by: Martin KaFai Lau <[email protected]>
1075666 to
5d82136
Compare
Pull request for series with
subject: Replace BPF memory allocator with kmalloc_nolock() in local storage
version: 2
url: https://patchwork.kernel.org/project/netdevbpf/list/?series=1023724