Skip to contentSkip to conversation

checkpatch: Error out if deprecated RCU API used

PATCH In review Joel Fernandes (Google) 2 participants 9 messages Mar 7, 2023

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

PATCH 1/1 checkpatch: Error out if deprecated RCU API used

Single-argument kvfree_rcu() usage is being deprecated [1] [2] as it is error-prone. However, till all users are converted, we would like to introduce checkpatch errors for new patches submitted.

This patch adds support for the same. Tested with a trial patch.

For now, we are only considering usages that don't have compound nesting, for example ignore: kvfree_rcu( (rcu_head_obj), rcu_head_name). This is sufficient as such usages are unlikely.

Once all users are converted and we remove the old API, we can also revert this checkpatch patch then.

[1] https://lore.kernel.org/rcu/CAEXW_YRhHaVuq+5f+VgCZM=SF+9xO+QXaxe0yE7oA9iCXK-XPg@mail.gmail.com/
[2] https://lore.kernel.org/rcu/CAEXW_YSY=q2_uaE2qo4XSGjzs4+C102YMVJ7kWwuT5LGmJGGew@mail.gmail.com/

---
 scripts/checkpatch.pl |  9 +++++++++
 1 file changed, 9 insertions(+)
scripts/checkpatch.pl +9 -0
index bd44d12965c9..9da0a3cb1615 100755
@@ -6388,6 +6388,15 @@ sub process {
 			}
 		}
 
