Article View: linux.kernel.netdev
Article #12145Re: [PATCH net-next] net: ena: reuse the whole RX page on 64kB page kernels
From: Harry Yoo
Date: Fri, 06 Nov 2026 11:10
Date: Fri, 06 Nov 2026 11:10
53 lines
10089 bytes
10089 bytes
On Fri, Nov 06, 2026 at 02:09:34AM -0800, Breno Leitao wrote:
> On Fri, Nov 06, 2026 at 03:17:11AM +0000, Harry Yoo (Meta) wrote:
> > Since commit ef5b0771d247 ("net: ena: fix driver when PAGE_SIZE ==
> > 64kB"), the RX buffer given to the device is limited to ENA_PAGE_SIZE
> > (16kB) because the buffer length field in the RX descriptor is 16 bits.
> > However, the driver still allocates a full page for each RX buffer, so
> > on a 64kB page kernel only the first 16kB of the page is handed to the
> > device and the remaining 48kB is never used.
> >
> > The dynamic RX buffer recycling added by commit f7d625adeb7b ("net: ena:
> > Add dynamic recycling mechanism for rx buffers") does not fully utilize
> > the page because ena_try_rx_buf_page_reuse() only reuses what is left
> > in the current buffer and ignores unused memory in the page.
> >
> > This shows up when RX data stays in socket receive queues, as each
> > queued skb keeps the whole 64kB page alive while at most 16kB of it
> > holds data. On an EC2 t4g.large instance (64kB pages, 8GB memory) with
> > 519MB left unread across 64 TCP sockets, RX pages pinned 2869MB of
> > memory while the socket layer accounted only 687MB.
> >
> > Fix this by mapping the whole page and letting
> > ena_try_rx_buf_page_reuse() size the next buffer from the room left in
> > the page instead of from what is left of ena_buf->len. ena_buf->len is
> > then only the length written to the RX descriptor and stays capped at
> > ENA_PAGE_SIZE. With this fixed, a comparable workload pins only 497MB.
> >
> > When PAGE_SIZE equals ENA_PAGE_SIZE, the room left in the page equals
> > ena_buf->len, so nothing changes.
> >
> > Signed-off-by: Harry Yoo (Meta) <harry@kernel.org>
>
> Nice finding,
Thanks for reviewing, Breno!
> this seems like a bug, no? Which means 'net' tree and a Fix: tag.
Good point, I think Fixes: f7d625adeb7b (6.6.y) would be fairly
reasonable as this is the first commit that reuses the buffer,
it is quite huge unaccounted memory waste on kernels with 64kB pages,
and the change is quite minimal (applies cleanly up to 6.6.y).
I'll respin it targeting net tree with Fixes: tag after waiting for
a few days.
> Reviewed-by: Breno Leitao <leitao@debian.org>
Thanks!
--
Cheers,
Harry / Hyeonggon
Technical Details
Message-ID:
<au2yaGVnZmyA2WUo@minisforum>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-357944-linux-kernel-netdev=dewy.ruReferences:
<20261106-ena-rx-reuse-64k-page-v1-1-ac75b20c5de8@kernel.org> <au2nNm44LnaoXcB2@gmail.com>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-357944-linux-kernel-netdev=dewy.ru From: harry@kernel.org (Harry Yoo) Newsgroups: linux.kernel.netdev Subject: Re: [PATCH net-next] net: ena: reuse the whole RX page on 64kB page kernels Date: Fri, 6 Nov 2026 11:10:30 +0000 Organization: Usenet Network Message-ID: <au2yaGVnZmyA2WUo@minisforum> References: <20261106-ena-rx-reuse-64k-page-v1-1-ac75b20c5de8@kernel.org> <au2nNm44LnaoXcB2@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Info: usenet.network; logging-data="3856337"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:OXoR+fTO1RJFoxvviBVL5suDrfo= sha256:FbFxEJkf0IFtW/Gbqa6DMa7pK1kVAg+zjESF3J3mTmY= sha1:SNUh5abAMBbo5uIhCI746MhZ/AQ= sha256:VrCLBAuLpdeSgdka7n5oGEAkzij+FTauKFQHzBEsKPk= Content-Disposition: inline List-ID: <netdev.vger.kernel.org> X-Mailpost-Empty-Hdrs: X-Spam-Level X-Received: from localhost (localhost [127.0.0.1]) by mail.dewy.ru (Postfix) with ESMTP id C221B113216; Fri, 6 Nov 2026 14:11:44 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at usenet.network X-Spam-Flag: NO X-Spam-Score: -3.401 X-Spam-Status: No, score=-3.401 tagged_above=-9999 required=6.31 tests=[DCC_REPUT_70_89=0.1, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001] autolearn=ham autolearn_force=no X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key) header.d=kernel.org X-Received: from mail.dewy.ru ([127.0.0.1]) by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id kTZ89xUB8fHl; Fri, 6 Nov 2026 14:11:40 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-357944-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> X-Authentication-Results: OpenDMARC; dmarc=pass (p=quarantine dis=none) header.from=kernel.org X-Received: from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10]) by mail.dewy.ru (Postfix) with ESMTPS id 188091131E1; Fri, 6 Nov 2026 14:11:31 +0300 (MSK) X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92]) by sea.lore.kernel.org (Postfix) with ESMTP id BD96C2EB88; Fri, 6 Nov 2026 11:10:40 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1 X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass; t=1793963440; b=ZLtlSHH6jOa4hgZ85ROB264la0ykarH5nM0ZkUfijN8gn2bf4jAZ4iKoC8VKvY4AxrwA q+pXX7o2XC2yt6VOexImbkP9lOx6xFu3q7FZRsVB2ECDngYJPnNiCHehWiUY/GmjyzZ/Y bKMh2Tfi3Hr8KHqUccs0U+l4Yp8QMiyy5QymwDL5oY0FbwdWvExlRGPaSCnYYS0DgZsuv jNH1UT//hYur6stZdLDHj/Rg8jbuq1qIdFV3azu0o3993NGUXS0S0l9Cyp5A8cTG2rQz6 Ij7q1khRm7Ja5jmYmswLpZ44V21X8Osn8al6iAdJ9fJn6Y7hnxgcnhx5TAPLBkyIqSA== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1793963440; h=X-Original-To:Received:Received:DKIM-Signature:Date:From:To:Cc: Subject:Message-ID:References:X-Mailing-List:List-Id:List-Post: List-Help:List-Subscribe:List-Unsubscribe:List-Owner:Precedence: MIME-Version:Content-Type:Content-Disposition:In-Reply-To; bh=79VEnISlBWCB0jfRPZxMBgFANQF9nkjMie7oZkEbJyM=; b=nbHIwcoQ7Jbeo5E+ph2ex2FC6GVa/bsl1x8josw3sdZa9nBKhbK9Hqv59JJPiX5Gx89W 6oUrRyhjLX/tHDeov5nHVqWoZVQJ0PgB02HopnOKKpO4ucaZPvrAETggGFQpdRvtWM6Bl s+6uffwdmCGRikSqTHuUfyWvB8egLejPfeCWhKQojyBnPlPSvn4i2/jCXEWbwp+Ymzf6y 0aZVOlbJQ+KFK7z1PYGGRqMsZJeiGxSq51K23Gmo/2eYhpCjf5nEuKKkVkc26/mvvq1/S NjxL4dyhgf4R4mKWLQmyHNrdUKLfGgNYEpe/kkdCBeEpQMg1UNCYXnXGcQoPcfmw3jA== X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=oypPu6P5; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1 X-Received: from localhost.localdomain (localhost [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 32D6C606A32D; Fri, 6 Nov 2026 11:10:40 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key, unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=oypPu6P5 X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1793963433; b=EFI9gUt/y51S3cVcu0mxcvtWxD4kOd1w8BsAPQeLdJnxJPSecQUI6S/RFH9FnvcA4hfq zs8oCemy7J8LfGkFp3H3owh3mmtiUQUVryhZgmU10psfeBAql5UQFndJ45kAJcr0dRXwe lNaD+NEAYxTmA2Ki0VkZgnNZNLSsVtkv16POn2vADpC4wpucdbRtwoVhCsKDaz+qtVNS/ FJMIf5oT0XamXPBB80aWuvms4XhwqqYVeITaEdzGJppB47HmxagsQd2pUjMWFVivBTJa2 7q8ChbEB9oTVlzOllaYSz9EA3XnwK0a5NFzOfnETqFZA8Glfg9eJSRTzPRZ9ogbsqSw== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1793963433; h=Received:DKIM-Signature:Date:From:To:Cc:Subject:Message-ID: References:MIME-Version:Content-Type:Content-Disposition:In-Reply-To; bh=79VEnISlBWCB0jfRPZxMBgFANQF9nkjMie7oZkEbJyM=; b=Nmsfzzgtt0OAueGwwsuXLu7wkv0FRVwrOazzFxbGkywHmdRRAu+h+rgh1XfiVO7jDDW/ TjfHmhzTZHE2lGEU5LVAYdQBDcpYUHcXofG2OnWqOoCqzZAJndYCSmIJK8UdtXkkTa+Zc JcdYz9/mCZ1/CWm+TtZ+JP3SnJml7I4IlRokMixwoYHtytXKPwsdNpF3cxsnu4pwiKfKG dKmVHM8M6IRpjWdYGxbmtOJIg0OezfMNJq01gGjRKh9FYjOHexhN+OoO/VFTap3iJBSQk rafTwqSOHmxcjZxoqOzER/e4xA9O5RIKuHke8xmol39IpELlmva1+9XtIwezsRYqdQg== X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=oypPu6P5; arc=none smtp.remote-ip=100.103.45.18 X-Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6EB8B606A329; Fri, 6 Nov 2026 11:10:33 +0000 (UTC) X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8C68E1F008A4; Fri, 6 Nov 2026 11:10:32 +0000 (UTC) X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1793963433; bh=79VEnISlBWCB0jfRPZxMBgFANQF9nkjMie7oZkEbJyM=; h=Date:From:To:Cc:Subject:References:In-Reply-To; b=oypPu6P5oKVysGRQFLgMe+23NPmbfsu1P2FvjR0QMxUEge5PuMtPJl5JCHt89IaJm w9PFPE2Dt/wulLtdEsKSEP8u4HaG16/bep4kyC6AsTki0KiBLE2Y1wF0c7RP2o3VZz oWBJGk5S2VlvZTlT2gk3faZpGnPedAIqdkCPKhoiHVGfyuG2WgKlZE0KJGm3nUK1Qc tKPI4JgQ10uYbDFeOOJKOqGX6HyvecBxiFIaxF6gTtPuR9a48CkdMRef5hiA3waUOV MdHLQxgMbu+cQmS+4bm39ih8o9inFcjWCV2Xc+K5qZkdlpOt4TgarDKnnEZFp7sRm0 Tgd9aBnxMEx2Q== X-Cc: Arthur Kiyanovski <akiyano@amazon.com>, David Arinzon <darinzon@amazon.com>, Andrew Lunn <andrew+netdev@lunn.ch>, "David S. Miller" <davem@davemloft.net>, Eric Dumazet <edumazet@kernel.org>, Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>, kernel-team@meta.com, netdev@vger.kernel.org, linux-kernel@vger.kernel.org X-Mailing-List: netdev@vger.kernel.org X-List-Post: <mailto:netdev@vger.kernel.org> X-List-Help: <mailto:netdev+help@vger.kernel.org> X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org> X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org> X-List-Owner: <mailto:netdev+owner@vger.kernel.org> X-Precedence: list X-In-Reply-To: <au2nNm44LnaoXcB2@gmail.com>