From: "Mike Rapoport (Microsoft)" <rppt@kernel.org>
To: Andrew Lunn <andrew+netdev@lunn.ch>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>,
Paolo Abeni <pabeni@redhat.com>
Cc: Brian Norris <briannorris@chromium.org>,
Edward Cree <ecree.xilinx@gmail.com>,
Francesco Dolcini <francesco@dolcini.it>,
Manish Chopra <manishc@marvell.com>,
Mike Rapoport <rppt@kernel.org>,
Przemek Kitszel <przemyslaw.kitszel@intel.com>,
Sudarsana Kalluru <skalluru@marvell.com>,
Tony Nguyen <anthony.l.nguyen@intel.com>,
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
Subject: [PATCH net-next 3/8] ice: use kzalloc() to allocate staging buffer for reading from GNSS
Date: Tue, 30 Jun 2026 13:59:22 +0300 [thread overview]
Message-ID: <20260630-b4-drivers-net-v1-3-672162a91f37@kernel.org> (raw)
In-Reply-To: <20260630-b4-drivers-net-v1-0-672162a91f37@kernel.org>
ice_gnss_read() uses get_zeroed_page() to allocate a staging buffer for
reading GNSS module data via I2C bus.
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_zeroed_page() with kzalloc() and free_page() with
kfree().
Link: https://lore.kernel.org/all/635405e4-9423-4a25-a6e7-e03c8ea0bcbe@redhat.com
Signed-off-by: Mike Rapoport (Microsoft) <rppt@kernel.org>
---
drivers/net/ethernet/intel/ice/ice_gnss.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/intel/ice/ice_gnss.c b/drivers/net/ethernet/intel/ice/ice_gnss.c
index 8fd954f1ebd6..7d21c3417b0b 100644
--- a/drivers/net/ethernet/intel/ice/ice_gnss.c
+++ b/drivers/net/ethernet/intel/ice/ice_gnss.c
@@ -2,6 +2,7 @@
/* Copyright (C) 2021-2022, Intel Corporation. */
#include "ice.h"
+#include <linux/slab.h>
#include "ice_lib.h"
/**
@@ -124,7 +125,7 @@ static void ice_gnss_read(struct kthread_work *work)
data_len = min_t(typeof(data_len), data_len, PAGE_SIZE);
- buf = (char *)get_zeroed_page(GFP_KERNEL);
+ buf = kzalloc(PAGE_SIZE, GFP_KERNEL);
if (!buf) {
err = -ENOMEM;
goto requeue;
@@ -151,7 +152,7 @@ static void ice_gnss_read(struct kthread_work *work)
count, i);
delay = ICE_GNSS_TIMER_DELAY_TIME;
free_buf:
- free_page((unsigned long)buf);
+ kfree(buf);
requeue:
kthread_queue_delayed_work(gnss->kworker, &gnss->read_work, delay);
if (err)
--
2.53.0
WARNING: multiple messages have this Message-ID (diff)
From: "Mike Rapoport (Microsoft)" <rppt@kernel.org>
To: Andrew Lunn <andrew+netdev@lunn.ch>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>,
Paolo Abeni <pabeni@redhat.com>
Cc: Brian Norris <briannorris@chromium.org>,
Edward Cree <ecree.xilinx@gmail.com>,
Francesco Dolcini <francesco@dolcini.it>,
Manish Chopra <manishc@marvell.com>,
Mike Rapoport <rppt@kernel.org>,
Przemek Kitszel <przemyslaw.kitszel@intel.com>,
Sudarsana Kalluru <skalluru@marvell.com>,
Tony Nguyen <anthony.l.nguyen@intel.com>,
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
Subject: [PATCH net-next 3/8] ice: use kzalloc() to allocate staging buffer for reading from GNSS
Date: Tue, 30 Jun 2026 13:59:22 +0300 [thread overview]
Message-ID: <20260630-b4-drivers-net-v1-3-672162a91f37@kernel.org> (raw)
In-Reply-To: <20260630-b4-drivers-net-v1-0-672162a91f37@kernel.org>
ice_gnss_read() uses get_zeroed_page() to allocate a staging buffer for
reading GNSS module data via I2C bus.
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_zeroed_page() with kzalloc() and free_page() with
kfree().
Link: https://lore.kernel.org/all/635405e4-9423-4a25-a6e7-e03c8ea0bcbe@redhat.com
Signed-off-by: Mike Rapoport (Microsoft) <rppt@kernel.org>
---
drivers/net/ethernet/intel/ice/ice_gnss.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/intel/ice/ice_gnss.c b/drivers/net/ethernet/intel/ice/ice_gnss.c
index 8fd954f1ebd6..7d21c3417b0b 100644
--- a/drivers/net/ethernet/intel/ice/ice_gnss.c
+++ b/drivers/net/ethernet/intel/ice/ice_gnss.c
@@ -2,6 +2,7 @@
/* Copyright (C) 2021-2022, Intel Corporation. */
#include "ice.h"
+#include <linux/slab.h>
#include "ice_lib.h"
/**
@@ -124,7 +125,7 @@ static void ice_gnss_read(struct kthread_work *work)
data_len = min_t(typeof(data_len), data_len, PAGE_SIZE);
- buf = (char *)get_zeroed_page(GFP_KERNEL);
+ buf = kzalloc(PAGE_SIZE, GFP_KERNEL);
if (!buf) {
err = -ENOMEM;
goto requeue;
@@ -151,7 +152,7 @@ static void ice_gnss_read(struct kthread_work *work)
count, i);
delay = ICE_GNSS_TIMER_DELAY_TIME;
free_buf:
- free_page((unsigned long)buf);
+ kfree(buf);
requeue:
kthread_queue_delayed_work(gnss->kworker, &gnss->read_work, delay);
if (err)
--
2.53.0
_______________________________________________
b43-dev mailing list
b43-dev@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/b43-dev
WARNING: multiple messages have this Message-ID (diff)
From: "Mike Rapoport (Microsoft)" <rppt@kernel.org>
To: Andrew Lunn <andrew+netdev@lunn.ch>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>,
Paolo Abeni <pabeni@redhat.com>
Cc: Brian Norris <briannorris@chromium.org>,
Edward Cree <ecree.xilinx@gmail.com>,
Francesco Dolcini <francesco@dolcini.it>,
Manish Chopra <manishc@marvell.com>,
Mike Rapoport <rppt@kernel.org>,
Przemek Kitszel <przemyslaw.kitszel@intel.com>,
Sudarsana Kalluru <skalluru@marvell.com>,
Tony Nguyen <anthony.l.nguyen@intel.com>,
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
Subject: [Intel-wired-lan] [PATCH net-next 3/8] ice: use kzalloc() to allocate staging buffer for reading from GNSS
Date: Tue, 30 Jun 2026 13:59:22 +0300 [thread overview]
Message-ID: <20260630-b4-drivers-net-v1-3-672162a91f37@kernel.org> (raw)
In-Reply-To: <20260630-b4-drivers-net-v1-0-672162a91f37@kernel.org>
ice_gnss_read() uses get_zeroed_page() to allocate a staging buffer for
reading GNSS module data via I2C bus.
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_zeroed_page() with kzalloc() and free_page() with
kfree().
Link: https://lore.kernel.org/all/635405e4-9423-4a25-a6e7-e03c8ea0bcbe@redhat.com
Signed-off-by: Mike Rapoport (Microsoft) <rppt@kernel.org>
---
drivers/net/ethernet/intel/ice/ice_gnss.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/intel/ice/ice_gnss.c b/drivers/net/ethernet/intel/ice/ice_gnss.c
index 8fd954f1ebd6..7d21c3417b0b 100644
--- a/drivers/net/ethernet/intel/ice/ice_gnss.c
+++ b/drivers/net/ethernet/intel/ice/ice_gnss.c
@@ -2,6 +2,7 @@
/* Copyright (C) 2021-2022, Intel Corporation. */
#include "ice.h"
+#include <linux/slab.h>
#include "ice_lib.h"
/**
@@ -124,7 +125,7 @@ static void ice_gnss_read(struct kthread_work *work)
data_len = min_t(typeof(data_len), data_len, PAGE_SIZE);
- buf = (char *)get_zeroed_page(GFP_KERNEL);
+ buf = kzalloc(PAGE_SIZE, GFP_KERNEL);
if (!buf) {
err = -ENOMEM;
goto requeue;
@@ -151,7 +152,7 @@ static void ice_gnss_read(struct kthread_work *work)
count, i);
delay = ICE_GNSS_TIMER_DELAY_TIME;
free_buf:
- free_page((unsigned long)buf);
+ kfree(buf);
requeue:
kthread_queue_delayed_work(gnss->kworker, &gnss->read_work, delay);
if (err)
--
2.53.0
next prev parent reply other threads:[~2026-06-30 10:59 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-30 10:59 [PATCH net-next 0/8] drivers/net: replace __get_free_pages() with kmalloc() Mike Rapoport (Microsoft)
2026-06-30 10:59 ` [Intel-wired-lan] " Mike Rapoport (Microsoft)
2026-06-30 10:59 ` Mike Rapoport (Microsoft)
2026-06-30 10:59 ` [PATCH net-next 1/8] b43, b43legacy: debugfs: use kmalloc() to allocate formatting buffers Mike Rapoport (Microsoft)
2026-06-30 10:59 ` [Intel-wired-lan] " Mike Rapoport (Microsoft)
2026-06-30 10:59 ` Mike Rapoport (Microsoft)
2026-06-30 10:59 ` [PATCH net-next 2/8] bnx2x: use kzalloc() to allocate mac filtering list Mike Rapoport (Microsoft)
2026-06-30 10:59 ` [Intel-wired-lan] " Mike Rapoport (Microsoft)
2026-06-30 10:59 ` Mike Rapoport (Microsoft)
2026-06-30 10:59 ` Mike Rapoport (Microsoft) [this message]
2026-06-30 10:59 ` [Intel-wired-lan] [PATCH net-next 3/8] ice: use kzalloc() to allocate staging buffer for reading from GNSS Mike Rapoport (Microsoft)
2026-06-30 10:59 ` Mike Rapoport (Microsoft)
2026-06-30 10:59 ` [PATCH net-next 4/8] libertas: debugfs: use kzalloc() to allocate formatting buffers Mike Rapoport (Microsoft)
2026-06-30 10:59 ` [Intel-wired-lan] " Mike Rapoport (Microsoft)
2026-06-30 10:59 ` Mike Rapoport (Microsoft)
2026-06-30 10:59 ` [PATCH net-next 5/8] mwifiex: " Mike Rapoport (Microsoft)
2026-06-30 10:59 ` [Intel-wired-lan] " Mike Rapoport (Microsoft)
2026-06-30 10:59 ` Mike Rapoport (Microsoft)
2026-06-30 10:59 ` [PATCH net-next 6/8] sfc/siena: use kmalloc() to allocate logging buffer Mike Rapoport (Microsoft)
2026-06-30 10:59 ` [Intel-wired-lan] " Mike Rapoport (Microsoft)
2026-06-30 10:59 ` Mike Rapoport (Microsoft)
2026-06-30 10:59 ` [PATCH net-next 7/8] sfc: " Mike Rapoport (Microsoft)
2026-06-30 10:59 ` [Intel-wired-lan] " Mike Rapoport (Microsoft)
2026-06-30 10:59 ` Mike Rapoport (Microsoft)
2026-06-30 10:59 ` [PATCH net-next 8/8] wlcore: allocate aggregation and firmware log buffers with kzalloc() Mike Rapoport (Microsoft)
2026-06-30 10:59 ` [Intel-wired-lan] " Mike Rapoport (Microsoft)
2026-06-30 10:59 ` Mike Rapoport (Microsoft)
2026-06-30 14:23 ` [PATCH net-next 0/8] drivers/net: replace __get_free_pages() with kmalloc() Jakub Kicinski
2026-06-30 14:23 ` [Intel-wired-lan] " Jakub Kicinski
2026-06-30 14:23 ` Jakub Kicinski
2026-06-30 14:40 ` Mike Rapoport
2026-06-30 14:40 ` [Intel-wired-lan] " Mike Rapoport
2026-06-30 14:40 ` Mike Rapoport
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260630-b4-drivers-net-v1-3-672162a91f37@kernel.org \
--to=rppt@kernel.org \
--cc=andrew+netdev@lunn.ch \
--cc=anthony.l.nguyen@intel.com \
--cc=b43-dev@lists.infradead.org \
--cc=briannorris@chromium.org \
--cc=davem@davemloft.net \
--cc=ecree.xilinx@gmail.com \
--cc=edumazet@google.com \
--cc=francesco@dolcini.it \
--cc=intel-wired-lan@lists.osuosl.org \
--cc=kuba@kernel.org \
--cc=libertas-dev@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=linux-net-drivers@amd.com \
--cc=linux-wireless@vger.kernel.org \
--cc=manishc@marvell.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=przemyslaw.kitszel@intel.com \
--cc=skalluru@marvell.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.