From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wm1-f51.google.com (mail-wm1-f51.google.com [209.85.128.51]) (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 C9B2337C92D for ; Wed, 1 Jul 2026 16:59:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.51 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782925201; cv=none; b=Ch/MwrtbJVVSLhR7oNDHuU8QEiGcYDfT5jMy3yhQzz9tudhJgy53vgUaFhp9TOkUGscE77L+NhxvPca3HQNinVDQn+/h0Lnu4CFrYCANZXt7l2uHq82mcYJBgW7eObYaUjdbbafkJAPvWAfnNYvibc/V8v/N/uG6ZQNsZoovoqw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782925201; c=relaxed/simple; bh=SlqAYF/R/nxbaLdun/T9sdzZCmGY9o3nhXCIf2spoTc=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=Q4oodBapIK4GvJXsp2CDd6y+SSqUr8ePh+o0GG0fC8waIUCHeNprMkIisGzm8sFa2EMHZaiu75fSyaLHP7AYbldDRcz+m9h2Gk/Wx1m7tPwYH1dTjnTG7bdHTQ/e1EQtZ2SSLG240ZkZHv9QjeWXjI1milNPNpyThdbl1bx+sQ4= 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=M35qcbyJ; arc=none smtp.client-ip=209.85.128.51 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="M35qcbyJ" Received: by mail-wm1-f51.google.com with SMTP id 5b1f17b1804b1-493bfe9f886so4845735e9.0 for ; Wed, 01 Jul 2026 09:59:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1782925198; x=1783529998; 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=PaapEG/0w2F/ZCT3Yos1qIyYlCxFdKMOGlwcZerx/iQ=; b=M35qcbyJnkV1pZ25FOL78MBNI/DWv9H/oivYVHG2HSos9G8M6UchY4Dy7hrllt0TxZ yXfxuXDmDvhn++vCbalU4oWUl2YgQTnHDzQF2bmknznBkSmV4BiRWakrexsI4CQ/6zzv 2pcC3VOfkdE3bevu40odc+jmhUBgJULgTJF9s2UmBvHJKEBS/glNDqNWc0pP9XYIOqY2 MgqGHql1fBu7e1updDyrnYyBkJBFTu6DU6ZwrVZbisRtisjP9ID5lyEgDlqNBUVy3puz 41rzaSLQ2n4L4fnRulBtfLddnBtrVZyR8APOPBkg2cyNwnzMKFLDLRPnesO22NqXrcxQ aA3w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1782925198; x=1783529998; 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=PaapEG/0w2F/ZCT3Yos1qIyYlCxFdKMOGlwcZerx/iQ=; b=Y2ZDcy1NZieLfMwlQnSQvWzKCj1XELtXD4jV2sW2krX0dho95BiASZ4gViiD9aOd6a eEkVQ2gqAcR2KTJFJecjF7xexfswems5jUoB2Gaui37JFJNikbIc8S20meHJtYI2ns2M wNkNAp1NKhrlB/Q8V1QD6EwsFrkFhLF7FDrB1C0s2Hv3c5aSkLGEanSi7Wmes0A53ShM qTNxGKeAjWTWW2hIbu62jLZ0KTn3YD88QsjWmH3EHccsbFnkYp9i9st8YlI/JV/VRsj5 ghx2QS9wXTtUtUAKXEIhkvLg78QeWRtGbVVYNtTDFLAZpqbhcKt3coXBB1j44jd1bY4N ob7g== X-Forwarded-Encrypted: i=1; AFNElJ+zx6HrDrz1Qw1jBgvoCRmobC8QQdJS33orGWcdU8+rTZsdgMqkUxLAyC/mhsRCuid2C5YftsUzzElqb8o=@vger.kernel.org X-Gm-Message-State: AOJu0YyvUEjUn4pwUgYIQoxak4dVySLjWi4uxI2sRmjExNELyXe9mCq0 L6UaL6jLgH8IbgEPoDz5Wcg1UtrDvpsaKEuz+PJdAv7eoSIx+KRzjhnB X-Gm-Gg: AfdE7cniOMCmBeG1pTRVp7qIQzlxn0Fxvek0Ca6Jhx/kCNgN1KSkTQctxsBbx0K9d9T 8gfH0iCyzP8tF5CgqWQC4Xb6Xjq09qBvqyAlkF3MHYjFH79ZCyVfbsD/fTcT8OYNEaFoKxZOLQu rA3EJpGnmitIYDFjEhTbU8O0ZXPZi3aoCRnOjMC8TnxuW2ZrwwM4KQ+3hS43nYuOQiM7VnKh1DN tQgPasyaeTswf5AOB/LLSEYEnKhA/uDucVVOOtIK87Pu5lbQfta3TmiTYYfUpGZ7597nczPNUtm 9QguRuRYEI4i4xaQ7oQcEmnohw+n5vkYQDOIDdvX4Bc1XsgQSLL2kdo5vOvrK8ZQfKVOdxcWsoi x4TisocATTwqFxBXZcOHPg6pnoXBT8PwfFaKuSUQm1OrkZc035ptXmvW31pCE0u9yV6GZM/dKPZ j8b8tZok7wr/2gIUyqcxPrszBRzbYlZm1ns0/0c7UewhR7kbptUe/qCCe7Ig+hxAzoFEjtgLX/s iE= X-Received: by 2002:a05:600c:8590:b0:492:6f9b:572e with SMTP id 5b1f17b1804b1-493c2baeeeamr29176415e9.37.1782925198152; Wed, 01 Jul 2026 09:59:58 -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-493be4c9f78sm92659965e9.5.2026.07.01.09.59.57 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 01 Jul 2026 09:59:57 -0700 (PDT) Message-ID: Date: Wed, 1 Jul 2026 17:59:56 +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 4/4] sfc: 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-4-58776615db6e@kernel.org> Content-Language: en-GB From: Edward Cree In-Reply-To: <20260701-b4-drivers-ethernet-v1-4-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_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 > --- > 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); >