Skip to contentSkip to conversation

treewide: fixup gfp_t printks

PATCH In review Brendan Jackman 4 participants 11 messages Mar 26 – May 13

Subsystems (9)
lore
Share & tools
lore
#0 lore raw

v2 cover treewide: fixup gfp_t printks

This patchset used to be about switching gfp_t to unsigned long. That is probably not gonna happen any more but while writing it I found these cleanups that seem worthwhile regardless.

---
Changes in v2:
- Drop gfp_t changes
- Add correct CCs
- Add minor fixups to preexisting code spotted by AI review
- Link to v1: https://lore.kernel.org/r/[email protected]

---
Brendan Jackman (4):
drm/managed: Use special gfp_t format specifier
iwlegacy: 3945-mac: Fixup allocation failure log mm/kfence: Use special gfp_t format specifier net/rds: Use special gfp_t format specifier

 drivers/gpu/drm/drm_managed.c                  | 4 ++--
 drivers/net/wireless/intel/iwlegacy/3945-mac.c | 4 ++--
 mm/kfence/kfence_test.c                        | 2 +-
 net/rds/tcp_recv.c                             | 2 +-
 4 files changed, 6 insertions(+), 6 deletions(-)

---
base-commit: c369299895a591d96745d6492d4888259b004a9e
change-id: 20260319-gfp64-7a970a80ba4e

Best regards,

Signature · 1 line
Brendan Jackman <[email protected]>
#1 lore raw

PATCH v2 1/4 drm/managed: Use special gfp_t format specifier

%pGg produces nice readable output and decouples the format string from the size of gfp_t.

---
 drivers/gpu/drm/drm_managed.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/drm_managed.c +2 -2
index 247f468731de0..a9da94319b052 100644
@@ -232,8 +232,8 @@ void *drmm_kmalloc(struct drm_device *dev, size_t size, gfp_t gfp)
 
 	dr = alloc_dr(NULL, size, gfp, dev_to_node(dev->dev));
 	if (!dr) {
-		drm_dbg_drmres(dev, "failed to allocate %zu bytes, %u flags\n",
-			       size, gfp);
+		drm_dbg_drmres(dev, "failed to allocate %zu bytes, %pGg\n",
+			       size, &gfp);
 		return NULL;
 	}
 	dr->node.name = kstrdup_const("kmalloc", gfp);
Signature · 1 line
2.51.2
#2 lore raw

PATCH v2 2/4 iwlegacy: 3945-mac: Fixup allocation failure log

In reply to Brendan Jackman

Fix 2 issues spotted by AI[0]:

1. Missing space after the full stop.

2. Wrong GFP flags are printed.

And also switch to %pGg for the GFP flags. This produces nice readable output and decouples the format string from the size of gfp_t.

[0] https://sashiko.dev/#/patchset/20260319-gfp64-v1-0-2c73b8d42b7f%40google.com

---
 drivers/net/wireless/intel/iwlegacy/3945-mac.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/wireless/intel/iwlegacy/3945-mac.c +2 -2
index c148654aa9533..88b31e0b9568c 100644
@@ -1002,9 +1002,9 @@ il3945_rx_allocate(struct il_priv *il, gfp_t priority)
 				D_INFO("Failed to allocate SKB buffer.\n");
 			if (rxq->free_count <= RX_LOW_WATERMARK &&
 			    net_ratelimit())
-				IL_ERR("Failed to allocate SKB buffer with %0x."
+				IL_ERR("Failed to allocate SKB buffer with %pGg. "
 				       "Only %u free buffers remaining.\n",
-				       priority, rxq->free_count);
+				       &gfp_mask, rxq->free_count);
 			/* We don't reschedule replenish work here -- we will
 			 * call the restock method and if it still needs
 			 * more buffers it will schedule replenish */
Signature · 1 line
2.51.2
maintainer Acked-by on v2 2/4
#3 lore raw

Re: [PATCH v2 2/4] iwlegacy: 3945-mac: Fixup allocation failure log

Hi,

Quoted 5 lines · Brendan Jackman

Fix 2 issues spotted by AI[0]:

1. Missing space after the full stop.

2. Wrong GFP flags are printed.

