From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wm1-f52.google.com (mail-wm1-f52.google.com [209.85.128.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BEABB380FDE for ; Wed, 1 Jul 2026 17:01:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.52 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782925301; cv=none; b=QQryyUPMLCgb27W+Q9Dnq0B+54mNOY0lAURCzBDkOea8hakfb48f7zJHORsqYP9vMze0fSryTTJjl3CKwdhGaRhUOrEEK6f0OtsJjLAWpUItt9TY6AN86vfkWA4bz0wi70QvGlEBLpsX5rfDhObMn4wA1UfPfx3AXs3R+avNRz4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782925301; c=relaxed/simple; bh=cXZvzRGh9+LC8x/UZFSBxmdI7wez4U+orwjoklAgSXU=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=S6TDscLpeBPZHWkZkEdX3xUou1HTDfQo01QN2Hxspmj+MXsT8LDmtHoU/Sgfi8UgsDs6HDBqOEqBmDsJEgljGK1Esu6whjRWATvaB5DsqPIRvS6mdYVy6dx2v63Srw2PjZiKLRF+w8UzHlmGOkjoGAUegiGDP5a22WxwV3qbdRM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=OOGb8xWw; arc=none smtp.client-ip=209.85.128.52 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="OOGb8xWw" Received: by mail-wm1-f52.google.com with SMTP id 5b1f17b1804b1-493c1950518so4931515e9.1 for ; Wed, 01 Jul 2026 10:01:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1782925297; x=1783530097; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=9CayLh9sn6SyGJSkLYj3J5jM0EP4cWj8SDd1cZ9x18Y=; b=OOGb8xWwC4dT+eqE2W+82SR8+5YiBL6+gA+J3O9vPOIqYF8cNEW9CbKmpL1S4txGAL zjlsI8fpR4/u62hnbiyVPzSwdNSyTUyPtJ6SKlh57P0l12u7ktpL+UZEdx9ZZIkbHvGr PFrMl83B6G1ioFUPX1RGCqSCF8GFmA6W8NWnQ3Pk5UVP9w6+E2gIlz8WZJkK3UUxlfr0 EdqZZEJGQj9hyQDw0KmItfSoN3JypGgVg80aHsRQpQNVosHmKHHhQgsoHOEHGRMfOwza DFC5Wv/zBgkflczP+yDpAWg37lXwU5IhicnU8d+Ya2ZM/x+WfMr6OistQX8NcbGUsEHw vW7g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1782925297; x=1783530097; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :x-gm-gg:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=9CayLh9sn6SyGJSkLYj3J5jM0EP4cWj8SDd1cZ9x18Y=; b=b+T+n2a5ydVJIHs9mOYh/mQbyPtDlaNrQZrRoM0NFEXVmKf82RtNqV8GLALkxUrJkO CvZibV9RcP4RUaA4E8jWB1nHMnpfKvTAQdyZU+OY96oD3dpx7BCKKkTiHvqg1o4qL5dc bWzDnud9RthgOmtfD3+j1qW3lUQi81KtUd4UeDDfD+frj1YhBrY2YAx2tc+/OJvd+tOI ZyLS8JfBWSP85l1twmQXmuVnUpnK3J+NbUixHXtGNeHPFJ0YAAoTzthWSCTfnDf/J7BV tawZjcAJ8raLeXMmBUaLMTXfBYIxvpVKh++C5kmZgVtd/9+S8n6b+DBAmO6ph6JJw/vf NnMw== X-Forwarded-Encrypted: i=1; AFNElJ+MDyM0STidFs7DL4sUYJGE77NvVnOm/X+j7ji1E8oCJp9SezRHGWf4eNtTP4e3+FCLwnoXVDkxPtFeRys=@vger.kernel.org X-Gm-Message-State: AOJu0YwSo/8bfBEJfhYqu/6/g/cC4p/judh/bhA9MGMZE7r8nOsL5BH6 +2wghQ2e36P0OooaporYdWsaMb7wPIlqSaVhVCfjLTob/WpIJzc960bO X-Gm-Gg: AfdE7cko5nRDyP12i076k0Vh7VHtxXhep1wVl++hKwQ43pj4WKQB5G6ncxIxWPo3Aok XSwmepph5IZUaVezwdgnhpBU+/f87m3ePG6F/0p9B30gA2yfbDncGuIknQ7rZz29APLWXhK6GAx ys9UyXrapEiyTGIsIGKSCvlNvk13AMzuFGbbP8Y6TSNtCpYpPHYPw7go/+KOD5IBbbLxMK7EkP3 WJEGv1G1ogSmNdCBD4SKrSoyH/bELz5yD1gwRH+JCfCqN9UuhIz3Eot4HxF2GO+zNTldzL5r3IY xcDsDmm/lmeqhaBygK0r/fvOt++Qvi6q31h6a1hnPqW4amYXLzhF2EmiNEIzLzVoskPrrMr5m30 HciZTkrAQOMGs9GTJ6zOIaOMKGcYyYuV0A5WDY/+38uFoLz9gSXio1L2AgiCqOfMhqOrC/MK9tG LmQsxC64PgotDUqV+t1qjgRPtU3Zbf2nZateMmEqhw3+MpmLtKv8pbYNqvwPWCPdB71cirmjr0X 3o= X-Received: by 2002:a05:600c:4685:b0:490:af63:2cb1 with SMTP id 5b1f17b1804b1-493c231f913mr37259535e9.7.1782925296780; Wed, 01 Jul 2026 10:01:36 -0700 (PDT) Received: from [192.168.1.122] (cpc159313-cmbg20-2-0-cust161.5-4.cable.virginm.net. [82.0.78.162]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-493be4bfd47sm122822645e9.2.2026.07.01.10.01.35 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 01 Jul 2026 10:01:36 -0700 (PDT) Message-ID: Date: Wed, 1 Jul 2026 18:01:35 +0100 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH 3/4] sfc/siena: use kmalloc() to allocate logging buffer To: "Mike Rapoport (Microsoft)" , Andrew Lunn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Manish Chopra , Paolo Abeni Cc: Przemek Kitszel , Sudarsana Kalluru , Tony Nguyen , intel-wired-lan@lists.osuosl.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-net-drivers@amd.com, netdev@vger.kernel.org References: <20260701-b4-drivers-ethernet-v1-0-58776615db6e@kernel.org> <20260701-b4-drivers-ethernet-v1-3-58776615db6e@kernel.org> Content-Language: en-GB From: Edward Cree In-Reply-To: <20260701-b4-drivers-ethernet-v1-3-58776615db6e@kernel.org> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit On 01/07/2026 14:57, Mike Rapoport (Microsoft) wrote: > 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) Reviewed-by: Edward Cree (resending since I hit 'reply' instead of 'reply all' the first time) > --- > 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); >