diff mbox series

[05/14] bpf: Allow no charge in bpf_map_area_alloc

Message ID 20220319173036.23352-6-laoar.shao@gmail.com (mailing list archive)
State New
Headers show
Series bpf: Allow not to charge bpf memory | expand

Commit Message

Yafang Shao March 19, 2022, 5:30 p.m. UTC
Use the helper we introduced before to decide whether set the
__GFP_ACCOUNT or not.

Signed-off-by: Yafang Shao <laoar.shao@gmail.com>
---
 kernel/bpf/syscall.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/kernel/bpf/syscall.c b/kernel/bpf/syscall.c
index f70a7067ef4a..add3b4045b4d 100644
--- a/kernel/bpf/syscall.c
+++ b/kernel/bpf/syscall.c
@@ -307,7 +307,7 @@  static void *__bpf_map_area_alloc(u64 size, union bpf_attr *attr, bool mmapable)
 	 * __GFP_RETRY_MAYFAIL to avoid such situations.
 	 */
 
-	const gfp_t gfp = __GFP_NOWARN | __GFP_ZERO | __GFP_ACCOUNT;
+	const gfp_t gfp = map_flags_no_charge(__GFP_NOWARN | __GFP_ZERO, attr);
 	int numa_node = bpf_map_attr_numa_node(attr);
 	unsigned long align = 1;
 	unsigned int flags = 0;