Linux cgroups development
 help / color / mirror / Atom feed
* [PATCH] cgroup: Use %p for pointer formatting
@ 2026-09-18 10:48 Sebastian Andrzej Siewior
  2026-09-18 12:59 ` Michal Koutný
  2026-09-19  0:12 ` Tejun Heo
  0 siblings, 2 replies; 4+ messages in thread
From: Sebastian Andrzej Siewior @ 2026-09-18 10:48 UTC (permalink / raw)
  To: cgroups; +Cc: Tejun Heo, Johannes Weiner, Michal Koutný

Since commit ad67b74d2469d ("printk: hash addresses printed with
%p") pointers are hashed by default and the behaviour can be controller
by `hash_pointers' boot argument.
Removing %pK makes it possible to remove its handling from the library.
The policy on %p is to not introduce new ones.

Since this looks vital to the debugging of cgroups, keep the pointer
output.

Use %p instead %pK.

Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
---
 kernel/cgroup/debug.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/kernel/cgroup/debug.c b/kernel/cgroup/debug.c
index 883347b87842d..7cb862db07206 100644
--- a/kernel/cgroup/debug.c
+++ b/kernel/cgroup/debug.c
@@ -51,7 +51,7 @@ static int current_css_set_read(struct seq_file *seq, void *v)
 	spin_lock_irq(&css_set_lock);
 	cset = task_css_set(current);
 	refcnt = refcount_read(&cset->refcount);
-	seq_printf(seq, "css_set %pK %d", cset, refcnt);
+	seq_printf(seq, "css_set %p %d", cset, refcnt);
 	if (refcnt > cset->nr_tasks)
 		seq_printf(seq, " +%d", refcnt - cset->nr_tasks);
 	seq_puts(seq, "\n");
@@ -125,10 +125,10 @@ static int cgroup_css_links_read(struct seq_file *seq, void *v)
 		 * Print out the proc_cset and threaded_cset relationship
 		 * and highlight difference between refcount and task_count.
 		 */
-		seq_printf(seq, "css_set %pK", cset);
+		seq_printf(seq, "css_set %p", cset);
 		if (rcu_dereference_protected(cset->dom_cset, 1) != cset) {
 			threaded_csets++;
-			seq_printf(seq, "=>%pK", cset->dom_cset);
+			seq_printf(seq, "=>%p", cset->dom_cset);
 		}
 		if (!list_empty(&cset->threaded_csets)) {
 			struct css_set *tcset;
@@ -137,7 +137,7 @@ static int cgroup_css_links_read(struct seq_file *seq, void *v)
 			list_for_each_entry(tcset, &cset->threaded_csets,
 					    threaded_csets_node) {
 				seq_puts(seq, idx ? "," : "<=");
-				seq_printf(seq, "%pK", tcset);
+				seq_printf(seq, "%p", tcset);
 				idx++;
 			}
 		} else {
-- 
2.55.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] cgroup: Use %p for pointer formatting
  2026-09-18 10:48 [PATCH] cgroup: Use %p for pointer formatting Sebastian Andrzej Siewior
@ 2026-09-18 12:59 ` Michal Koutný
  2026-09-18 16:56   ` Sebastian Andrzej Siewior
  2026-09-19  0:12 ` Tejun Heo
  1 sibling, 1 reply; 4+ messages in thread
From: Michal Koutný @ 2026-09-18 12:59 UTC (permalink / raw)
  To: Sebastian Andrzej Siewior; +Cc: cgroups, Tejun Heo, Johannes Weiner

[-- Attachment #1: Type: text/plain, Size: 1023 bytes --]

On Fri, Sep 18, 2026 at 12:48:52PM +0200, Sebastian Andrzej Siewior <bigeasy@linutronix.de> wrote:
> Since commit ad67b74d2469d ("printk: hash addresses printed with
> %p") pointers are hashed by default and the behaviour can be controller
> by `hash_pointers' boot argument.
> The policy on %p is to not introduce new ones.
                %pK  should be here?

I assume it based on:

| This is because %pK checks are done at read() time rather than open()
| ...
| The correct long-term solution is to do the permission checks at
| open() time.

of Documentation/admin-guide/sysctl/kernel.rst-time


<snip>
> Removing %pK makes it possible to remove its handling from the library.

This is also a good sell.
But I see there are a few of them still here and there.

> 
> Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
> ---
>  kernel/cgroup/debug.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
>

Nevertheless,
Acked-by: Michal Koutný <mkoutny@suse.com>

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 265 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] cgroup: Use %p for pointer formatting
  2026-09-18 12:59 ` Michal Koutný
@ 2026-09-18 16:56   ` Sebastian Andrzej Siewior
  0 siblings, 0 replies; 4+ messages in thread
From: Sebastian Andrzej Siewior @ 2026-09-18 16:56 UTC (permalink / raw)
  To: Michal Koutný; +Cc: cgroups, Tejun Heo, Johannes Weiner

On 2026-09-18 14:59:00 [+0200], Michal Koutný wrote:
> On Fri, Sep 18, 2026 at 12:48:52PM +0200, Sebastian Andrzej Siewior <bigeasy@linutronix.de> wrote:
> > Since commit ad67b74d2469d ("printk: hash addresses printed with
> > %p") pointers are hashed by default and the behaviour can be controller
> > by `hash_pointers' boot argument.
> > The policy on %p is to not introduce new ones.
>                 %pK  should be here?

No, %p was intended. By making it %p it is "introducing" it. The "not
introducing new ones" is based on
  https://docs.kernel.org/process/deprecated.html#p-format-specifier

> I assume it based on:
> 
> | This is because %pK checks are done at read() time rather than open()
> | ...
> | The correct long-term solution is to do the permission checks at
> | open() time.
> 
> of Documentation/admin-guide/sysctl/kernel.rst-time

These checks never came. I need to update that file as well…

> <snip>
> > Removing %pK makes it possible to remove its handling from the library.
> 
> This is also a good sell.
> But I see there are a few of them still here and there.

I am working on it ;) I just sent all code patches and networking
has it applied in -next. So it is moving.

> > 
> > Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
> > ---
> >  kernel/cgroup/debug.c | 8 ++++----
> >  1 file changed, 4 insertions(+), 4 deletions(-)
> >
> 
> Nevertheless,
> Acked-by: Michal Koutný <mkoutny@suse.com>

Thank you.

Sebastian

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] cgroup: Use %p for pointer formatting
  2026-09-18 10:48 [PATCH] cgroup: Use %p for pointer formatting Sebastian Andrzej Siewior
  2026-09-18 12:59 ` Michal Koutný
@ 2026-09-19  0:12 ` Tejun Heo
  1 sibling, 0 replies; 4+ messages in thread
From: Tejun Heo @ 2026-09-19  0:12 UTC (permalink / raw)
  To: Sebastian Andrzej Siewior
  Cc: cgroups, Tejun Heo, Johannes Weiner, Michal Koutný

Hello,

Applied to cgroup/for-7.4 with the description reworked to spell out the
policy exception and what changes under kptr_restrict.

Thanks.

--
tejun

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-09-19  0:17 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-09-18 10:48 [PATCH] cgroup: Use %p for pointer formatting Sebastian Andrzej Siewior
2026-09-18 12:59 ` Michal Koutný
2026-09-18 16:56   ` Sebastian Andrzej Siewior
2026-09-19  0:12 ` Tejun Heo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox