[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20230613071756.GA359746@sumitra.com>
Date: Tue, 13 Jun 2023 00:17:56 -0700
From: Sumitra Sharma <sumitraartsy@...il.com>
To: Alexei Starovoitov <ast@...nel.org>,
Daniel Borkmann <daniel@...earbox.net>,
Andrii Nakryiko <andrii@...nel.org>,
Martin KaFai Lau <martin.lau@...ux.dev>,
Song Liu <song@...nel.org>, Yonghong Song <yhs@...com>,
John Fastabend <john.fastabend@...il.com>,
KP Singh <kpsingh@...nel.org>,
Stanislav Fomichev <sdf@...gle.com>,
Hao Luo <haoluo@...gle.com>, Jiri Olsa <jolsa@...nel.org>,
bpf@...r.kernel.org, linux-kernel@...r.kernel.org
Cc: Ira Weiny <ira.weiny@...el.com>, Fabio <fmdefrancesco@...il.com>,
Deepak R Varma <drv@...lo.com>
Subject: [PATCH v2] lib/test_bpf: Call page_address() on page acquired with
GFP_KERNEL flag
generate_test_data() acquires a page with alloc_page(GFP_KERNEL). Pages
allocated with GFP_KERNEL cannot come from Highmem. This is why
there is no need to call kmap() on them.
Therefore, use a plain page_address() on that page.
Suggested-by: Fabio M. De Francesco <fmdefrancesco@...il.com>
Signed-off-by: Sumitra Sharma <sumitraartsy@...il.com>
---
Changes in v2:
- Remove the kmap() call and call page_address() instead.
- Change the commit subject and message.
lib/test_bpf.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/lib/test_bpf.c b/lib/test_bpf.c
index ade9ac672adb..70fcd0bcf14b 100644
--- a/lib/test_bpf.c
+++ b/lib/test_bpf.c
@@ -14388,11 +14388,10 @@ static void *generate_test_data(struct bpf_test *test, int sub)
if (!page)
goto err_kfree_skb;
- ptr = kmap(page);
+ ptr = page_address(page);
if (!ptr)
goto err_free_page;
memcpy(ptr, test->frag_data, MAX_DATA);
- kunmap(page);
skb_add_rx_frag(skb, 0, page, 0, MAX_DATA, MAX_DATA);
}
--
2.25.1
Powered by blists - more mailing lists