We should also initialize gfp_mask = priority inside the loop. But this can be done as separate patch.

Quoted 6 lines

And also switch to %pGg for the GFP flags. This produces nice readable output and decouples the format string from the size of gfp_t.

[0] https://sashiko.dev/#/patchset/20260319-gfp64-v1-0-2c73b8d42b7f%40google.com

Quoted 24 lines
---
 drivers/net/wireless/intel/iwlegacy/3945-mac.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/wireless/intel/iwlegacy/3945-mac.c +2 -2
index c148654aa9533..88b31e0b9568c 100644
@@ -1002,9 +1002,9 @@ il3945_rx_allocate(struct il_priv *il, gfp_t priority)
 				D_INFO("Failed to allocate SKB buffer.\n");
 			if (rxq->free_count <= RX_LOW_WATERMARK &&
 			    net_ratelimit())
-				IL_ERR("Failed to allocate SKB buffer with %0x."
+				IL_ERR("Failed to allocate SKB buffer with %pGg. "
 				       "Only %u free buffers remaining.\n",
-				       priority, rxq->free_count);
+				       &gfp_mask, rxq->free_count);
 			/* We don't reschedule replenish work here -- we will
 			 * call the restock method and if it still needs
 			 * more buffers it will schedule replenish */
Signature · 2 lines
-- 
2.51.2
#4 lore raw

PATCH v2 3/4 mm/kfence: Use special gfp_t format specifier

In reply to Brendan Jackman

%pGg produces nice readable output and decouples the format string from the size of gfp_t.

---
 mm/kfence/kfence_test.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
mm/kfence/kfence_test.c +1 -1
index 5725a367246d9..10424cd25e5a6 100644
@@ -263,7 +263,7 @@ static void *test_alloc(struct kunit *test, size_t size, gfp_t gfp, enum allocat
 		break;
 	}
 
