Commit e7f1c0f
bpf: Generalize data copying for percpu maps
While adding support for the BPF_F_CPU and BPF_F_ALL_CPUS flags, the data
copying logic of the following percpu map types needs to be updated:
* percpu_array
* percpu_hash
* lru_percpu_hash
* percpu_cgroup_storage
Following Andrii’s suggestion[0], this patch refactors the data copying
logic by introducing two helpers:
* `bpf_percpu_copy_to_user()`
* `bpf_percpu_copy_from_user()`
This prepares the codebase for the upcoming CPU flag support.
[0] https://lore.kernel.org/bpf/[email protected]/
Suggested-by: Andrii Nakryiko <[email protected]>
Signed-off-by: Leon Hwang <[email protected]>1 parent c32e265 commit e7f1c0f
File tree
4 files changed
+39
-42
lines changed- include/linux
- kernel/bpf
4 files changed
+39
-42
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
547 | 547 | | |
548 | 548 | | |
549 | 549 | | |
| 550 | + | |
| 551 | + | |
| 552 | + | |
| 553 | + | |
| 554 | + | |
| 555 | + | |
| 556 | + | |
| 557 | + | |
| 558 | + | |
| 559 | + | |
| 560 | + | |
| 561 | + | |
| 562 | + | |
| 563 | + | |
| 564 | + | |
| 565 | + | |
| 566 | + | |
| 567 | + | |
| 568 | + | |
| 569 | + | |
| 570 | + | |
| 571 | + | |
| 572 | + | |
| 573 | + | |
| 574 | + | |
| 575 | + | |
| 576 | + | |
| 577 | + | |
550 | 578 | | |
551 | 579 | | |
552 | 580 | | |
| |||
2417 | 2445 | | |
2418 | 2446 | | |
2419 | 2447 | | |
2420 | | - | |
2421 | 2448 | | |
2422 | 2449 | | |
2423 | 2450 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
300 | 300 | | |
301 | 301 | | |
302 | 302 | | |
303 | | - | |
304 | 303 | | |
305 | 304 | | |
306 | 305 | | |
| |||
313 | 312 | | |
314 | 313 | | |
315 | 314 | | |
316 | | - | |
317 | | - | |
318 | | - | |
319 | | - | |
320 | | - | |
| 315 | + | |
321 | 316 | | |
322 | 317 | | |
323 | 318 | | |
| |||
387 | 382 | | |
388 | 383 | | |
389 | 384 | | |
390 | | - | |
391 | 385 | | |
392 | 386 | | |
393 | 387 | | |
| |||
411 | 405 | | |
412 | 406 | | |
413 | 407 | | |
414 | | - | |
415 | | - | |
416 | | - | |
417 | | - | |
418 | | - | |
| 408 | + | |
419 | 409 | | |
420 | 410 | | |
421 | 411 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
944 | 944 | | |
945 | 945 | | |
946 | 946 | | |
947 | | - | |
948 | 947 | | |
949 | | - | |
950 | | - | |
951 | | - | |
952 | | - | |
| 948 | + | |
953 | 949 | | |
954 | 950 | | |
955 | 951 | | |
| |||
1802 | 1798 | | |
1803 | 1799 | | |
1804 | 1800 | | |
1805 | | - | |
1806 | 1801 | | |
1807 | 1802 | | |
1808 | 1803 | | |
1809 | | - | |
1810 | | - | |
1811 | | - | |
1812 | | - | |
1813 | | - | |
| 1804 | + | |
1814 | 1805 | | |
1815 | 1806 | | |
1816 | 1807 | | |
| |||
2370 | 2361 | | |
2371 | 2362 | | |
2372 | 2363 | | |
2373 | | - | |
2374 | 2364 | | |
2375 | 2365 | | |
2376 | 2366 | | |
| |||
2386 | 2376 | | |
2387 | 2377 | | |
2388 | 2378 | | |
2389 | | - | |
2390 | | - | |
2391 | | - | |
2392 | | - | |
2393 | | - | |
| 2379 | + | |
2394 | 2380 | | |
2395 | 2381 | | |
2396 | 2382 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
184 | 184 | | |
185 | 185 | | |
186 | 186 | | |
187 | | - | |
| 187 | + | |
188 | 188 | | |
189 | 189 | | |
190 | 190 | | |
| |||
199 | 199 | | |
200 | 200 | | |
201 | 201 | | |
202 | | - | |
203 | | - | |
204 | | - | |
205 | | - | |
206 | | - | |
| 202 | + | |
| 203 | + | |
207 | 204 | | |
208 | 205 | | |
209 | 206 | | |
| |||
213 | 210 | | |
214 | 211 | | |
215 | 212 | | |
216 | | - | |
| 213 | + | |
217 | 214 | | |
218 | 215 | | |
219 | 216 | | |
| |||
233 | 230 | | |
234 | 231 | | |
235 | 232 | | |
236 | | - | |
237 | | - | |
238 | | - | |
239 | | - | |
240 | | - | |
| 233 | + | |
| 234 | + | |
241 | 235 | | |
242 | 236 | | |
243 | 237 | | |
| |||
0 commit comments