> On Thu, 9 Mar 2023 14:45:21 +0100 > Uladzislau Rezki <urezki@xxxxxxxxx> wrote: > > > > The kvfree_rcu()'s single argument name is deprecated therefore > > > rename it to kvfree_rcu_mightsleep() variant. The goal is explicitly > > > underline that it is for sleepable contexts. > > > > > > Cc: Steven Rostedt (VMware) <rostedt@xxxxxxxxxxx> > > > Signed-off-by: Uladzislau Rezki (Sony) <urezki@xxxxxxxxx> > > > > > Could you please add you reviwed-by or Acked-by tags so we can bring > > our series with renaming for the next merge window? > > I don't know. Perhaps we should just apply this patch and not worry about > sleeping and whatnot. > > -- Steve > > diff --git a/kernel/trace/trace_osnoise.c b/kernel/trace/trace_osnoise.c > index 04f0fdae19a1..5de945a8f61d 100644 > --- a/kernel/trace/trace_osnoise.c > +++ b/kernel/trace/trace_osnoise.c > @@ -76,6 +76,7 @@ static unsigned long osnoise_options = OSN_DEFAULT_OPTIONS; > struct osnoise_instance { > struct list_head list; > struct trace_array *tr; > + struct rcu_head rcu; > }; > > static struct list_head osnoise_instances; > @@ -159,7 +160,7 @@ static void osnoise_unregister_instance(struct trace_array *tr) > if (!found) > return; > > - kvfree_rcu(inst); > + kvfree_rcu(inst, rcu); > } > > /* > diff --git a/kernel/trace/trace_probe.c b/kernel/trace/trace_probe.c > index 20d0c4a97633..ef5fafb40c76 100644 > --- a/kernel/trace/trace_probe.c > +++ b/kernel/trace/trace_probe.c > @@ -1172,7 +1172,7 @@ int trace_probe_remove_file(struct trace_probe *tp, > return -ENOENT; > > list_del_rcu(&link->list); > - kvfree_rcu(link); > + kvfree_rcu(link, rcu); > > if (list_empty(&tp->event->files)) > trace_probe_clear_flag(tp, TP_FLAG_TRACE); > diff --git a/kernel/trace/trace_probe.h b/kernel/trace/trace_probe.h > index ef8ed3b65d05..e6037752dcf0 100644 > --- a/kernel/trace/trace_probe.h > +++ b/kernel/trace/trace_probe.h > @@ -256,6 +256,7 @@ struct trace_probe { > struct event_file_link { > struct trace_event_file *file; > struct list_head list; > + struct rcu_head rcu; > }; > > static inline bool trace_probe_test_flag(struct trace_probe *tp, > struct foo_a { int a; int b; }; your obj size is 8 byte struct foo_b { struct rcu_head rcu; int a; int b; }; now it becomes 16 + 8 = 24 bytes. In reallity a foo_b object will be 32 bytes since there is no slab for 24 bytes: <snip> kmalloc-32 19840 19840 32 128 1 : tunables 0 0 0 : slabdata 155 155 0 kmalloc-16 28857 28928 16 256 1 : tunables 0 0 0 : slabdata 113 113 0 kmalloc-8 37376 37376 8 512 1 : tunables 0 0 0 : slabdata 73 73 0 <snip> if we allocate 512 objects of foo_a it would be 4096 bytes in case of foo_b it is 24 * 512 = 12228 bytes. single argument will give you 4096 + 512 * 8 = 8192 bytes int terms of memory consumtion. And double argument will not give you better performance comparing with a single argument. So it depends on what you want to achieve by that patch. -- Uladzislau Rezki