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 4AD1F2D12EE; Wed, 1 Jul 2026 13:57:36 +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=1782914257; cv=none; b=LLhtQoxP8J/5AKN/ZzJfU1FDwQ7Lx02ee8wsrfud81upcN1TCYyqAOpkzL4rJwO7bzzYzE70SkGNLgYWTJoLa2+S6bIUX4BfAHo0jF9xLoiTExWH4nIfQB84pVvIQsEZGMne6bGYkT7XNvr7AIsGlRc9sS2I8VJyppZVlxDc0Zg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782914257; c=relaxed/simple; bh=cI1geR1Z3LlHw8kjLeNgMyLlNWarKAIvNJA4UcMfQlQ=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=WVzY1FHIplKqLy8/bb7Aqw2chLgKFPgJhK0cAO0eHiZm12G9pqqcgVtatKcgMPG4mq8neaiqT+3XyN1nEXG1CRswomss2Ys+GK8iAg0XczBl5YXRgfLnymtbsuYk5jQWWLTskDc6Bu4X4GobvzyD5spbTDTAJn7BLMg0flwgMjw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=DFCVs9Fj; 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="DFCVs9Fj" Received: by smtp.kernel.org (Postfix) with ESMTPSA id B746A1F000E9; Wed, 1 Jul 2026 13:57:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1782914256; bh=uoX4qX+FZWfnshgsq0X7cWNdSoKNRRVi845f4JIWs1M=; h=From:Date:Subject:References:In-Reply-To:To:Cc; b=DFCVs9FjGzaRNSAa2f1a1h0gJPO6FRHEot1s1/+N8MLtefzZWzIPhNKXXNKTvI0QC 5i4vtEYjUXS4y/9Z9spQOWdu1/iHPVMy+U4g4UKmRKo3ZVDp1Mr9VFjcdnWpizoUkS wwF1EWJXRIOsybH/gLAnfi5cXiAzGlOSH14EHsW12x3/fDSU2/iKsPeIDwHWaxrFFn /y6+C+DfA5q3hC9MxayMQGBR925K6WFRY/mlm7BZxj6D+tYhJZaw4s6uv7cRe+0uof DjqJiWCO1FJviCUXX1KEo4+CXbONILVJ0mFUWq7anN40+86ZhsSjVraOJnMtkkcQos myAlArQhMpOjQ== From: "Mike Rapoport (Microsoft)" Date: Wed, 01 Jul 2026 16:57:20 +0300 Subject: [PATCH 3/4] sfc/siena: 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: <20260701-b4-drivers-ethernet-v1-3-58776615db6e@kernel.org> References: <20260701-b4-drivers-ethernet-v1-0-58776615db6e@kernel.org> In-Reply-To: <20260701-b4-drivers-ethernet-v1-0-58776615db6e@kernel.org> To: Andrew Lunn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Manish Chopra , Paolo Abeni Cc: Edward Cree , Przemek Kitszel , Sudarsana Kalluru , Tony Nguyen , Mike Rapoport , intel-wired-lan@lists.osuosl.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-net-drivers@amd.com, netdev@vger.kernel.org X-Mailer: b4 0.16-dev efx_siena_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/siena/mcdi.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/net/ethernet/sfc/siena/mcdi.c b/drivers/net/ethernet/sfc/siena/mcdi.c index 4d0d6bd5d3d1..048c1e6017c0 100644 --- a/drivers/net/ethernet/sfc/siena/mcdi.c +++ b/drivers/net/ethernet/sfc/siena/mcdi.c @@ -7,6 +7,7 @@ #include #include #include +#include #include "net_driver.h" #include "nic.h" #include "io.h" @@ -73,7 +74,7 @@ int efx_siena_mcdi_init(struct efx_nic *efx) mcdi->efx = efx; #ifdef CONFIG_SFC_SIENA_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 = efx_siena_mcdi_logging_default; @@ -116,7 +117,7 @@ int efx_siena_mcdi_init(struct efx_nic *efx) return 0; fail2: #ifdef CONFIG_SFC_SIENA_MCDI_LOGGING - free_page((unsigned long)mcdi->logging_buffer); + kfree(mcdi->logging_buffer); fail1: #endif kfree(efx->mcdi); @@ -142,7 +143,7 @@ void efx_siena_mcdi_fini(struct efx_nic *efx) return; #ifdef CONFIG_SFC_SIENA_MCDI_LOGGING - free_page((unsigned long)efx->mcdi->iface.logging_buffer); + kfree(efx->mcdi->iface.logging_buffer); #endif kfree(efx->mcdi); -- 2.53.0