-	kunit_info(test, "%s: size=%zu, gfp=%x, policy=%s, cache=%i\n", __func__, size, gfp,
+	kunit_info(test, "%s: size=%zu, gfp=%pGg, policy=%s, cache=%i\n", __func__, size, &gfp,
 		   policy_name, !!test_cache);
 
 	/*
Signature · 1 line
2.51.2
#5 lore raw

PATCH v2 4/4 net/rds: Use special gfp_t format specifier

In reply to Brendan Jackman

%pGg produces nice readable output and decouples the format string from the size of gfp_t.

---
 net/rds/tcp_recv.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
net/rds/tcp_recv.c +1 -1
index 49f96ee0c40f6..ffe843ca219c7 100644
@@ -275,7 +275,7 @@ static int rds_tcp_read_sock(struct rds_conn_path *cp, gfp_t gfp)
 	desc.count = 1; /* give more than one skb per call */
 
 	tcp_read_sock(sock->sk, &desc, rds_tcp_data_recv);
-	rdsdebug("tcp_read_sock for tc %p gfp 0x%x returned %d\n", tc, gfp,
+	rdsdebug("tcp_read_sock for tc %p gfp %pGg returned %d\n", tc, &gfp,
 		 desc.error);
 
 	if (skb_queue_empty_lockless(&sock->sk->sk_receive_queue) &&
Signature · 1 line
2.51.2
maintainer Acked-by on v2 4/4
#6 lore raw

Re: [PATCH v2 4/4] net/rds: Use special gfp_t format specifier

Quoted 14 lines · Brendan Jackman

%pGg produces nice readable output and decouples the format string from the size of gfp_t.

---
 net/rds/tcp_recv.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
net/rds/tcp_recv.c +0 -0
index 49f96ee0c40f6..ffe843ca219c7 100644

net/rds/tcp_recv.c static int rds_tcp_read_sock(struct rds_conn_path *cp, gfp_t gfp) · line 281

Quoted 8 lines
net/rds/tcp_recv.c +1 -1
@@ -275,7 +275,7 @@ static int rds_tcp_read_sock(struct rds_conn_path *cp, gfp_t gfp)
 	desc.count = 1; /* give more than one skb per call */
 
 	tcp_read_sock(sock->sk, &desc, rds_tcp_data_recv);
-	rdsdebug("tcp_read_sock for tc %p gfp 0x%x returned %d\n", tc, gfp,
+	rdsdebug("tcp_read_sock for tc %p gfp %pGg returned %d\n", tc, &gfp,
 		 desc.error);
 
 	if (skb_queue_empty_lockless(&sock->sk->sk_receive_queue) &&

This looks fine to me. Thanks Brendan!

#7 lore raw
In reply to Brendan Jackman
Quoted 3 lines · Brendan Jackman

This patchset used to be about switching gfp_t to unsigned long. That is probably not gonna happen any more but while writing it I found these cleanups that seem worthwhile regardless.

For the record, these patches are independent and could be sent separately to the appropriate maintainers. Doing so would avoid unnecessarily large CC lists for people not interested about the changes in other subsystems.

Regards
Stanislaw

Quoted 29 lines

---

Changes in v2:
- Drop gfp_t changes
- Add correct CCs
- Add minor fixups to preexisting code spotted by AI review
- Link to v1: https://lore.kernel.org/r/[email protected]

---
Brendan Jackman (4):
drm/managed: Use special gfp_t format specifier
iwlegacy: 3945-mac: Fixup allocation failure log mm/kfence: Use special gfp_t format specifier net/rds: Use special gfp_t format specifier

 drivers/gpu/drm/drm_managed.c                  | 4 ++--
 drivers/net/wireless/intel/iwlegacy/3945-mac.c | 4 ++--
 mm/kfence/kfence_test.c                        | 2 +-
 net/rds/tcp_recv.c                             | 2 +-
 4 files changed, 6 insertions(+), 6 deletions(-)

---
base-commit: c369299895a591d96745d6492d4888259b004a9e
change-id: 20260319-gfp64-7a970a80ba4e

Best regards,

Signature · 1 line
Brendan Jackman <[email protected]>
#8 lore raw
In reply to Brendan Jackman
Quoted 24 lines · Brendan Jackman

This patchset used to be about switching gfp_t to unsigned long. That is probably not gonna happen any more but while writing it I found these cleanups that seem worthwhile regardless.

---
Changes in v2:
- Drop gfp_t changes
- Add correct CCs
- Add minor fixups to preexisting code spotted by AI review
- Link to v1: https://lore.kernel.org/r/[email protected]

---
Brendan Jackman (4):
drm/managed: Use special gfp_t format specifier
iwlegacy: 3945-mac: Fixup allocation failure log mm/kfence: Use special gfp_t format specifier net/rds: Use special gfp_t format specifier

 drivers/gpu/drm/drm_managed.c                  | 4 ++--
 drivers/net/wireless/intel/iwlegacy/3945-mac.c | 4 ++--
 mm/kfence/kfence_test.c                        | 2 +-
 net/rds/tcp_recv.c                             | 2 +-
 4 files changed, 6 insertions(+), 6 deletions(-)
Quoted 5 lines

---
base-commit: c369299895a591d96745d6492d4888259b004a9e
change-id: 20260319-gfp64-7a970a80ba4e

Best regards,

Hi all,

Any chance someone can take these?

maintainer
#9 lore raw
Quoted 9 lines · On Tue, 12 May 2026 12:58:20 +0000 Brendan Jackman <[email protected]> wrote:
Quoted 4 lines · Brendan Jackman

This patchset used to be about switching gfp_t to unsigned long. That is probably not gonna happen any more but while writing it I found these cleanups that seem worthwhile regardless.

...

Any chance someone can take these?

[2/4] is merged into the wireless tree (I assume) and the other three are in mm.git's mm-unstable branch.

#10 lore raw
Quoted 9 lines · Andrew Morton
Quoted 6 lines · On Tue, 12 May 2026 12:58:20 +0000 Brendan Jackman <[email protected]> wrote:
Quoted 4 lines · Brendan Jackman

This patchset used to be about switching gfp_t to unsigned long. That is probably not gonna happen any more but while writing it I found these cleanups that seem worthwhile regardless.

Quoted 6 lines
Quoted 3 lines

...

Any chance someone can take these?

[2/4] is merged into the wireless tree (I assume) and the other three are in mm.git's mm-unstable branch.

Oh sorry, I just checked and I did actually receive the notification when you queued it, I guess I just didn't parse it mentally.