From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (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 1ABAE383310; Tue, 30 Jun 2026 11:00:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782817204; cv=none; b=lGQ+yKVO/A090944MLSqVqCSq5tVOiCaNsuPMhjgm+qFjSkrynMAwSsp0CcD8PBeAbQM9rpL5y05b5tczI+RGS80FnxCdohPY3YdfjvRiRvdxF2+G6VnO7cPgvNKApZv+ZRp7v1WWvWTQMcAzdKeKwemw4CFllzNlAu+RcxA5ms= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782817204; c=relaxed/simple; bh=ppZhTeXg9gmO+8PaxwWk0ZxukXOZQZ0VH6QiMrC0kyw=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=l4TXBM4zkhnfugwrInwFeFzYaFtuktNk7XwzeVO8nDnhJ2vtHVo5wtsaPlBJyICsZCb7pnfgL/Kbc0ZHosIjCdZO2KEATY6UJxIbLkaH0GflHCMj53x8xT1WEhBPsdxfZoXOB3jzPuu6e38X6eIFyr3vDjPOWYYVhu2hU+qryKE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=ZMVGaWI9; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="ZMVGaWI9" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6A1A51F000E9; Tue, 30 Jun 2026 10:59:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1782817203; bh=qVNG6A0QrvVc3Q5VGETu2ZNN6OFwwV/HGShrasBWJk4=; h=From:Date:Subject:References:In-Reply-To:To:Cc; b=ZMVGaWI9VL4Ex4gSsvHRdpL8r28sBJeHwMEuL7+lauPlew2FTdOEsgs2ATl1+atca 5LYGcr4dixAyl65dQrx1zaB/Glfflj9NCXAqVLtCfj8sE2er5nqspknawJYfva0Chv vKRhkeVapVUnpfeuyh4J75IHXPeUUpy5UPveQh5Llp1phBnJX8oYOScCnmkcIBSI6q EkJvpcSINDcZQKSJ/otkSjIulmeOQfuTzYU9nqou8/TxgPQebt/GjHstOjzw9cPTO7 WUMbUxdHMl15cDSi+gs3tI/IEI0Ne+cwtcQB5Ilb6oLY2SCNlfdksJjYyFL7tCxlDT rQgDawk1deirQ== From: "Mike Rapoport (Microsoft)" Date: Tue, 30 Jun 2026 13:59:26 +0300 Subject: [PATCH net-next 7/8] sfc: use kmalloc() to allocate logging buffer Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20260630-b4-drivers-net-v1-7-672162a91f37@kernel.org> References: <20260630-b4-drivers-net-v1-0-672162a91f37@kernel.org> In-Reply-To: <20260630-b4-drivers-net-v1-0-672162a91f37@kernel.org> To: Andrew Lunn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni Cc: Brian Norris , Edward Cree , Francesco Dolcini , Manish Chopra , Mike Rapoport , Przemek Kitszel , Sudarsana Kalluru , Tony Nguyen , b43-dev@lists.infradead.org, intel-wired-lan@lists.osuosl.org, libertas-dev@lists.infradead.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-net-drivers@amd.com, linux-wireless@vger.kernel.org, netdev@vger.kernel.org X-Mailer: b4 0.15.2 efx_mcdi_init() allocates a logging buffer for MCDI firmware communication diagnostics. This buffer can be allocated with kmalloc() as there's nothing special about it to go directly to the page allocator. kmalloc() provides a better API that does not require ugly casts and kfree() does not need to know the size of the freed object. Performance difference between kmalloc() and __get_free_pages() is not measurable as both allocators take an object/page from a per-CPU list for fast path allocations. For the slow path the performance is anyway determined by the amount of reclaim involved rather than by what allocator is used. Replace use of __get_free_page() with kmalloc() and free_page() with kfree(). Link: https://lore.kernel.org/all/635405e4-9423-4a25-a6e7-e03c8ea0bcbe@redhat.com Signed-off-by: Mike Rapoport (Microsoft) --- drivers/net/ethernet/sfc/mcdi.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/net/ethernet/sfc/mcdi.c b/drivers/net/ethernet/sfc/mcdi.c index e65db9b70724..b806d3d90c42 100644 --- a/drivers/net/ethernet/sfc/mcdi.c +++ b/drivers/net/ethernet/sfc/mcdi.c @@ -7,6 +7,7 @@ #include #include #include +#include #include "net_driver.h" #include "nic.h" #include "io.h" @@ -71,7 +72,7 @@ int efx_mcdi_init(struct efx_nic *efx) mcdi->efx = efx; #ifdef CONFIG_SFC_MCDI_LOGGING /* consuming code assumes buffer is page-sized */ - mcdi->logging_buffer = (char *)__get_free_page(GFP_KERNEL); + mcdi->logging_buffer = kmalloc(PAGE_SIZE, GFP_KERNEL); if (!mcdi->logging_buffer) goto fail1; mcdi->logging_enabled = mcdi_logging_default; @@ -112,7 +113,7 @@ int efx_mcdi_init(struct efx_nic *efx) return 0; fail2: #ifdef CONFIG_SFC_MCDI_LOGGING - free_page((unsigned long)mcdi->logging_buffer); + kfree(mcdi->logging_buffer); fail1: #endif kfree(efx->mcdi); @@ -138,7 +139,7 @@ void efx_mcdi_fini(struct efx_nic *efx) return; #ifdef CONFIG_SFC_MCDI_LOGGING - free_page((unsigned long)efx->mcdi->iface.logging_buffer); + kfree(efx->mcdi->iface.logging_buffer); #endif kfree(efx->mcdi); -- 2.53.0