Commit 92af98c
committed
mm, bpf: Introduce free_pages_nolock()
JIRA: https://issues.redhat.com/browse/RHEL-78202
Conflicts:
- conlicts due to missing mm series "Allocate and free frozen pages"
resolved with reference to v6 of patch series
commit 8c57b68
Author: Alexei Starovoitov <ast@kernel.org>
Date: Fri Feb 21 18:44:24 2025 -0800
mm, bpf: Introduce free_pages_nolock()
Introduce free_pages_nolock() that can free pages without taking locks.
It relies on trylock and can be called from any context.
Since spin_trylock() cannot be used in PREEMPT_RT from hard IRQ or NMI
it uses lockless link list to stash the pages which will be freed
by subsequent free_pages() from good context.
Do not use llist unconditionally. BPF maps continuously
allocate/free, so we cannot unconditionally delay the freeing to
llist. When the memory becomes free make it available to the
kernel and BPF users right away if possible, and fallback to
llist as the last resort.
Acked-by: Vlastimil Babka <vbabka@suse.cz>
Acked-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Reviewed-by: Shakeel Butt <shakeel.butt@linux.dev>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Link: https://lore.kernel.org/r/20250222024427.30294-4-alexei.starovoitov@gmail.com
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Signed-off-by: Gregory Bell <grbell@redhat.com>1 parent dd0169f commit 92af98c
File tree
6 files changed
+100
-14
lines changed- include/linux
- lib
- mm
6 files changed
+100
-14
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
391 | 391 | | |
392 | 392 | | |
393 | 393 | | |
| 394 | + | |
394 | 395 | | |
395 | 396 | | |
396 | 397 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
99 | 99 | | |
100 | 100 | | |
101 | 101 | | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
102 | 106 | | |
103 | 107 | | |
104 | 108 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
982 | 982 | | |
983 | 983 | | |
984 | 984 | | |
| 985 | + | |
| 986 | + | |
| 987 | + | |
985 | 988 | | |
986 | 989 | | |
987 | 990 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
672 | 672 | | |
673 | 673 | | |
674 | 674 | | |
675 | | - | |
| 675 | + | |
| 676 | + | |
| 677 | + | |
| 678 | + | |
676 | 679 | | |
677 | 680 | | |
678 | 681 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
88 | 88 | | |
89 | 89 | | |
90 | 90 | | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
91 | 94 | | |
92 | 95 | | |
93 | 96 | | |
| |||
1245 | 1248 | | |
1246 | 1249 | | |
1247 | 1250 | | |
| 1251 | + | |
| 1252 | + | |
| 1253 | + | |
| 1254 | + | |
| 1255 | + | |
| 1256 | + | |
| 1257 | + | |
| 1258 | + | |
| 1259 | + | |
1248 | 1260 | | |
1249 | 1261 | | |
1250 | 1262 | | |
1251 | 1263 | | |
| 1264 | + | |
1252 | 1265 | | |
1253 | 1266 | | |
1254 | | - | |
| 1267 | + | |
| 1268 | + | |
| 1269 | + | |
| 1270 | + | |
| 1271 | + | |
| 1272 | + | |
| 1273 | + | |
| 1274 | + | |
| 1275 | + | |
| 1276 | + | |
| 1277 | + | |
| 1278 | + | |
| 1279 | + | |
| 1280 | + | |
| 1281 | + | |
| 1282 | + | |
| 1283 | + | |
| 1284 | + | |
| 1285 | + | |
| 1286 | + | |
| 1287 | + | |
| 1288 | + | |
1255 | 1289 | | |
1256 | 1290 | | |
1257 | 1291 | | |
| |||
2594 | 2628 | | |
2595 | 2629 | | |
2596 | 2630 | | |
2597 | | - | |
| 2631 | + | |
2598 | 2632 | | |
2599 | 2633 | | |
2600 | 2634 | | |
| |||
2629 | 2663 | | |
2630 | 2664 | | |
2631 | 2665 | | |
| 2666 | + | |
| 2667 | + | |
| 2668 | + | |
| 2669 | + | |
| 2670 | + | |
| 2671 | + | |
| 2672 | + | |
| 2673 | + | |
2632 | 2674 | | |
2633 | 2675 | | |
2634 | 2676 | | |
| |||
2643 | 2685 | | |
2644 | 2686 | | |
2645 | 2687 | | |
2646 | | - | |
| 2688 | + | |
| 2689 | + | |
2647 | 2690 | | |
2648 | 2691 | | |
2649 | 2692 | | |
| |||
2652 | 2695 | | |
2653 | 2696 | | |
2654 | 2697 | | |
2655 | | - | |
| 2698 | + | |
2656 | 2699 | | |
2657 | 2700 | | |
2658 | 2701 | | |
| |||
2669 | 2712 | | |
2670 | 2713 | | |
2671 | 2714 | | |
2672 | | - | |
| 2715 | + | |
2673 | 2716 | | |
2674 | 2717 | | |
2675 | 2718 | | |
2676 | 2719 | | |
2677 | 2720 | | |
2678 | 2721 | | |
| 2722 | + | |
| 2723 | + | |
| 2724 | + | |
| 2725 | + | |
| 2726 | + | |
2679 | 2727 | | |
2680 | 2728 | | |
2681 | 2729 | | |
2682 | | - | |
| 2730 | + | |
2683 | 2731 | | |
2684 | 2732 | | |
2685 | | - | |
| 2733 | + | |
2686 | 2734 | | |
2687 | 2735 | | |
2688 | 2736 | | |
2689 | 2737 | | |
| 2738 | + | |
| 2739 | + | |
| 2740 | + | |
| 2741 | + | |
| 2742 | + | |
2690 | 2743 | | |
2691 | 2744 | | |
2692 | 2745 | | |
| |||
2775 | 2828 | | |
2776 | 2829 | | |
2777 | 2830 | | |
2778 | | - | |
| 2831 | + | |
2779 | 2832 | | |
2780 | 2833 | | |
2781 | 2834 | | |
| |||
4820 | 4873 | | |
4821 | 4874 | | |
4822 | 4875 | | |
4823 | | - | |
| 4876 | + | |
4824 | 4877 | | |
4825 | 4878 | | |
| 4879 | + | |
4826 | 4880 | | |
4827 | 4881 | | |
4828 | 4882 | | |
| |||
4839 | 4893 | | |
4840 | 4894 | | |
4841 | 4895 | | |
4842 | | - | |
| 4896 | + | |
| 4897 | + | |
4843 | 4898 | | |
4844 | 4899 | | |
4845 | 4900 | | |
4846 | 4901 | | |
4847 | 4902 | | |
4848 | 4903 | | |
4849 | | - | |
| 4904 | + | |
4850 | 4905 | | |
4851 | 4906 | | |
4852 | 4907 | | |
4853 | | - | |
| 4908 | + | |
| 4909 | + | |
4854 | 4910 | | |
4855 | 4911 | | |
| 4912 | + | |
| 4913 | + | |
| 4914 | + | |
| 4915 | + | |
4856 | 4916 | | |
4857 | 4917 | | |
| 4918 | + | |
| 4919 | + | |
| 4920 | + | |
| 4921 | + | |
| 4922 | + | |
| 4923 | + | |
| 4924 | + | |
| 4925 | + | |
| 4926 | + | |
4858 | 4927 | | |
4859 | 4928 | | |
4860 | 4929 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
299 | 299 | | |
300 | 300 | | |
301 | 301 | | |
302 | | - | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
303 | 309 | | |
304 | 310 | | |
305 | 311 | | |
| |||
0 commit comments