From patchwork Tue Feb 20 21:03:38 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Toke_H=C3=B8iland-J=C3=B8rgensen?= X-Patchwork-Id: 13564504 X-Patchwork-Delegate: kuba@kernel.org Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E1448151CD6 for ; Tue, 20 Feb 2024 21:03:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708463030; cv=none; b=gSEGG4M27lmp5xmgaH3Y6OCdlPyU0Rq5uF8MKbTFJPnn5eyQKt92wQydlcc4CwIuOFWo35zTI33lmt1Tw8TDDJY0vQ5Ut2ISiqGfpdHGrDwB4imzP12plwMMwzsLO8C21aYyai9dX7SOET3QsSQe3k0QqrNmG/AC6zfMpeLNdRo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708463030; c=relaxed/simple; bh=yAN3xT8EUV0i2CJy6NqtWV8aa+YkCcxRteYAC+EhA2s=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=PSAZW/F5/8FJq0b6xadj3Z6ujNOI8UddC4R/HHlSpuj1iK8v11S9/18CIhDq5xs4i0z1VyOwFV1sVHhFZAoP8XGb2Ok5cogDLo4Ncd/ByeX5fwXTxZiwm4EIMh6JFI6AiQTHI/Ru0zMbL9U69VNja9EmdPCEu07CSsKaR4hV2j8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=DIcjLfbS; arc=none smtp.client-ip=170.10.129.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="DIcjLfbS" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1708463027; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=HblB1EygQYmfDjQn4iPYkDY89+D2ws9zXge3PbtSVKM=; b=DIcjLfbSG1JMpU5AJhrejhxUgLTbm3uIBEpPmEGYG1zcQVyhAZqYNQ/LDhBWBUYgLmPspK 2SgB/zBDj7Ev2XToJ3jQPOyrXWYoOACWGL34f2tGxIW+yRuBTVBJH584QVTmnnysWxzuRf /f4LxzUgkeB3iPXWlYUQOC+qvO/3mpA= Received: from mail-ej1-f69.google.com (mail-ej1-f69.google.com [209.85.218.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-203-xhnUeGppPW-aaQttQNKQXA-1; Tue, 20 Feb 2024 16:03:46 -0500 X-MC-Unique: xhnUeGppPW-aaQttQNKQXA-1 Received: by mail-ej1-f69.google.com with SMTP id a640c23a62f3a-a30f9374db7so706527866b.0 for ; Tue, 20 Feb 2024 13:03:46 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708463025; x=1709067825; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=HblB1EygQYmfDjQn4iPYkDY89+D2ws9zXge3PbtSVKM=; b=oSIhK/Js08bhP1Qg0ixpU8H8DfvFx/yBLMKMxiEWqZpw+ZSZn9yT3CE5JsY7fq/zSP STg8G2VLpVTNftJo5rW7on2ZZEJedAEHgve56Gg/iW4RadSrLq0wHTMSeY/Nbioy4Bha HmC2vuVk0BhchU+cGLiTuvYnctsVCI/1yrie8nNESPrqIG1CDBho1AxFEDgMcABR4Tdp yVm3pKfnxtDnUrF/gobKo+2leCMDW2hjJIhnNie6tQzUGnQpOFB4tVADBDUZjud+fKHK BDn/GYxANR9yAsqwu30WuVV4blsOoZhRYPG4/PEWlHwdJE+M86QbfC7QXC5gYTLgoal+ hT3g== X-Forwarded-Encrypted: i=1; AJvYcCVNbM4lxC7T+ASuZRXmK+IrDBOg3z1ycbYJMw9IDt+Xs99D66KzlePu3ksMei9vCqCIJr7ySDE3IiAndactBgFb5wjg X-Gm-Message-State: AOJu0Yzo5AA/GQYlzWfPURtLs3dA1SZ1E4F2H6H7CnKChWFFu4YsUFbC 0SWIx8dKGKciSW6gUZ4PHyQiuz74/+zP/r17PgjCKgUem/J8lSS/moEbIFJKx+WXBUjeHZ1Km+E i03JAe9B1tq0o4zqLIRC0Tk6oLif44R0uaTQ/ThDLq5t3D5JHtw== X-Received: by 2002:a17:906:55cb:b0:a3e:c1ef:e1bd with SMTP id z11-20020a17090655cb00b00a3ec1efe1bdmr5405404ejp.16.1708463025095; Tue, 20 Feb 2024 13:03:45 -0800 (PST) X-Google-Smtp-Source: AGHT+IHgY95QbMUU0W/c1OW5idiuPM81C8CWORiKLmjeUIN4cqSY7c62j8zMAVZY0yACe7u0MSZG+A== X-Received: by 2002:a17:906:55cb:b0:a3e:c1ef:e1bd with SMTP id z11-20020a17090655cb00b00a3ec1efe1bdmr5405384ejp.16.1708463024774; Tue, 20 Feb 2024 13:03:44 -0800 (PST) Received: from alrua-x1.borgediget.toke.dk ([2a0c:4d80:42:443::2]) by smtp.gmail.com with ESMTPSA id bk10-20020a170906b0ca00b00a3ca744438csm4296469ejb.213.2024.02.20.13.03.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 20 Feb 2024 13:03:44 -0800 (PST) Received: by alrua-x1.borgediget.toke.dk (Postfix, from userid 1000) id 1BC1710F63EE; Tue, 20 Feb 2024 22:03:44 +0100 (CET) From: =?utf-8?q?Toke_H=C3=B8iland-J=C3=B8rgensen?= To: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Alexei Starovoitov , Daniel Borkmann , Jesper Dangaard Brouer , John Fastabend Cc: =?utf-8?q?Toke_H=C3=B8iland-J=C3=B8rgensen?= , Alexander Lobakin , netdev@vger.kernel.org, bpf@vger.kernel.org Subject: [PATCH net-next v2 1/4] net: Register system page pool as an XDP memory model Date: Tue, 20 Feb 2024 22:03:38 +0100 Message-ID: <20240220210342.40267-2-toke@redhat.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240220210342.40267-1-toke@redhat.com> References: <20240220210342.40267-1-toke@redhat.com> Precedence: bulk X-Mailing-List: bpf@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: kuba@kernel.org To make the system page pool usable as a source for allocating XDP frames, we need to register it with xdp_reg_mem_model(), so that page return works correctly. This is done in preparation for using the system page pool for the XDP live frame mode in BPF_TEST_RUN; for the same reason, make the per-cpu variable non-static so we can access it from the test_run code as well. Reviewed-by: Alexander Lobakin Tested-by: Alexander Lobakin Signed-off-by: Toke Høiland-Jørgensen Acked-by: John Fastabend --- include/linux/netdevice.h | 1 + net/core/dev.c | 13 ++++++++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h index c541550b0e6e..e1dfdf0c4075 100644 --- a/include/linux/netdevice.h +++ b/include/linux/netdevice.h @@ -3345,6 +3345,7 @@ static inline void input_queue_tail_incr_save(struct softnet_data *sd, } DECLARE_PER_CPU_ALIGNED(struct softnet_data, softnet_data); +DECLARE_PER_CPU_ALIGNED(struct page_pool *, system_page_pool); static inline int dev_recursion_level(void) { diff --git a/net/core/dev.c b/net/core/dev.c index d8dd293a7a27..cdb916a647e7 100644 --- a/net/core/dev.c +++ b/net/core/dev.c @@ -428,7 +428,7 @@ EXPORT_PER_CPU_SYMBOL(softnet_data); * PP consumers must pay attention to run APIs in the appropriate context * (e.g. NAPI context). */ -static DEFINE_PER_CPU_ALIGNED(struct page_pool *, system_page_pool); +DEFINE_PER_CPU_ALIGNED(struct page_pool *, system_page_pool); #ifdef CONFIG_LOCKDEP /* @@ -11739,12 +11739,20 @@ static int net_page_pool_create(int cpuid) .pool_size = SYSTEM_PERCPU_PAGE_POOL_SIZE, .nid = NUMA_NO_NODE, }; + struct xdp_mem_info info; struct page_pool *pp_ptr; + int err; pp_ptr = page_pool_create_percpu(&page_pool_params, cpuid); if (IS_ERR(pp_ptr)) return -ENOMEM; + err = xdp_reg_mem_model(&info, MEM_TYPE_PAGE_POOL, pp_ptr); + if (err) { + page_pool_destroy(pp_ptr); + return err; + } + per_cpu(system_page_pool, cpuid) = pp_ptr; #endif return 0; @@ -11834,12 +11842,15 @@ static int __init net_dev_init(void) out: if (rc < 0) { for_each_possible_cpu(i) { + struct xdp_mem_info mem = { .type = MEM_TYPE_PAGE_POOL }; struct page_pool *pp_ptr; pp_ptr = per_cpu(system_page_pool, i); if (!pp_ptr) continue; + mem.id = pp_ptr->xdp_mem_id; + xdp_unreg_mem_model(&mem); page_pool_destroy(pp_ptr); per_cpu(system_page_pool, i) = NULL; } From patchwork Tue Feb 20 21:03:39 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Toke_H=C3=B8iland-J=C3=B8rgensen?= X-Patchwork-Id: 13564505 X-Patchwork-Delegate: kuba@kernel.org Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6FA2A1509BF for ; Tue, 20 Feb 2024 21:03:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708463032; cv=none; b=qRABumwNNjiNvHQ4KTRsHX+H8Jtiptzm17ZEya4nu6KvnE0KVZxTy4sYBEIhve9hg0kEy/fBsTgH44aTSgqn84KD2ZgV84RfkPdwMRNsir7+KxzX4awu35a2rrytm2nvme8WVprLIXeoF6sx3nnu831vLEsaHIxwGRSjO8MBAi0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708463032; c=relaxed/simple; bh=P3lQyQl3bve1l4f9P7FJvQV2eroGrIINQyrszok7P0I=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=KKarm2+imYnYQ4L2kd6/8GfrScbFa7vOxtchOxSq94VqYP6oQbG++gtp8+NdiYk9W3vrMuK3kAS8V/ZWof81OHt6ykjdS5OMOL1DqsC6GZaXF2x0cGbTVXYrh2O7PztSpIjbbKO/u6XMi1Qs0z8bTdUKe+SYg6wmUgKvaCNNcek= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=LflfPfZ+; arc=none smtp.client-ip=170.10.129.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="LflfPfZ+" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1708463028; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=dgCPVU+0psdI5oLLYSqcZYchXb0tfPs0jfrrPe41TrY=; b=LflfPfZ+1lWYWe9Wtyt9dTsaK6P3hrWeSZcOQd7BEpADYyKFAV7rzw4GL4T09zOvAyv0ef TmT8TJ4OuPf0c1zZutb8g6/QEhnIVhqjlLH5ZhUmGZHYDxBWT/Y/bfFc0/cKG87s7HAiKr c2MXSv2X3wOB8zeXi8Pb+cJ0HCAqAk8= Received: from mail-ej1-f70.google.com (mail-ej1-f70.google.com [209.85.218.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-37-AIbP5jAuMxiR_nfQPHrbKA-1; Tue, 20 Feb 2024 16:03:46 -0500 X-MC-Unique: AIbP5jAuMxiR_nfQPHrbKA-1 Received: by mail-ej1-f70.google.com with SMTP id a640c23a62f3a-a3ee0277419so100857866b.0 for ; Tue, 20 Feb 2024 13:03:46 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708463025; x=1709067825; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=dgCPVU+0psdI5oLLYSqcZYchXb0tfPs0jfrrPe41TrY=; b=np8q9E3HrqNlQ8OtLl+QI4QSxZNnFDsejSjaCthWJgnLWar7il8S0L97m/ejuqSiPk XOTAQz6CluYGsjyXbFE5BU9UUFUSeeCqyWYeINHvdYZJN04KgHSBLOU1JnqV/7Kda6zq 96OUWJ6kk8Iqcg+fULH9onYXiaA/7lwBVmWgDKAj6w2F+B3TgsyK7nIeEO5hum6OGkhg eDBUTajivt9mPcKU8gdAssSDKBWxyabfvrcrx8+tqlSjzdCRtDfQH1iKnPn9OTvom+h3 Bapy87daa/jek+H6UZFSk14c4sSCkqwvFJxf+RZORRcSog/w+WlhiO1gxNCb08mtaASH iP9A== X-Forwarded-Encrypted: i=1; AJvYcCWLpVr2V3P0yvoM6k0yDwIkBQREj46ZuZQcGX0SBpv/Sefx7ZJM1AMlm1Pt4Tpkr+i7al2tjNX0N0rUVP9rcMaVqemG X-Gm-Message-State: AOJu0YzWWXWrN8NajYFHoOnqJu/cdybTHMJbDBJVGdeRHyWiAvuMg7rl 2N8sAHjIJk0IBsXCmPSVEM+CisK41Q2F8oBw/J6uY709dzh9/vMdpJFGRgHrcBYXLddiE8tkY5z GYjtuypDYH81zoTf8HNs5srLSXalTVtNguwCLemX6iJOJacehQg== X-Received: by 2002:a17:906:110b:b0:a3e:eebe:7a2f with SMTP id h11-20020a170906110b00b00a3eeebe7a2fmr3643362eja.35.1708463025292; Tue, 20 Feb 2024 13:03:45 -0800 (PST) X-Google-Smtp-Source: AGHT+IGi+XGbiszdZJ0fYKD0cy+qa6OEomzzyHwaSSx7pVSfj9PYfF8OEwPEStcrrogiUj74hSzH9w== X-Received: by 2002:a17:906:110b:b0:a3e:eebe:7a2f with SMTP id h11-20020a170906110b00b00a3eeebe7a2fmr3643347eja.35.1708463025069; Tue, 20 Feb 2024 13:03:45 -0800 (PST) Received: from alrua-x1.borgediget.toke.dk ([45.145.92.2]) by smtp.gmail.com with ESMTPSA id tb5-20020a1709078b8500b00a3d599f47c2sm4343596ejc.18.2024.02.20.13.03.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 20 Feb 2024 13:03:44 -0800 (PST) Received: by alrua-x1.borgediget.toke.dk (Postfix, from userid 1000) id 75F0610F63F0; Tue, 20 Feb 2024 22:03:44 +0100 (CET) From: =?utf-8?q?Toke_H=C3=B8iland-J=C3=B8rgensen?= To: Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , Martin KaFai Lau , Eduard Zingerman , Song Liu , Yonghong Song , John Fastabend , KP Singh , Stanislav Fomichev , Hao Luo , Jiri Olsa , "David S. Miller" , Jakub Kicinski , Jesper Dangaard Brouer Cc: =?utf-8?q?Toke_H=C3=B8iland-J=C3=B8rgensen?= , Alexander Lobakin , Eric Dumazet , Paolo Abeni , bpf@vger.kernel.org, netdev@vger.kernel.org Subject: [PATCH net-next v2 2/4] bpf: test_run: Use system page pool for XDP live frame mode Date: Tue, 20 Feb 2024 22:03:39 +0100 Message-ID: <20240220210342.40267-3-toke@redhat.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240220210342.40267-1-toke@redhat.com> References: <20240220210342.40267-1-toke@redhat.com> Precedence: bulk X-Mailing-List: bpf@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: kuba@kernel.org The BPF_TEST_RUN code in XDP live frame mode creates a new page pool each time it is called and uses that to allocate the frames used for the XDP run. This works well if the syscall is used with a high repetitions number, as it allows for efficient page recycling. However, if used with a small number of repetitions, the overhead of creating and tearing down the page pool is significant, and can even lead to system stalls if the syscall is called in a tight loop. Now that we have a persistent system page pool instance, it becomes pretty straight forward to change the test_run code to use it. The only wrinkle is that we can no longer rely on a custom page init callback from page_pool itself; instead, we change the test_run code to write a random cookie value to the beginning of the page as an indicator that the page has been initialised and can be re-used without copying the initial data again. The cookie is a random 128-bit value, which means the probability that we will get accidental collisions (which would lead to recycling the wrong page values and reading garbage) is on the order of 2^-128. This is in the "won't happen before the heat death of the universe" range, so this marking is safe for the intended usage. Reviewed-by: Alexander Lobakin Tested-by: Alexander Lobakin Signed-off-by: Toke Høiland-Jørgensen --- net/bpf/test_run.c | 139 +++++++++++++++++++++++---------------------- 1 file changed, 71 insertions(+), 68 deletions(-) diff --git a/net/bpf/test_run.c b/net/bpf/test_run.c index dfd919374017..60a36a4df3e1 100644 --- a/net/bpf/test_run.c +++ b/net/bpf/test_run.c @@ -94,10 +94,19 @@ static bool bpf_test_timer_continue(struct bpf_test_timer *t, int iterations, } /* We put this struct at the head of each page with a context and frame - * initialised when the page is allocated, so we don't have to do this on each - * repetition of the test run. + * initialised the first time a given page is used, saving the memcpy() of the + * data on subsequent repetition of the test run. The cookie value is used to + * mark the page data the first time we initialise it so we can skip it the next + * time we see that page. */ + +struct xdp_page_cookie { + u64 val1; + u64 val2; +}; + struct xdp_page_head { + struct xdp_page_cookie cookie; struct xdp_buff orig_ctx; struct xdp_buff ctx; union { @@ -111,10 +120,9 @@ struct xdp_test_data { struct xdp_buff *orig_ctx; struct xdp_rxq_info rxq; struct net_device *dev; - struct page_pool *pp; struct xdp_frame **frames; struct sk_buff **skbs; - struct xdp_mem_info mem; + struct xdp_page_cookie cookie; u32 batch_size; u32 frame_cnt; }; @@ -126,48 +134,9 @@ struct xdp_test_data { #define TEST_XDP_FRAME_SIZE (PAGE_SIZE - sizeof(struct xdp_page_head)) #define TEST_XDP_MAX_BATCH 256 -static void xdp_test_run_init_page(struct page *page, void *arg) -{ - struct xdp_page_head *head = phys_to_virt(page_to_phys(page)); - struct xdp_buff *new_ctx, *orig_ctx; - u32 headroom = XDP_PACKET_HEADROOM; - struct xdp_test_data *xdp = arg; - size_t frm_len, meta_len; - struct xdp_frame *frm; - void *data; - - orig_ctx = xdp->orig_ctx; - frm_len = orig_ctx->data_end - orig_ctx->data_meta; - meta_len = orig_ctx->data - orig_ctx->data_meta; - headroom -= meta_len; - - new_ctx = &head->ctx; - frm = head->frame; - data = head->data; - memcpy(data + headroom, orig_ctx->data_meta, frm_len); - - xdp_init_buff(new_ctx, TEST_XDP_FRAME_SIZE, &xdp->rxq); - xdp_prepare_buff(new_ctx, data, headroom, frm_len, true); - new_ctx->data = new_ctx->data_meta + meta_len; - - xdp_update_frame_from_buff(new_ctx, frm); - frm->mem = new_ctx->rxq->mem; - - memcpy(&head->orig_ctx, new_ctx, sizeof(head->orig_ctx)); -} - static int xdp_test_run_setup(struct xdp_test_data *xdp, struct xdp_buff *orig_ctx) { - struct page_pool *pp; int err = -ENOMEM; - struct page_pool_params pp_params = { - .order = 0, - .flags = 0, - .pool_size = xdp->batch_size, - .nid = NUMA_NO_NODE, - .init_callback = xdp_test_run_init_page, - .init_arg = xdp, - }; xdp->frames = kvmalloc_array(xdp->batch_size, sizeof(void *), GFP_KERNEL); if (!xdp->frames) @@ -177,34 +146,21 @@ static int xdp_test_run_setup(struct xdp_test_data *xdp, struct xdp_buff *orig_c if (!xdp->skbs) goto err_skbs; - pp = page_pool_create(&pp_params); - if (IS_ERR(pp)) { - err = PTR_ERR(pp); - goto err_pp; - } - - /* will copy 'mem.id' into pp->xdp_mem_id */ - err = xdp_reg_mem_model(&xdp->mem, MEM_TYPE_PAGE_POOL, pp); - if (err) - goto err_mmodel; - - xdp->pp = pp; - /* We create a 'fake' RXQ referencing the original dev, but with an * xdp_mem_info pointing to our page_pool */ xdp_rxq_info_reg(&xdp->rxq, orig_ctx->rxq->dev, 0, 0); - xdp->rxq.mem.type = MEM_TYPE_PAGE_POOL; - xdp->rxq.mem.id = pp->xdp_mem_id; + xdp->rxq.mem.type = MEM_TYPE_PAGE_POOL; /* mem id is set per-frame below */ xdp->dev = orig_ctx->rxq->dev; xdp->orig_ctx = orig_ctx; + /* We need a random cookie for each run as pages can stick around + * between runs in the system page pool + */ + get_random_bytes(&xdp->cookie, sizeof(xdp->cookie)); + return 0; -err_mmodel: - page_pool_destroy(pp); -err_pp: - kvfree(xdp->skbs); err_skbs: kvfree(xdp->frames); return err; @@ -212,8 +168,6 @@ static int xdp_test_run_setup(struct xdp_test_data *xdp, struct xdp_buff *orig_c static void xdp_test_run_teardown(struct xdp_test_data *xdp) { - xdp_unreg_mem_model(&xdp->mem); - page_pool_destroy(xdp->pp); kfree(xdp->frames); kfree(xdp->skbs); } @@ -235,8 +189,12 @@ static bool ctx_was_changed(struct xdp_page_head *head) head->orig_ctx.data_end != head->ctx.data_end; } -static void reset_ctx(struct xdp_page_head *head) +static void reset_ctx(struct xdp_page_head *head, struct xdp_test_data *xdp) { + /* mem id can change if we migrate CPUs between batches */ + if (head->frame->mem.id != xdp->rxq.mem.id) + head->frame->mem.id = xdp->rxq.mem.id; + if (likely(!frame_was_changed(head) && !ctx_was_changed(head))) return; @@ -246,6 +204,48 @@ static void reset_ctx(struct xdp_page_head *head) xdp_update_frame_from_buff(&head->ctx, head->frame); } +static struct xdp_page_head * +xdp_test_run_init_page(struct page *page, struct xdp_test_data *xdp) +{ + struct xdp_page_head *head = phys_to_virt(page_to_phys(page)); + struct xdp_buff *new_ctx, *orig_ctx; + u32 headroom = XDP_PACKET_HEADROOM; + size_t frm_len, meta_len; + struct xdp_frame *frm; + void *data; + + /* Optimise for the recycle case, which is the normal case when doing + * high-repetition REDIRECTS to drivers that return frames. + */ + if (likely(!memcmp(&head->cookie, &xdp->cookie, sizeof(head->cookie)))) { + reset_ctx(head, xdp); + return head; + } + + head->cookie = xdp->cookie; + + orig_ctx = xdp->orig_ctx; + frm_len = orig_ctx->data_end - orig_ctx->data_meta; + meta_len = orig_ctx->data - orig_ctx->data_meta; + headroom -= meta_len; + + new_ctx = &head->ctx; + frm = head->frame; + data = head->data; + memcpy(data + headroom, orig_ctx->data_meta, frm_len); + + xdp_init_buff(new_ctx, TEST_XDP_FRAME_SIZE, &xdp->rxq); + xdp_prepare_buff(new_ctx, data, headroom, frm_len, true); + new_ctx->data = new_ctx->data_meta + meta_len; + + xdp_update_frame_from_buff(new_ctx, frm); + frm->mem = new_ctx->rxq->mem; + + memcpy(&head->orig_ctx, new_ctx, sizeof(head->orig_ctx)); + + return head; +} + static int xdp_recv_frames(struct xdp_frame **frames, int nframes, struct sk_buff **skbs, struct net_device *dev) @@ -287,6 +287,7 @@ static int xdp_test_run_batch(struct xdp_test_data *xdp, struct bpf_prog *prog, struct xdp_page_head *head; struct xdp_frame *frm; bool redirect = false; + struct page_pool *pp; struct xdp_buff *ctx; struct page *page; @@ -295,15 +296,17 @@ static int xdp_test_run_batch(struct xdp_test_data *xdp, struct bpf_prog *prog, local_bh_disable(); xdp_set_return_frame_no_direct(); + pp = this_cpu_read(system_page_pool); + xdp->rxq.mem.id = pp->xdp_mem_id; + for (i = 0; i < batch_sz; i++) { - page = page_pool_dev_alloc_pages(xdp->pp); + page = page_pool_dev_alloc_pages(pp); if (!page) { err = -ENOMEM; goto out; } - head = phys_to_virt(page_to_phys(page)); - reset_ctx(head); + head = xdp_test_run_init_page(page, xdp); ctx = &head->ctx; frm = head->frame; xdp->frame_cnt++; From patchwork Tue Feb 20 21:03:40 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Toke_H=C3=B8iland-J=C3=B8rgensen?= X-Patchwork-Id: 13564506 X-Patchwork-Delegate: kuba@kernel.org Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 641D0152DE3 for ; Tue, 20 Feb 2024 21:03:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708463034; cv=none; b=qR600mujJ+Yh7FjbG4nF5HZcr0Vjz1dUjNIGDMUySbCaUo3lLspOHp5dUTcF1jMMtlTGftm8e0M3Eq2uIgTB4eyQ/ytJzbtQO3opIWvGfquzzcW6bPl1VB6Zlq2s+B8koOOl2VUYwC9YdeUbCgEqFUmZDseVbRIzR0FlMBe5D8E= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708463034; c=relaxed/simple; bh=cipXQlNv4sse2Ziln+P6/irhO5BInmuCXm1MSqxh1+Q=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=Btfsx3ll/bgWLhptoxOLLC3iCt1UcTCyTCOEajlK0JSXINcly2TOlWGk1X9Lhhix6DEXrSbow6X4RM5WeyjDvBxjfiWiMKO+iDP7XNLrclEiFccGCndfY/H0hcFoIxmfqLvcQnKRBoy88HECbCmgQFL+zQUyOlhJZw2+NRvMmHw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=KeI1XX9s; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="KeI1XX9s" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1708463031; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=K3QkuKLxJ76L/BrinDXWxNFTbgD97NGShDyQ2eneyZQ=; b=KeI1XX9sQQKyyH+2q20YK2zJfAa4mSfoZAxUisfIyc48+MK+S+2X4OGPWN0/vp8I7J7m5g dmQtOmgwDKi3sIPJIpEUiSa0HySky/UwkhbjCi1sH0Hp2ykoGqF5vYaCJ/8eR4b0DY69/Y 8VkXjgacubi1J05kY6u6qd5UAcD0cw0= Received: from mail-lj1-f199.google.com (mail-lj1-f199.google.com [209.85.208.199]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-302-G1CW_fZCNvmsclO3eqbzrQ-1; Tue, 20 Feb 2024 16:03:49 -0500 X-MC-Unique: G1CW_fZCNvmsclO3eqbzrQ-1 Received: by mail-lj1-f199.google.com with SMTP id 38308e7fff4ca-2d240155a45so20982421fa.0 for ; Tue, 20 Feb 2024 13:03:49 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708463028; x=1709067828; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=K3QkuKLxJ76L/BrinDXWxNFTbgD97NGShDyQ2eneyZQ=; b=MbCTI/gHgijllgl8lsSMSBsgdORodfAOs2AXYMN1ezTLe59DhH91LzI63WcXd0Thwh rjJy3/RARa/w8ucOfFA+q6XtC8NIhEtilE6fBMFz8X8tQcvYAp/raypI3OYYF48u6AG1 1vM2gIbGNLsKNJXv9KAXdmBuV8Q1JmjEsETzIDePsSpg+E9jjUUWonldPKy3VJlgqi0E U8twliD9dKEcOuQNSZWesAuSE6ts1Suj1QiFvbBUSt5p09RAkONAQ96mNYW7V5qqxmLg pmp8TUkTg9PvksJDIBLS3jDljcfnEFim9WEGsm1rxO8WrviQheP2/QRrawJB9/2WpZW1 CX9w== X-Forwarded-Encrypted: i=1; AJvYcCWvf+QRG+uolF15xdm13AvuccCWlIaAFV2XCkFmLGd3f2we1UT35EqKEw23/9pap9HQlJq8WSUcLT5zqIbh5prefGpN X-Gm-Message-State: AOJu0Ywzb3LaV7rpQ/IS/ci+At4gwTPqXKtF8cOkYgh31tyQCuBhHiA5 gP2ud1f/qlP2+GgRLPNfq+jokLrNbi/DTZpAWiCRZ/yFi2SaJ5XXfrF2JvoF3DqDIpiCr5muqMa QjpH8xdJW2XsbZRHErnayskmblIRVYzumAq0762Ht4n4/5MFMlA== X-Received: by 2002:a2e:7c0a:0:b0:2d2:524c:a535 with SMTP id x10-20020a2e7c0a000000b002d2524ca535mr336221ljc.16.1708463028430; Tue, 20 Feb 2024 13:03:48 -0800 (PST) X-Google-Smtp-Source: AGHT+IG60dxeq25alXiX4VbMN5JGwluPEpaR/RAtCHUW/qILAHLufLZZ8FTovybFEsqHlSTgo+I9iA== X-Received: by 2002:a2e:7c0a:0:b0:2d2:524c:a535 with SMTP id x10-20020a2e7c0a000000b002d2524ca535mr336215ljc.16.1708463028196; Tue, 20 Feb 2024 13:03:48 -0800 (PST) Received: from alrua-x1.borgediget.toke.dk ([45.145.92.2]) by smtp.gmail.com with ESMTPSA id x17-20020aa7cd91000000b005649df0654asm1672575edv.21.2024.02.20.13.03.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 20 Feb 2024 13:03:45 -0800 (PST) Received: by alrua-x1.borgediget.toke.dk (Postfix, from userid 1000) id B6CAD10F63F2; Tue, 20 Feb 2024 22:03:44 +0100 (CET) From: =?utf-8?q?Toke_H=C3=B8iland-J=C3=B8rgensen?= To: Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , Martin KaFai Lau , Eduard Zingerman , Song Liu , Yonghong Song , John Fastabend , KP Singh , Stanislav Fomichev , Hao Luo , Jiri Olsa , "David S. Miller" , Jakub Kicinski , Jesper Dangaard Brouer Cc: =?utf-8?q?Toke_H=C3=B8iland-J=C3=B8rgensen?= , Alexander Lobakin , Eric Dumazet , Paolo Abeni , bpf@vger.kernel.org, netdev@vger.kernel.org Subject: [PATCH net-next v2 3/4] bpf: test_run: Fix cacheline alignment of live XDP frame data structures Date: Tue, 20 Feb 2024 22:03:40 +0100 Message-ID: <20240220210342.40267-4-toke@redhat.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240220210342.40267-1-toke@redhat.com> References: <20240220210342.40267-1-toke@redhat.com> Precedence: bulk X-Mailing-List: bpf@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: kuba@kernel.org The live XDP frame code in BPF_PROG_RUN suffered from suboptimal cache line placement due to the forced cache line alignment of struct xdp_rxq_info. Rearrange things so we don't waste a whole cache line on padding, and also add explicit alignment to the data_hard_start field in the start-of-page data structure we use for the data pages. Reviewed-by: Alexander Lobakin Tested-by: Alexander Lobakin Signed-off-by: Toke Høiland-Jørgensen --- net/bpf/test_run.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/net/bpf/test_run.c b/net/bpf/test_run.c index 60a36a4df3e1..485084c302b2 100644 --- a/net/bpf/test_run.c +++ b/net/bpf/test_run.c @@ -113,12 +113,12 @@ struct xdp_page_head { /* ::data_hard_start starts here */ DECLARE_FLEX_ARRAY(struct xdp_frame, frame); DECLARE_FLEX_ARRAY(u8, data); - }; + } ____cacheline_aligned; }; struct xdp_test_data { - struct xdp_buff *orig_ctx; struct xdp_rxq_info rxq; + struct xdp_buff *orig_ctx; struct net_device *dev; struct xdp_frame **frames; struct sk_buff **skbs; From patchwork Tue Feb 20 21:03:41 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Toke_H=C3=B8iland-J=C3=B8rgensen?= X-Patchwork-Id: 13564507 X-Patchwork-Delegate: kuba@kernel.org Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6F19B152DF9 for ; Tue, 20 Feb 2024 21:03:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708463037; cv=none; b=JRWktyjMvU4U65WBK5d4YKbdNEjtt8DefUAA7PyQV7z4mghwa0nkWWKIInYhc2ybe0nLZ2LvTZPCVLGN0y9ZyJ6DrhDNktNvD0fJ0AC7Kr84zqMtTqDePRUrCOdUObgFpfmH3m17oV6Q0DbjII7QozmSH2CKAQw0cvHpwqiHb90= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708463037; c=relaxed/simple; bh=yFzbobEZz1Ejk+C4hN4SD4uxZslKPofrmu/6I7dSQg4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=HKTHLOSjaOpIQo/YIzOL4lMcTGtZ6CiiIam9XYVymzc+UwPElaNKBjmhV0i7rfm9fgFwS81UtFER3yQRxzRyoaME7Ud5+FecVjpjyxwPp76aQ9WAOWg+ZtIuSzs0yF0xLwrRpN21nidpMeMKZOYLoOsI0MYD9GjKOJp1fPjxPTw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=ULk+RhD7; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="ULk+RhD7" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1708463031; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=9Cx1B6cH8M4WwsZid+9jIkWUL8B6BHRlRdPrxUHWq74=; b=ULk+RhD7OCsoEmArRML5uzqjsMXbjZuZq+IdvH7er7QtYxFwgnJDrFJsOkNoHdXszx0ARC maKq/aXnH3xzmNM/1hiQgNsYZpU/aBxZK7J9epWkckJtp3ptjtKpwcuOS2uMKcmUrH6dUy 3ybaVDA2Yyjq/sRVQVWcGGQH4J+gKEo= Received: from mail-ed1-f69.google.com (mail-ed1-f69.google.com [209.85.208.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-652-gP-_dnYWMwuwxQudGsc6CQ-1; Tue, 20 Feb 2024 16:03:49 -0500 X-MC-Unique: gP-_dnYWMwuwxQudGsc6CQ-1 Received: by mail-ed1-f69.google.com with SMTP id 4fb4d7f45d1cf-564902d757bso1377408a12.1 for ; Tue, 20 Feb 2024 13:03:49 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708463028; x=1709067828; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=9Cx1B6cH8M4WwsZid+9jIkWUL8B6BHRlRdPrxUHWq74=; b=OPpTp4qLypVOQKfRSCefTa0LpxiuDPMH5cCzjYKFp6bYvvsVa86SyxK35BUrOCgCcb YMR0wSdmcRsx8B0UxW9CK788rLM/sTXTQIlhN0HFFZWrDTHmzeBVCEy8lKbnAel0IEd+ FeGVD6xLN7ZVKGw30BQqYbyFWB47FsxFQWl89saID34BCRV6TS4wSLf1L1ub6LEgONJ+ a34W5PcvAU3GXVNP/QbCeeeFBQBaY5LbRIm+1GN8U5+XBS6Ko2zTGki6kKYSfpbjp7Tf K1ynoK964rr3WVQGuZZdrV64EVEtBlcx646g6l7zNtrryfEB0cM6+lS5F/q69/eIQ6gB e1UQ== X-Forwarded-Encrypted: i=1; AJvYcCXde2/Gv0iCUj7bz0PsPgvBQeuPxBLTdDwW0GtuRIvGLPoe3j0dvtv3tP3z3s+Gm+xE+z7oqueKuzNcx4IZQPra7ZsBsJK/ X-Gm-Message-State: AOJu0YxiAAtUIMOPCnj/gnHFSEMkV6zFjjQ0LGjL91ro+5EFTi07JF7x eRnmGBYVpQpYqOWI41f5emSD87LhMhBFr5/twluVoVRFG+K2PAHTsf/Lim1tuXUUufzSBUQZWtg 51qZ3QdAUdiKBM3zXGnMgzAUvU/egobw79r8t0GTplEvxj522IZ3CRw== X-Received: by 2002:a05:6402:1801:b0:564:7007:e14c with SMTP id g1-20020a056402180100b005647007e14cmr5349840edy.22.1708463028748; Tue, 20 Feb 2024 13:03:48 -0800 (PST) X-Google-Smtp-Source: AGHT+IF5BIwE4aBq1el+YWIDllK4swwpI2BtcI/vhibgBqxmx+4xoGKaTodyN0sy/hQFFO/BQtXUDA== X-Received: by 2002:a05:6402:1801:b0:564:7007:e14c with SMTP id g1-20020a056402180100b005647007e14cmr5349836edy.22.1708463028551; Tue, 20 Feb 2024 13:03:48 -0800 (PST) Received: from alrua-x1.borgediget.toke.dk ([45.145.92.2]) by smtp.gmail.com with ESMTPSA id ew14-20020a056402538e00b005602346c3f5sm3983025edb.79.2024.02.20.13.03.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 20 Feb 2024 13:03:48 -0800 (PST) Received: by alrua-x1.borgediget.toke.dk (Postfix, from userid 1000) id 1F90210F63F4; Tue, 20 Feb 2024 22:03:45 +0100 (CET) From: =?utf-8?q?Toke_H=C3=B8iland-J=C3=B8rgensen?= To: Jesper Dangaard Brouer , Ilias Apalodimas Cc: =?utf-8?q?Toke_H=C3=B8iland-J=C3=B8rgensen?= , Alexander Lobakin , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , netdev@vger.kernel.org Subject: [PATCH net-next v2 4/4] page pool: Remove init_callback parameter Date: Tue, 20 Feb 2024 22:03:41 +0100 Message-ID: <20240220210342.40267-5-toke@redhat.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240220210342.40267-1-toke@redhat.com> References: <20240220210342.40267-1-toke@redhat.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: kuba@kernel.org The only user of the init_callback parameter to page pool was the BPF_TEST_RUN code. Since that has now been moved to use a different scheme, we can get rid of the init callback entirely. Suggested-by: Alexander Lobakin Signed-off-by: Toke Høiland-Jørgensen Reviewed-by: Ilias Apalodimas --- include/net/page_pool/types.h | 4 ---- net/core/page_pool.c | 4 ---- 2 files changed, 8 deletions(-) diff --git a/include/net/page_pool/types.h b/include/net/page_pool/types.h index 3828396ae60c..2f5975ab2cd0 100644 --- a/include/net/page_pool/types.h +++ b/include/net/page_pool/types.h @@ -69,9 +69,6 @@ struct page_pool_params { ); struct_group_tagged(page_pool_params_slow, slow, struct net_device *netdev; -/* private: used by test code only */ - void (*init_callback)(struct page *page, void *arg); - void *init_arg; ); }; @@ -129,7 +126,6 @@ struct page_pool { struct page_pool_params_fast p; int cpuid; - bool has_init_callback; long frag_users; struct page *frag_page; diff --git a/net/core/page_pool.c b/net/core/page_pool.c index 89c835fcf094..fd054b6f773a 100644 --- a/net/core/page_pool.c +++ b/net/core/page_pool.c @@ -217,8 +217,6 @@ static int page_pool_init(struct page_pool *pool, */ } - pool->has_init_callback = !!pool->slow.init_callback; - #ifdef CONFIG_PAGE_POOL_STATS pool->recycle_stats = alloc_percpu(struct page_pool_recycle_stats); if (!pool->recycle_stats) @@ -428,8 +426,6 @@ static void page_pool_set_pp_info(struct page_pool *pool, * the overhead is negligible. */ page_pool_fragment_page(page, 1); - if (pool->has_init_callback) - pool->slow.init_callback(page, pool->slow.init_arg); } static void page_pool_clear_pp_info(struct page *page)