+# check for soon-to-be-deprecated single-argument k[v]free_rcu() API
+		if ($line =~ /\bk[v]?free_rcu\s*\([^(]+\)/) {
+			if ($line =~ /\bk[v]?free_rcu\s*\([^,]+\)/) {
+				ERROR("DEPRECATED_API",
+				      "Single-argument k[v]free_rcu() API is deprecated, please call the API with an rcu_head object passed, like: k[v]free_rcu(object_ptr, rcu_head_name);  " . $herecurr);
+			}
+		}
+
+
 # check for unnecessary "Out of Memory" messages
 		if ($line =~ /^\+.*\b$logFunctions\s*\(/ &&
 		    $prevline =~ /^[ \+]\s*if\s*\(\s*(\!\s*|NULL\s*==\s*)?($Lval)(\s*==\s*NULL\s*)?\s*\)/ &&
Signature · 1 line
2.40.0.rc0.216.gc4246ad0f0-goog
maintainer
#1 lore raw
Quoted 4 lines · Joel Fernandes (Google)

Single-argument kvfree_rcu() usage is being deprecated [1] [2] as it is error-prone. However, till all users are converted, we would like to introduce checkpatch errors for new patches submitted.

Quoted 8 lines

This patch adds support for the same. Tested with a trial patch.

For now, we are only considering usages that don't have compound nesting, for example ignore: kvfree_rcu( (rcu_head_obj), rcu_head_name). This is sufficient as such usages are unlikely.

Once all users are converted and we remove the old API, we can also revert this checkpatch patch then.

I think this should be added to the deprecated_apis hash instead

our %deprecated_apis = (

	"synchronize_rcu_bh"			=> "synchronize_rcu",
	"synchronize_rcu_bh_expedited"		=> "synchronize_rcu_expedited",
	"call_rcu_bh"				=> "call_rcu",
	"rcu_barrier_bh"			=> "rcu_barrier",
	"synchronize_sched"			=> "synchronize_rcu",
	"synchronize_sched_expedited"		=> "synchronize_rcu_expedited",
	"call_rcu_sched"			=> "call_rcu",
	"rcu_barrier_sched"			=> "rcu_barrier",
	"get_state_synchronize_sched"		=> "get_state_synchronize_rcu",
	"cond_synchronize_sched"		=> "cond_synchronize_rcu",
	"kmap"					=> "kmap_local_page",
	"kunmap"				=> "kunmap_local",
	"kmap_atomic"				=> "kmap_local_page",
	"kunmap_atomic"				=> "kunmap_local",

);

#2 lore raw
Quoted 32 lines · Joe Perches
Quoted 4 lines · Joel Fernandes (Google)

Single-argument kvfree_rcu() usage is being deprecated [1] [2] as it is error-prone. However, till all users are converted, we would like to introduce checkpatch errors for new patches submitted.

Quoted 8 lines

This patch adds support for the same. Tested with a trial patch.

For now, we are only considering usages that don't have compound nesting, for example ignore: kvfree_rcu( (rcu_head_obj), rcu_head_name). This is sufficient as such usages are unlikely.

Once all users are converted and we remove the old API, we can also revert this checkpatch patch then.

I think this should be added to the deprecated_apis hash instead

our %deprecated_apis = (

        "synchronize_rcu_bh"                    => "synchronize_rcu",
        "synchronize_rcu_bh_expedited"          => "synchronize_rcu_expedited",
        "call_rcu_bh"                           => "call_rcu",
        "rcu_barrier_bh"                        => "rcu_barrier",
        "synchronize_sched"                     => "synchronize_rcu",
        "synchronize_sched_expedited"           => "synchronize_rcu_expedited",
        "call_rcu_sched"                        => "call_rcu",
        "rcu_barrier_sched"                     => "rcu_barrier",
        "get_state_synchronize_sched"           => "get_state_synchronize_rcu",
        "cond_synchronize_sched"                => "cond_synchronize_rcu",
        "kmap"                                  => "kmap_local_page",
        "kunmap"                                => "kunmap_local",
        "kmap_atomic"                           => "kmap_local_page",
        "kunmap_atomic"                         => "kunmap_local",
Quoted 1 line

);

This is not an API name change though, it is a "number of arguments" or argument list change. Is there a different way to do it?

thanks,

- Joel

maintainer
#3 lore raw
Quoted 35 lines · Joel Fernandes
Quoted 32 lines · Joe Perches
Quoted 4 lines · Joel Fernandes (Google)

Single-argument kvfree_rcu() usage is being deprecated [1] [2] as it is error-prone. However, till all users are converted, we would like to introduce checkpatch errors for new patches submitted.

Quoted 8 lines

This patch adds support for the same. Tested with a trial patch.

For now, we are only considering usages that don't have compound nesting, for example ignore: kvfree_rcu( (rcu_head_obj), rcu_head_name). This is sufficient as such usages are unlikely.

Once all users are converted and we remove the old API, we can also revert this checkpatch patch then.

I think this should be added to the deprecated_apis hash instead

our %deprecated_apis = (

        "synchronize_rcu_bh"                    => "synchronize_rcu",
        "synchronize_rcu_bh_expedited"          => "synchronize_rcu_expedited",
        "call_rcu_bh"                           => "call_rcu",
        "rcu_barrier_bh"                        => "rcu_barrier",
        "synchronize_sched"                     => "synchronize_rcu",
        "synchronize_sched_expedited"           => "synchronize_rcu_expedited",
        "call_rcu_sched"                        => "call_rcu",
        "rcu_barrier_sched"                     => "rcu_barrier",
        "get_state_synchronize_sched"           => "get_state_synchronize_rcu",
        "cond_synchronize_sched"                => "cond_synchronize_rcu",
        "kmap"                                  => "kmap_local_page",
        "kunmap"                                => "kunmap_local",
        "kmap_atomic"                           => "kmap_local_page",
        "kunmap_atomic"                         => "kunmap_local",
Quoted 1 line

);

Quoted 2 lines

This is not an API name change though, it is a "number of arguments" or argument list change. Is there a different way to do it?

Ah, no, not really.

btw: I don't see a single use of this call without a comma in the tree.

#4 lore raw
Quoted 36 lines · Joe Perches
Quoted 35 lines · Joel Fernandes
Quoted 33 lines · Joe Perches
Quoted 4 lines · Joel Fernandes (Google)

Single-argument kvfree_rcu() usage is being deprecated [1] [2] as it is error-prone. However, till all users are converted, we would like to introduce checkpatch errors for new patches submitted.

Quoted 8 lines

This patch adds support for the same. Tested with a trial patch.

For now, we are only considering usages that don't have compound nesting, for example ignore: kvfree_rcu( (rcu_head_obj), rcu_head_name). This is sufficient as such usages are unlikely.

Once all users are converted and we remove the old API, we can also revert this checkpatch patch then.

I think this should be added to the deprecated_apis hash instead

our %deprecated_apis = (

        "synchronize_rcu_bh"                    => "synchronize_rcu",
        "synchronize_rcu_bh_expedited"          => "synchronize_rcu_expedited",
        "call_rcu_bh"                           => "call_rcu",
        "rcu_barrier_bh"                        => "rcu_barrier",
        "synchronize_sched"                     => "synchronize_rcu",
        "synchronize_sched_expedited"           => "synchronize_rcu_expedited",
        "call_rcu_sched"                        => "call_rcu",
        "rcu_barrier_sched"                     => "rcu_barrier",
        "get_state_synchronize_sched"           => "get_state_synchronize_rcu",
        "cond_synchronize_sched"                => "cond_synchronize_rcu",
        "kmap"                                  => "kmap_local_page",
        "kunmap"                                => "kunmap_local",
        "kmap_atomic"                           => "kmap_local_page",
        "kunmap_atomic"                         => "kunmap_local",

);

Quoted 7 lines
Quoted 2 lines

This is not an API name change though, it is a "number of arguments" or argument list change. Is there a different way to do it?

Ah, no, not really.

btw: I don't see a single use of this call without a comma in the tree.

Did you look for kvfree_rcu? It is either kvfree_rcu() or kfree_rcu().

thanks,

- Joel

maintainer
#5 lore raw
Quoted 37 lines · Joel Fernandes
Quoted 36 lines · Joe Perches
Quoted 35 lines · Joel Fernandes
Quoted 33 lines · Joe Perches
Quoted 4 lines · Joel Fernandes (Google)

Single-argument kvfree_rcu() usage is being deprecated [1] [2] as it is error-prone. However, till all users are converted, we would like to introduce checkpatch errors for new patches submitted.

Quoted 8 lines

This patch adds support for the same. Tested with a trial patch.

For now, we are only considering usages that don't have compound nesting, for example ignore: kvfree_rcu( (rcu_head_obj), rcu_head_name). This is sufficient as such usages are unlikely.

Once all users are converted and we remove the old API, we can also revert this checkpatch patch then.

I think this should be added to the deprecated_apis hash instead

our %deprecated_apis = (

        "synchronize_rcu_bh"                    => "synchronize_rcu",
        "synchronize_rcu_bh_expedited"          => "synchronize_rcu_expedited",
        "call_rcu_bh"                           => "call_rcu",
        "rcu_barrier_bh"                        => "rcu_barrier",
        "synchronize_sched"                     => "synchronize_rcu",
        "synchronize_sched_expedited"           => "synchronize_rcu_expedited",
        "call_rcu_sched"                        => "call_rcu",
        "rcu_barrier_sched"                     => "rcu_barrier",
        "get_state_synchronize_sched"           => "get_state_synchronize_rcu",
        "cond_synchronize_sched"                => "cond_synchronize_rcu",
        "kmap"                                  => "kmap_local_page",
        "kunmap"                                => "kunmap_local",
        "kmap_atomic"                           => "kmap_local_page",
        "kunmap_atomic"                         => "kunmap_local",

);

Quoted 8 lines
Quoted 6 lines
Quoted 2 lines

This is not an API name change though, it is a "number of arguments" or argument list change. Is there a different way to do it?

Ah, no, not really.

btw: I don't see a single use of this call without a comma in the tree.

Did you look for kvfree_rcu? It is either kvfree_rcu() or kfree_rcu().

$ git grep -P '\bkv?free_rcu\s*\(' -- '*.[ch]' | grep -v -P 'kv?free_rcu\s*\([^,]+,.*\)'
drivers/infiniband/core/device.c:		kfree_rcu(container_of(dev->port_data, struct ib_port_data_rcu,
drivers/infiniband/core/rdma_core.c:	 * kfree_rcu(). However the object may still have been released and
drivers/target/target_core_configfs.c:			 * callbacks to complete post kfree_rcu(), before allowing
include/linux/rcupdate.h: *     kvfree_rcu(ptr);
include/linux/rcupdate.h:#define kvfree_rcu(...) KVFREE_GET_MACRO(__VA_ARGS__,		\
include/linux/rcutiny.h:	// kvfree_rcu(one_arg) call.
include/rdma/ib_verbs.h:	struct rcu_head		rcu;		/* kfree_rcu() overhead */
include/scsi/scsi_device.h: * @rcu: For kfree_rcu().
kernel/rcu/rcuscale.c:		pr_alert("CONFIG_RCU_LAZY is disabled, falling back to kfree_rcu() for delayed RCU kfree'ing\n");
kernel/rcu/tree.c: * struct kvfree_rcu_bulk_data - single block to store kvfree_rcu() pointers
kernel/rcu/tree.c: * @records: Array of the kvfree_rcu() pointers
kernel/rcu/tree.c: * struct kfree_rcu_cpu_work - single batch of kfree_rcu() requests
kernel/rcu/tree.c: * @head_free: List of kfree_rcu() objects waiting for a grace period
kernel/rcu/tree.c: * @bulk_head_free: Bulk-List of kvfree_rcu() objects waiting for a grace period
kernel/rcu/tree.c: * struct kfree_rcu_cpu - batch up kfree_rcu() requests for RCU grace period
kernel/rcu/tree.c: * @head: List of kfree_rcu() objects not yet waiting for a grace period
kernel/rcu/tree.c: * @bulk_head: Bulk-List of kvfree_rcu() objects not yet waiting for a grace period
kernel/rcu/tree.c: * @krw_arr: Array of batches of kfree_rcu() objects waiting for a grace period
kernel/rcu/tree.c:	 * double-argument of kvfree_rcu().  This happens when the
kernel/rcu/tree.c: * reduce the number of grace periods during heavy kfree_rcu()/kvfree_rcu() load.
kernel/rcu/tree.c:		// Probable double kfree_rcu(), just leak.
net/core/pktgen.c:	/* Don't need rcu_barrier() due to use of kfree_rcu() */
#6 lore raw
Quoted 63 lines · Joe Perches
Quoted 37 lines · Joel Fernandes
Quoted 36 lines · Joe Perches
Quoted 35 lines · Joel Fernandes
Quoted 33 lines · Joe Perches
Quoted 4 lines · Joel Fernandes (Google)

Single-argument kvfree_rcu() usage is being deprecated [1] [2] as it is error-prone. However, till all users are converted, we would like to introduce checkpatch errors for new patches submitted.

Quoted 8 lines

This patch adds support for the same. Tested with a trial patch.

For now, we are only considering usages that don't have compound nesting, for example ignore: kvfree_rcu( (rcu_head_obj), rcu_head_name). This is sufficient as such usages are unlikely.

Once all users are converted and we remove the old API, we can also revert this checkpatch patch then.

I think this should be added to the deprecated_apis hash instead

our %deprecated_apis = (

        "synchronize_rcu_bh"                    => "synchronize_rcu",
        "synchronize_rcu_bh_expedited"          => "synchronize_rcu_expedited",
        "call_rcu_bh"                           => "call_rcu",
        "rcu_barrier_bh"                        => "rcu_barrier",
        "synchronize_sched"                     => "synchronize_rcu",
        "synchronize_sched_expedited"           => "synchronize_rcu_expedited",
        "call_rcu_sched"                        => "call_rcu",
        "rcu_barrier_sched"                     => "rcu_barrier",
        "get_state_synchronize_sched"           => "get_state_synchronize_rcu",
        "cond_synchronize_sched"                => "cond_synchronize_rcu",
        "kmap"                                  => "kmap_local_page",
        "kunmap"                                => "kunmap_local",
        "kmap_atomic"                           => "kmap_local_page",
        "kunmap_atomic"                         => "kunmap_local",

);

Quoted 8 lines
Quoted 6 lines
Quoted 2 lines

This is not an API name change though, it is a "number of arguments" or argument list change. Is there a different way to do it?

Ah, no, not really.

btw: I don't see a single use of this call without a comma in the tree.

Did you look for kvfree_rcu? It is either kvfree_rcu() or kfree_rcu().

$ git grep -P '\bkv?free_rcu\s*\(' -- '*.[ch]' | grep -v -P 'kv?free_rcu\s*\([^,]+,.*\)'
drivers/infiniband/core/device.c:               kfree_rcu(container_of(dev->port_data, struct ib_port_data_rcu,
drivers/infiniband/core/rdma_core.c:     * kfree_rcu(). However the object may still have been released and
drivers/target/target_core_configfs.c:                   * callbacks to complete post kfree_rcu(), before allowing
include/linux/rcupdate.h: *     kvfree_rcu(ptr);
include/linux/rcupdate.h:#define kvfree_rcu(...) KVFREE_GET_MACRO(__VA_ARGS__,          \
include/linux/rcutiny.h:        // kvfree_rcu(one_arg) call.
include/rdma/ib_verbs.h:        struct rcu_head         rcu;            /* kfree_rcu() overhead */
include/scsi/scsi_device.h: * @rcu: For kfree_rcu().
kernel/rcu/rcuscale.c:          pr_alert("CONFIG_RCU_LAZY is disabled, falling back to kfree_rcu() for delayed RCU kfree'ing\n");
kernel/rcu/tree.c: * struct kvfree_rcu_bulk_data - single block to store kvfree_rcu() pointers
kernel/rcu/tree.c: * @records: Array of the kvfree_rcu() pointers
kernel/rcu/tree.c: * struct kfree_rcu_cpu_work - single batch of kfree_rcu() requests
kernel/rcu/tree.c: * @head_free: List of kfree_rcu() objects waiting for a grace period
kernel/rcu/tree.c: * @bulk_head_free: Bulk-List of kvfree_rcu() objects waiting for a grace period
Quoted 9 lines
kernel/rcu/tree.c: * struct kfree_rcu_cpu - batch up kfree_rcu() requests for RCU grace period
kernel/rcu/tree.c: * @head: List of kfree_rcu() objects not yet waiting for a grace period
kernel/rcu/tree.c: * @bulk_head: Bulk-List of kvfree_rcu() objects not yet waiting for a grace period
kernel/rcu/tree.c: * @krw_arr: Array of batches of kfree_rcu() objects waiting for a grace period
kernel/rcu/tree.c:       * double-argument of kvfree_rcu().  This happens when the
kernel/rcu/tree.c: * reduce the number of grace periods during heavy kfree_rcu()/kvfree_rcu() load.
kernel/rcu/tree.c:              // Probable double kfree_rcu(), just leak.
net/core/pktgen.c:      /* Don't need rcu_barrier() due to use of kfree_rcu() */

Do you mind sharing which tree you are looking at? I checked both 6.3-rc1 and linux-next.

Your grep returned:

kernel/trace/trace_osnoise.c:   kvfree_rcu(inst);
kernel/trace/trace_probe.c:     kvfree_rcu(link);
lib/test_vmalloc.c:             kvfree_rcu(p);
mm/list_lru.c:   * We need kvfree_rcu() here. And the walking of the list
net/core/pktgen.c:      /* Don't need rcu_barrier() due to use of kfree_rcu() */
net/core/sysctl_net_core.c:
kvfree_rcu(orig_sock_table);
net/core/sysctl_net_core.c:                             kfree_rcu(cur);
net/mac802154/scan.c:   kfree_rcu(request);
net/mac802154/scan.c:   kfree_rcu(request);
maintainer
#7 lore raw
Quoted 5 lines · Joel Fernandes

Do you mind sharing which tree you are looking at? I checked both 6.3-rc1 and linux-next.

Your grep returned:

Quoted 10 lines
kernel/trace/trace_osnoise.c:   kvfree_rcu(inst);
kernel/trace/trace_probe.c:     kvfree_rcu(link);
lib/test_vmalloc.c:             kvfree_rcu(p);
mm/list_lru.c:   * We need kvfree_rcu() here. And the walking of the list
net/core/pktgen.c:      /* Don't need rcu_barrier() due to use of kfree_rcu() */
net/core/sysctl_net_core.c:
kvfree_rcu(orig_sock_table);
net/core/sysctl_net_core.c:                             kfree_rcu(cur);
net/mac802154/scan.c:   kfree_rcu(request);
net/mac802154/scan.c:   kfree_rcu(request);

rather old. I'm not subscribed and haven't been following much.

Add linux-next specific files for 20230217

Updating to today's next:

Add linux-next specific files for 20230307

I get several instances:

$ git grep -P '\bkv?free_rcu\s*\(' -- '*.[ch]' | grep -v -P 'kv?free_rcu\s*\([^,]+,.*\)'
drivers/block/drbd/drbd_nl.c:	kvfree_rcu(old_disk_conf);
drivers/block/drbd/drbd_nl.c:	kvfree_rcu(old_net_conf);
drivers/block/drbd/drbd_nl.c:		kvfree_rcu(old_disk_conf);
drivers/block/drbd/drbd_receiver.c:	kvfree_rcu(old_net_conf);
drivers/block/drbd/drbd_receiver.c:			kvfree_rcu(old_disk_conf);
drivers/block/drbd/drbd_state.c:		kvfree_rcu(old_conf);
drivers/infiniband/core/device.c:		kfree_rcu(container_of(dev->port_data, struct ib_port_data_rcu,
drivers/infiniband/core/rdma_core.c:	 * kfree_rcu(). However the object may still have been released and
drivers/infiniband/sw/rxe/rxe_mr.c:	kfree_rcu(mr);
drivers/misc/vmw_vmci/vmci_context.c:		kvfree_rcu(notifier);
drivers/misc/vmw_vmci/vmci_event.c:	kvfree_rcu(s);
drivers/net/ethernet/mellanox/mlx5/core/en/tc/int_port.c:	kfree_rcu(int_port);
drivers/net/ethernet/mellanox/mlx5/core/en_accel/macsec.c:	kfree_rcu(tx_sa);
drivers/net/ethernet/mellanox/mlx5/core/en_accel/macsec.c:	kfree_rcu(rx_sc);
drivers/target/target_core_configfs.c:			 * callbacks to complete post kfree_rcu(), before allowing
fs/ext4/super.c:				kfree_rcu(qname);
include/linux/rcupdate.h: *     kvfree_rcu(ptr);
include/linux/rcupdate.h:#define kvfree_rcu(...) KVFREE_GET_MACRO(__VA_ARGS__,		\
include/linux/rcutiny.h:	// kvfree_rcu(one_arg) call.
include/rdma/ib_verbs.h:	struct rcu_head		rcu;		/* kfree_rcu() overhead */
include/scsi/scsi_device.h: * @rcu: For kfree_rcu().
kernel/rcu/rcuscale.c:		pr_alert("CONFIG_RCU_LAZY is disabled, falling back to kfree_rcu() for delayed RCU kfree'ing\n");
kernel/rcu/tree.c: * struct kvfree_rcu_bulk_data - single block to store kvfree_rcu() pointers
kernel/rcu/tree.c: * @records: Array of the kvfree_rcu() pointers
kernel/rcu/tree.c: * struct kfree_rcu_cpu_work - single batch of kfree_rcu() requests
kernel/rcu/tree.c: * @head_free: List of kfree_rcu() objects waiting for a grace period
kernel/rcu/tree.c: * @bulk_head_free: Bulk-List of kvfree_rcu() objects waiting for a grace period
kernel/rcu/tree.c: * struct kfree_rcu_cpu - batch up kfree_rcu() requests for RCU grace period
kernel/rcu/tree.c: * @head: List of kfree_rcu() objects not yet waiting for a grace period
kernel/rcu/tree.c: * @bulk_head: Bulk-List of kvfree_rcu() objects not yet waiting for a grace period
kernel/rcu/tree.c: * @krw_arr: Array of batches of kfree_rcu() objects waiting for a grace period
kernel/rcu/tree.c:	 * double-argument of kvfree_rcu().  This happens when the
kernel/rcu/tree.c: * reduce the number of grace periods during heavy kfree_rcu()/kvfree_rcu() load.
kernel/rcu/tree.c:		// Probable double kfree_rcu(), just leak.
kernel/trace/trace_osnoise.c:	kvfree_rcu(inst);
kernel/trace/trace_probe.c:	kvfree_rcu(link);
net/core/pktgen.c:	/* Don't need rcu_barrier() due to use of kfree_rcu() */
net/core/sysctl_net_core.c:				kvfree_rcu(orig_sock_table);
net/core/sysctl_net_core.c:				kfree_rcu(cur);
#8 lore raw
Quoted 19 lines · Joe Perches
Quoted 5 lines · Joel Fernandes

Do you mind sharing which tree you are looking at? I checked both 6.3-rc1 and linux-next.

Your grep returned:

Quoted 10 lines
kernel/trace/trace_osnoise.c:   kvfree_rcu(inst);
kernel/trace/trace_probe.c:     kvfree_rcu(link);
lib/test_vmalloc.c:             kvfree_rcu(p);
mm/list_lru.c:   * We need kvfree_rcu() here. And the walking of the list
net/core/pktgen.c:      /* Don't need rcu_barrier() due to use of kfree_rcu() */
net/core/sysctl_net_core.c:
kvfree_rcu(orig_sock_table);
net/core/sysctl_net_core.c:                             kfree_rcu(cur);
net/mac802154/scan.c:   kfree_rcu(request);
net/mac802154/scan.c:   kfree_rcu(request);
Quoted 3 lines

rather old. I'm not subscribed and haven't been following much.

Add linux-next specific files for 20230217

I am surprised though why you don't see the usage in trace_osnoise.c though because that was added in 2021 (see diff below).

Anyway, I take it you are Ok with the checkpatch patch. If so, do provide your Ack tag in advance. We can push from our side only if needed. There is a chance that we may not need it if we are successful in having made the conversions to the "good API" in time for the next merge window.

kernel/trace/trace_osnoise.c +0 -0
index 7520d43aed55..4719a848bf17 100644
@@ -138,8 +138,7 @@ static void osnoise_unregister_instance(struct

trace_array *tr)

        if (!found)
                return;
-       synchronize_rcu();
-       kfree(inst);
+       kvfree_rcu(inst);

}

/*

Quoted 48 lines

Updating to today's next:

Add linux-next specific files for 20230307

I get several instances:

$ git grep -P '\bkv?free_rcu\s*\(' -- '*.[ch]' | grep -v -P 'kv?free_rcu\s*\([^,]+,.*\)'
drivers/block/drbd/drbd_nl.c:   kvfree_rcu(old_disk_conf);
drivers/block/drbd/drbd_nl.c:   kvfree_rcu(old_net_conf);
drivers/block/drbd/drbd_nl.c:           kvfree_rcu(old_disk_conf);
drivers/block/drbd/drbd_receiver.c:     kvfree_rcu(old_net_conf);
drivers/block/drbd/drbd_receiver.c:                     kvfree_rcu(old_disk_conf);
drivers/block/drbd/drbd_state.c:                kvfree_rcu(old_conf);
drivers/infiniband/core/device.c:               kfree_rcu(container_of(dev->port_data, struct ib_port_data_rcu,
drivers/infiniband/core/rdma_core.c:     * kfree_rcu(). However the object may still have been released and
drivers/infiniband/sw/rxe/rxe_mr.c:     kfree_rcu(mr);
drivers/misc/vmw_vmci/vmci_context.c:           kvfree_rcu(notifier);
drivers/misc/vmw_vmci/vmci_event.c:     kvfree_rcu(s);
drivers/net/ethernet/mellanox/mlx5/core/en/tc/int_port.c:       kfree_rcu(int_port);
drivers/net/ethernet/mellanox/mlx5/core/en_accel/macsec.c:      kfree_rcu(tx_sa);
drivers/net/ethernet/mellanox/mlx5/core/en_accel/macsec.c:      kfree_rcu(rx_sc);
drivers/target/target_core_configfs.c:                   * callbacks to complete post kfree_rcu(), before allowing
fs/ext4/super.c:                                kfree_rcu(qname);
include/linux/rcupdate.h: *     kvfree_rcu(ptr);
include/linux/rcupdate.h:#define kvfree_rcu(...) KVFREE_GET_MACRO(__VA_ARGS__,          \
include/linux/rcutiny.h:        // kvfree_rcu(one_arg) call.
include/rdma/ib_verbs.h:        struct rcu_head         rcu;            /* kfree_rcu() overhead */
include/scsi/scsi_device.h: * @rcu: For kfree_rcu().
kernel/rcu/rcuscale.c:          pr_alert("CONFIG_RCU_LAZY is disabled, falling back to kfree_rcu() for delayed RCU kfree'ing\n");
kernel/rcu/tree.c: * struct kvfree_rcu_bulk_data - single block to store kvfree_rcu() pointers
kernel/rcu/tree.c: * @records: Array of the kvfree_rcu() pointers
kernel/rcu/tree.c: * struct kfree_rcu_cpu_work - single batch of kfree_rcu() requests
kernel/rcu/tree.c: * @head_free: List of kfree_rcu() objects waiting for a grace period
kernel/rcu/tree.c: * @bulk_head_free: Bulk-List of kvfree_rcu() objects waiting for a grace period
kernel/rcu/tree.c: * struct kfree_rcu_cpu - batch up kfree_rcu() requests for RCU grace period
kernel/rcu/tree.c: * @head: List of kfree_rcu() objects not yet waiting for a grace period
kernel/rcu/tree.c: * @bulk_head: Bulk-List of kvfree_rcu() objects not yet waiting for a grace period
kernel/rcu/tree.c: * @krw_arr: Array of batches of kfree_rcu() objects waiting for a grace period
kernel/rcu/tree.c:       * double-argument of kvfree_rcu().  This happens when the
kernel/rcu/tree.c: * reduce the number of grace periods during heavy kfree_rcu()/kvfree_rcu() load.
kernel/rcu/tree.c:              // Probable double kfree_rcu(), just leak.
kernel/trace/trace_osnoise.c:   kvfree_rcu(inst);
kernel/trace/trace_probe.c:     kvfree_rcu(link);
net/core/pktgen.c:      /* Don't need rcu_barrier() due to use of kfree_rcu() */
net/core/sysctl_net_core.c:                             kvfree_rcu(orig_sock_table);
net/core/sysctl_net_core.c:                             kfree_rcu(cur);