drdb: Switch to kvfree_rcu() API
Subsystems (15)
Uladzislau Rezki (Sony)
maintainerPATCH 1/1 drdb: Switch to kvfree_rcu() API
Instead of invoking a synchronize_rcu() to free a pointer after a grace period we can directly make use of new API that does the same but in more efficient way.
TO: Jens Axboe <[email protected]>
TO: Philipp Reisner <[email protected]>
TO: Jason Gunthorpe <[email protected]>
TO: [email protected]
TO: [email protected]
--- drivers/block/drbd/drbd_nl.c | 9 +++------ drivers/block/drbd/drbd_receiver.c | 6 ++---- drivers/block/drbd/drbd_state.c | 3 +-- 3 files changed, 6 insertions(+), 12 deletions(-)
drivers/block/drbd/drbd_nl.c +3 -6
@@ -1679,8 +1679,7 @@ int drbd_adm_disk_opts(struct sk_buff *skb, struct genl_info *info)drbd_send_sync_param (peer_device); } -synchronize_rcu (); -kfree (old_disk_conf); +kvfree_rcu (old_disk_conf);kfree (old_plan);mod_timer (&device->request_timer, jiffies +HZ ); goto success;
@@ -2511,8 +2510,7 @@ int drbd_adm_net_opts(struct sk_buff *skb, struct genl_info *info)mutex_unlock (&connection->resource->conf_update);mutex_unlock (&connection->data.mutex); -synchronize_rcu (); -kfree (old_net_conf); +kvfree_rcu (old_net_conf);if (connection->cstate >=C_WF_REPORT_PARAMS ) {struct drbd_peer_device *peer_device;
@@ -2925,8 +2923,7 @@ int drbd_adm_resize(struct sk_buff *skb, struct genl_info *info) new_disk_conf->disk_size = (sector_t )rs.resize_size;rcu_assign_pointer (device->ldev->disk_conf, new_disk_conf);mutex_unlock (&device->resource->conf_update); -synchronize_rcu (); -kfree (old_disk_conf); +kvfree_rcu (old_disk_conf); new_disk_conf =NULL ; }
drivers/block/drbd/drbd_receiver.c +2 -4
@@ -3799,8 +3799,7 @@ static int receive_protocol(struct drbd_connection *connection, struct packet_indrbd_info (connection,"peer data-integrity-alg: %s\n" , integrity_alg[0 ] ? integrity_alg :"(none)" ); -synchronize_rcu (); -kfree (old_net_conf); +kvfree_rcu (old_net_conf);return 0 ; disconnect_rcu_unlock:
@@ -4168,8 +4167,7 @@ static int receive_sizes(struct drbd_connection *connection, struct packet_inforcu_assign_pointer (device->ldev->disk_conf, new_disk_conf);mutex_unlock (&connection->resource->conf_update); -synchronize_rcu (); -kfree (old_disk_conf); +kvfree_rcu (old_disk_conf);drbd_info (device,"Peer sets u_size to %lu sectors (old: %lu)\n" , (unsigned long )p_usize, (unsigned long )my_usize);
drivers/block/drbd/drbd_state.c +1 -2
@@ -2071,8 +2071,7 @@ static int w_after_conn_state_ch(struct drbd_work *w, int unused)conn_free_crypto (connection);mutex_unlock (&connection->resource->conf_update); -synchronize_rcu (); -kfree (old_conf); +kvfree_rcu (old_conf); }if (ns_max.susp_fen) {
Signature · 1 line
2.30.2
Uladzislau Rezki (Sony)
maintainerPATCH RESEND 1/1 ext4: Replace ext4_kvfree_array_rcu() by kvfree_rcu() API
The ext4_kvfree_array_rcu() function was introduced in order to release some memory after a grace period during resizing of a partition. An object that is freed does not contain any rcu_head filed.
To do so, it requires to allocate some extra memory for a special structure that has an rcu_head filed and pointer one where a freed memory is attached. Finally call_rcu() API is invoked.
Since we have a single argument of kvfree_rcu() API, we can easily replace all that tricky code by one single call that does the same but in more efficient way.
TO: "Theodore Ts'o" <[email protected]>
TO: [email protected]
--- fs/ext4/ext4.h | 1 - fs/ext4/mballoc.c | 2 +- fs/ext4/resize.c | 31 ++----------------------------- fs/ext4/super.c | 2 +- 4 files changed, 4 insertions(+), 32 deletions(-)
fs/ext4/ext4.h +0 -1
@@ -3089,7 +3089,6 @@ extern int ext4_generic_delete_entry(struct inode *dir,extern bool ext4_empty_dir (struct inode *inode);/* resize.c */ -extern void ext4_kvfree_array_rcu (void *to_free);extern int ext4_group_add (struct super_block *sb,struct ext4_new_group_data *input); extern int ext4_group_extend(struct super_block *sb,
fs/ext4/mballoc.c +1 -1
@@ -3109,7 +3109,7 @@ int ext4_mb_alloc_groupinfo(struct super_block *sb, ext4_group_t ngroups)rcu_assign_pointer (sbi->s_group_info, new_groupinfo); sbi->s_group_info_size = size /sizeof (*sbi->s_group_info);if (old_groupinfo) -ext4_kvfree_array_rcu (old_groupinfo); +kvfree_rcu (old_groupinfo);ext4_debug ("allocated s_groupinfo array for %d meta_bg's\n" , sbi->s_group_info_size);return 0 ;
fs/ext4/resize.c +2 -29
@@ -17,33 +17,6 @@#include "ext4_jbd2.h" -struct ext4_rcu_ptr { -struct rcu_head rcu; -void *ptr; -}; - -static void ext4_rcu_ptr_callback (struct rcu_head *head) -{ -struct ext4_rcu_ptr *ptr; - - ptr = container_of(head, struct ext4_rcu_ptr, rcu); -kvfree (ptr->ptr); -kfree (ptr); -} - -void ext4_kvfree_array_rcu (void *to_free) -{ -struct ext4_rcu_ptr *ptr =kzalloc (sizeof (*ptr),GFP_KERNEL ); - -if (ptr) { - ptr->ptr = to_free; -call_rcu (&ptr->rcu, ext4_rcu_ptr_callback); -return ; - } -synchronize_rcu (); -kvfree (to_free); -} -int ext4_resize_begin (struct super_block *sb) {struct ext4_sb_info *sbi =EXT4_SB (sb);
@@ -906,7 +879,7 @@ static int add_new_gdb(handle_t *handle, struct inode *inode, n_group_desc[gdb_num] = gdb_bh;rcu_assign_pointer (EXT4_SB (sb)->s_group_desc, n_group_desc);EXT4_SB (sb)->s_gdb_count++; -ext4_kvfree_array_rcu (o_group_desc); +kvfree_rcu (o_group_desc);lock_buffer (EXT4_SB (sb)->s_sbh);le16_add_cpu (&es->s_reserved_gdt_blocks,-1 );
@@ -969,7 +942,7 @@ static int add_new_gdb_meta_bg(struct super_block *sb,rcu_assign_pointer (EXT4_SB (sb)->s_group_desc, n_group_desc);EXT4_SB (sb)->s_gdb_count++; -ext4_kvfree_array_rcu (o_group_desc); +kvfree_rcu (o_group_desc);return err; }
fs/ext4/super.c +1 -1
@@ -2759,7 +2759,7 @@ int ext4_alloc_flex_bg_array(struct super_block *sb, ext4_group_t ngroup)rcu_assign_pointer (sbi->s_flex_groups, new_groups); sbi->s_flex_groups_allocated = size;if (old_groups) -ext4_kvfree_array_rcu (old_groups); +kvfree_rcu (old_groups);return 0 ; }
Signature · 1 line
2.30.2
Uladzislau Rezki
maintainerRe: [PATCH RESEND] ext4: Replace ext4_kvfree_array_rcu() by kvfree_rcu() API
Quoted 120 lines · Uladzislau Rezki (Sony)
The
ext4_kvfree_array_rcu()function was introduced in order to release some memory after a grace period during resizing of a partition. An object that is freed does not contain anyrcu_headfiled.To do so, it requires to allocate some extra memory for a special structure that has an
rcu_headfiled and pointer one where a freed memory is attached. Finallycall_rcu()API is invoked.Since we have a single argument of
kvfree_rcu()API, we can easily replace all that tricky code by one single call that does the same but in more efficient way.TO: "Theodore Ts'o" <[email protected]>
TO: [email protected]Signed-off-by Uladzislau Rezki (Sony) <[email protected]>--- fs/ext4/ext4.h | 1 - fs/ext4/mballoc.c | 2 +- fs/ext4/resize.c | 31 ++----------------------------- fs/ext4/super.c | 2 +- 4 files changed, 4 insertions(+), 32 deletions(-)fs/ext4/ext4.h +0
-1@@ -3089,7 +3089,6 @@ extern int ext4_generic_delete_entry(struct inode *dir,extern bool ext4_empty_dir (struct inode *inode);/* resize.c */ -extern void ext4_kvfree_array_rcu (void *to_free);extern int ext4_group_add (struct super_block *sb,struct ext4_new_group_data *input); extern int ext4_group_extend(struct super_block *sb,fs/ext4/mballoc.c +1
-1@@ -3109,7 +3109,7 @@ int ext4_mb_alloc_groupinfo(struct super_block *sb, ext4_group_t ngroups)rcu_assign_pointer (sbi->s_group_info, new_groupinfo); sbi->s_group_info_size = size /sizeof (*sbi->s_group_info);if (old_groupinfo) -ext4_kvfree_array_rcu (old_groupinfo); +kvfree_rcu (old_groupinfo);ext4_debug ("allocated s_groupinfo array for %d meta_bg's\n" , sbi->s_group_info_size);return 0 ;fs/ext4/resize.c +2
-29@@ -17,33 +17,6 @@#include "ext4_jbd2.h" -struct ext4_rcu_ptr { -struct rcu_head rcu; -void *ptr; -}; - -static void ext4_rcu_ptr_callback (struct rcu_head *head) -{ -struct ext4_rcu_ptr *ptr; - - ptr = container_of(head, struct ext4_rcu_ptr, rcu); -kvfree (ptr->ptr); -kfree (ptr); -} - -void ext4_kvfree_array_rcu (void *to_free) -{ -struct ext4_rcu_ptr *ptr =kzalloc (sizeof (*ptr),GFP_KERNEL ); - -if (ptr) { - ptr->ptr = to_free; -call_rcu (&ptr->rcu, ext4_rcu_ptr_callback); -return ; - } -synchronize_rcu (); -kvfree (to_free); -} -int ext4_resize_begin (struct super_block *sb) {struct ext4_sb_info *sbi =EXT4_SB (sb);@@ -906,7 +879,7 @@ static int add_new_gdb(handle_t *handle, struct inode *inode, n_group_desc[gdb_num] = gdb_bh;rcu_assign_pointer (EXT4_SB (sb)->s_group_desc, n_group_desc);EXT4_SB (sb)->s_gdb_count++; -ext4_kvfree_array_rcu (o_group_desc); +kvfree_rcu (o_group_desc);lock_buffer (EXT4_SB (sb)->s_sbh);le16_add_cpu (&es->s_reserved_gdt_blocks,-1 );@@ -969,7 +942,7 @@ static int add_new_gdb_meta_bg(struct super_block *sb,rcu_assign_pointer (EXT4_SB (sb)->s_group_desc, n_group_desc);EXT4_SB (sb)->s_gdb_count++; -ext4_kvfree_array_rcu (o_group_desc); +kvfree_rcu (o_group_desc);return err; }fs/ext4/super.c +1
-1@@ -2759,7 +2759,7 @@ int ext4_alloc_flex_bg_array(struct super_block *sb, ext4_group_t ngroup)rcu_assign_pointer (sbi->s_flex_groups, new_groups); sbi->s_flex_groups_allocated = size;if (old_groups) -ext4_kvfree_array_rcu (old_groups); +kvfree_rcu (old_groups);return 0 ; }Signature · 1 line
2.30.2
+ "Theodore Ts'o" <[email protected]>
+ [email protected]
--
Vlad Rezki
Uladzislau Rezki (Sony)
maintainerPATCH RESEND 1/1 ext4: Switch to kvfree_rcu() API
In reply to Uladzislau Rezki (Sony)From: Uladzislau Rezki <[email protected]>
Instead of invoking a synchronize_rcu() to free a pointer after a grace period we can directly make use of new API that does the same but in more efficient way.
TO: "Theodore Ts'o" <[email protected]>
TO: [email protected]
--- fs/ext4/super.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
fs/ext4/super.c +1 -2
@@ -1886,8 +1886,7 @@ static int clear_qf_name(struct super_block *sb, int qtype) return -1; }rcu_assign_pointer (sbi->s_qf_names[qtype],NULL ); -synchronize_rcu (); -kfree (old_qname); +kvfree_rcu (old_qname);return 1 ; }#endif
Signature · 1 line
2.30.2
Uladzislau Rezki
maintainerRe: [PATCH RESEND] ext4: Switch to kvfree_rcu() API
Quoted 30 lines · Uladzislau Rezki (Sony)
From: Uladzislau Rezki <[email protected]>
Instead of invoking a
synchronize_rcu()to free a pointer after a grace period we can directly make use of new API that does the same but in more efficient way.TO: "Theodore Ts'o" <[email protected]>
TO: [email protected]Signed-off-by Uladzislau Rezki <[email protected]>--- fs/ext4/super.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)fs/ext4/super.c +1
-2@@ -1886,8 +1886,7 @@ static int clear_qf_name(struct super_block *sb, int qtype) return -1; }rcu_assign_pointer (sbi->s_qf_names[qtype],NULL ); -synchronize_rcu (); -kfree (old_qname); +kvfree_rcu (old_qname);return 1 ; }#endif Signature · 1 line
2.30.2
+ "Theodore Ts'o" <[email protected]>
+ [email protected]
--
Vlad Rezki
Uladzislau Rezki (Sony)
maintainerPATCH 1/1 fs: nfs: sysfs: Switch to kvfree_rcu() API
In reply to Uladzislau Rezki (Sony)From: Uladzislau Rezki <[email protected]>
Instead of invoking a synchronize_rcu() to free a pointer after a grace period we can directly make use of new API that does the same but in more efficient way.
TO: Trond Myklebust <[email protected]>
TO: [email protected]
--- fs/nfs/sysfs.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)
fs/nfs/sysfs.c +3 -4
@@ -113,10 +113,9 @@ static ssize_t nfs_netns_identifier_store(struct kobject *kobj,if (!p)return -ENOMEM ; old =rcu_dereference_protected (xchg (&c->identifier, (char __rcu *)p),1 ); -if (old) { -synchronize_rcu (); -kfree (old); - } +if (old) +kvfree_rcu (old); +return count; }
Signature · 1 line
2.30.2
Uladzislau Rezki
maintainerRe: [PATCH] fs: nfs: sysfs: Switch to kvfree_rcu() API
Quoted 34 lines · Uladzislau Rezki (Sony)
From: Uladzislau Rezki <[email protected]>
Instead of invoking a
synchronize_rcu()to free a pointer after a grace period we can directly make use of new API that does the same but in more efficient way.TO: Trond Myklebust <[email protected]>
TO: [email protected]Signed-off-by Uladzislau Rezki <[email protected]>--- fs/nfs/sysfs.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)fs/nfs/sysfs.c +3
-4@@ -113,10 +113,9 @@ static ssize_t nfs_netns_identifier_store(struct kobject *kobj,if (!p)return -ENOMEM ; old =rcu_dereference_protected (xchg (&c->identifier, (char __rcu *)p),1 ); -if (old) { -synchronize_rcu (); -kfree (old); - } +if (old) +kvfree_rcu (old); +return count; }Signature · 1 line
2.30.2
+ Trond Myklebust <[email protected]>
+ [email protected]
--
Vlad Rezki
Uladzislau Rezki (Sony)
maintainerPATCH 1/1 mfd: dln2: Switch to kvfree_rcu() API
In reply to Uladzislau Rezki (Sony)Instead of invoking a synchronize_rcu() to free a pointer after a grace period we can directly make use of new API that does the same but in more efficient way.
TO: Lee Jones <[email protected]>
TO: Mike Marciniszyn <[email protected]>
--- drivers/mfd/dln2.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/mfd/dln2.c +2 -4
@@ -179,10 +179,8 @@ void dln2_unregister_event_cb(struct platform_device *pdev, u16 id)spin_unlock_irqrestore (&dln2->event_cb_lock, flags); -if (found) { -synchronize_rcu (); -kfree (i); - } +if (found) +kvfree_rcu (i); }EXPORT_SYMBOL (dln2_unregister_event_cb);
Signature · 1 line
2.30.2
Uladzislau Rezki
maintainerRe: [PATCH] mfd: dln2: Switch to kvfree_rcu() API
Quoted 31 lines · Uladzislau Rezki (Sony)
Instead of invoking a
synchronize_rcu()to free a pointer after a grace period we can directly make use of new API that does the same but in more efficient way.TO: Lee Jones <[email protected]>
TO: Mike Marciniszyn <[email protected]>Signed-off-by Uladzislau Rezki (Sony) <[email protected]>--- drivers/mfd/dln2.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)drivers/mfd/dln2.c +2
-4@@ -179,10 +179,8 @@ void dln2_unregister_event_cb(struct platform_device *pdev, u16 id)spin_unlock_irqrestore (&dln2->event_cb_lock, flags); -if (found) { -synchronize_rcu (); -kfree (i); - } +if (found) +kvfree_rcu (i); }EXPORT_SYMBOL (dln2_unregister_event_cb);Signature · 1 line
2.30.2
+ Lee Jones <[email protected]>
+ Mike Marciniszyn <[email protected]>
--
Vlad Rezki
Re: [PATCH] mfd: dln2: Switch to kvfree_rcu() API
Quoted 20 lines · Uladzislau Rezki
Quoted 19 lines · Uladzislau Rezki (Sony)
Instead of invoking a
synchronize_rcu()to free a pointer after a grace period we can directly make use of new API that does the same but in more efficient way.TO: Lee Jones <[email protected]>
TO: Mike Marciniszyn <[email protected]>Signed-off-by Uladzislau Rezki (Sony) <[email protected]>--- drivers/mfd/dln2.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)drivers/mfd/dln2.c +0
-0@@ -179,10 +179,8 @@ void dln2_unregister_event_cb(struct platform_device *pdev, u16 id)spin_unlock_irqrestore (&dln2->event_cb_lock, flags);
Quoted 11 lines
drivers/mfd/dln2.c void dln2_unregister_event_cb(struct platform_device *pdev, u16 id) · line 186
Quoted 9 lines
drivers/mfd/dln2.c +2
-4-if (found) { -synchronize_rcu (); -kfree (i); - } +if (found) +kvfree_rcu (i); }EXPORT_SYMBOL (dln2_unregister_event_cb);+ Lee Jones <[email protected]>
+ Mike Marciniszyn <[email protected]>
I can't do anything with this.
Send it properly please.
Signature · 4 lines
Lee Jones [李琼斯] Senior Technical Lead - Developer Services Linaro.org │ Open source software for Arm SoCs Follow Linaro: Facebook | Twitter | Blog
Uladzislau Rezki
maintainerRe: [PATCH] mfd: dln2: Switch to kvfree_rcu() API
Quoted 35 lines · Lee Jones
Quoted 20 lines · Uladzislau Rezki
Quoted 19 lines · Uladzislau Rezki (Sony)
Instead of invoking a
synchronize_rcu()to free a pointer after a grace period we can directly make use of new API that does the same but in more efficient way.TO: Lee Jones <[email protected]>
TO: Mike Marciniszyn <[email protected]>Signed-off-by Uladzislau Rezki (Sony) <[email protected]>--- drivers/mfd/dln2.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)drivers/mfd/dln2.c +0
-0@@ -179,10 +179,8 @@ void dln2_unregister_event_cb(struct platform_device *pdev, u16 id)spin_unlock_irqrestore (&dln2->event_cb_lock, flags);Quoted 11 lines
drivers/mfd/dln2.c void dln2_unregister_event_cb(struct platform_device *pdev, u16 id) · line 186
Quoted 9 lines
drivers/mfd/dln2.c +2
-4-if (found) { -synchronize_rcu (); -kfree (i); - } +if (found) +kvfree_rcu (i); }EXPORT_SYMBOL (dln2_unregister_event_cb);+ Lee Jones <[email protected]>
+ Mike Marciniszyn <[email protected]>
Quoted 4 lines
I can't do anything with this.
Send it properly please.
I got. Will do.
Thanks!
Signature · 1 line
Uladzislau Rezki
Uladzislau Rezki (Sony)
maintainerPATCH 1/1 misc: vmw_vmci: Switch to kvfree_rcu() API
In reply to Uladzislau Rezki (Sony)Instead of invoking a synchronize_rcu() to free a pointer after a grace period we can directly make use of new API that does the same but in more efficient way.
CC: Greg Kroah-Hartman <[email protected]>
TO: Jorgen Hansen <[email protected]>
TO: Vishnu Dasa <[email protected]>
TO: [email protected]
--- drivers/misc/vmw_vmci/vmci_context.c | 6 ++---- drivers/misc/vmw_vmci/vmci_event.c | 3 +-- 2 files changed, 3 insertions(+), 6 deletions(-)
drivers/misc/vmw_vmci/vmci_context.c +2 -4
@@ -687,10 +687,8 @@ int vmci_ctx_remove_notification(u32 context_id, u32 remote_cid) }spin_unlock (&context->lock); -if (found) { -synchronize_rcu (); -kfree (notifier); - } +if (found) +kvfree_rcu (notifier);vmci_ctx_put (context);
drivers/misc/vmw_vmci/vmci_event.c +1 -2
@@ -209,8 +209,7 @@ int vmci_event_unsubscribe(u32 sub_id)if (!s)return VMCI_ERROR_NOT_FOUND ; -synchronize_rcu (); -kfree (s); +kvfree_rcu (s);return VMCI_SUCCESS ; }
Signature · 1 line
2.30.2
Uladzislau Rezki
maintainerRe: [PATCH] misc: vmw_vmci: Switch to kvfree_rcu() API
Quoted 49 lines · Uladzislau Rezki (Sony)
Instead of invoking a
synchronize_rcu()to free a pointer after a grace period we can directly make use of new API that does the same but in more efficient way.CC: Greg Kroah-Hartman <[email protected]>
TO: Jorgen Hansen <[email protected]>
TO: Vishnu Dasa <[email protected]>
TO: [email protected]Signed-off-by Uladzislau Rezki (Sony) <[email protected]>--- drivers/misc/vmw_vmci/vmci_context.c | 6 ++---- drivers/misc/vmw_vmci/vmci_event.c | 3 +-- 2 files changed, 3 insertions(+), 6 deletions(-)drivers/misc/vmw_vmci/vmci_context.c +2
-4@@ -687,10 +687,8 @@ int vmci_ctx_remove_notification(u32 context_id, u32 remote_cid) }spin_unlock (&context->lock); -if (found) { -synchronize_rcu (); -kfree (notifier); - } +if (found) +kvfree_rcu (notifier);vmci_ctx_put (context);drivers/misc/vmw_vmci/vmci_event.c +1
-2@@ -209,8 +209,7 @@ int vmci_event_unsubscribe(u32 sub_id)if (!s)return VMCI_ERROR_NOT_FOUND ; -synchronize_rcu (); -kfree (s); +kvfree_rcu (s);return VMCI_SUCCESS ; }Signature · 1 line
2.30.2
+ Jorgen Hansen <[email protected]>
+ Vishnu Dasa <[email protected]>
+ [email protected]
--
Vlad Rezki
Uladzislau Rezki (Sony)
maintainerPATCH 1/1 mlxsw: core: Switch to kvfree_rcu() API
In reply to Uladzislau Rezki (Sony)Instead of invoking a synchronize_rcu() to free a pointer after a grace period we can directly make use of new API that does the same but in more efficient way.
TO: David S. Miller <[email protected]>
TO: Jakub Kicinski <[email protected]>
TO: [email protected]
--- drivers/net/ethernet/mellanox/mlxsw/core.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/net/ethernet/mellanox/mlxsw/core.c +1 -2
@@ -2190,8 +2190,7 @@ void mlxsw_core_rx_listener_unregister(struct mlxsw_core *mlxsw_core,if (!rxl_item)return ;list_del_rcu (&rxl_item->list); -synchronize_rcu (); -kfree (rxl_item); +kvfree_rcu (rxl_item); }EXPORT_SYMBOL (mlxsw_core_rx_listener_unregister);
Signature · 1 line
2.30.2
Uladzislau Rezki
maintainerRe: [PATCH] mlxsw: core: Switch to kvfree_rcu() API
Quoted 29 lines · Uladzislau Rezki (Sony)
Instead of invoking a
synchronize_rcu()to free a pointer after a grace period we can directly make use of new API that does the same but in more efficient way.TO: David S. Miller <[email protected]>
TO: Jakub Kicinski <[email protected]>
TO: [email protected]Signed-off-by Uladzislau Rezki (Sony) <[email protected]>--- drivers/net/ethernet/mellanox/mlxsw/core.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)drivers/net/ethernet/mellanox/mlxsw/core.c +1
-2@@ -2190,8 +2190,7 @@ void mlxsw_core_rx_listener_unregister(struct mlxsw_core *mlxsw_core,if (!rxl_item)return ;list_del_rcu (&rxl_item->list); -synchronize_rcu (); -kfree (rxl_item); +kvfree_rcu (rxl_item); }EXPORT_SYMBOL (mlxsw_core_rx_listener_unregister);Signature · 1 line
2.30.2
+ David S. Miller <[email protected]>
+ Jakub Kicinski <[email protected]>
+ [email protected]
--
Vlad Rezki
Jakub Kicinski
maintainerRe: [PATCH] mlxsw: core: Switch to kvfree_rcu() API
Quoted 22 lines · On Wed, 15 Dec 2021 20:46:34 +0100 Uladzislau Rezki wrote:
Quoted 21 lines · Uladzislau Rezki (Sony)
Instead of invoking a
synchronize_rcu()to free a pointer after a grace period we can directly make use of new API that does the same but in more efficient way.TO: David S. Miller <[email protected]>
TO: Jakub Kicinski <[email protected]>
TO: [email protected]Signed-off-by Uladzislau Rezki (Sony) <[email protected]>--- drivers/net/ethernet/mellanox/mlxsw/core.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)drivers/net/ethernet/mellanox/mlxsw/core.c +0
-1@@ -2190,8 +2190,7 @@ void mlxsw_core_rx_listener_unregister(struct mlxsw_core *mlxsw_core,if (!rxl_item)return ;list_del_rcu (&rxl_item->list); -synchronize_rcu ();
Quoted 8 lines
drivers/net/ethernet/mellanox/mlxsw/core.c void mlxsw_core_rx_listener_unregister(struct mlxsw_core *mlxsw_core, · line 2195
Quoted 4 lines
drivers/net/ethernet/mellanox/mlxsw/core.c +1
-1-kfree (rxl_item); +kvfree_rcu (rxl_item); }EXPORT_SYMBOL (mlxsw_core_rx_listener_unregister);+ David S. Miller <[email protected]>
+ Jakub Kicinski <[email protected]>
+ [email protected]
Impressive CC list. Please make a fresh posting to netdev@ and use ./scripts/get_maintainer.pl.
Uladzislau Rezki (Sony)
maintainerPATCH 1/1 RDMA/hfi1: Switch to kvfree_rcu() API
In reply to Uladzislau Rezki (Sony)Instead of invoking a synchronize_rcu() to free a pointer after a grace period we can directly make use of new API that does the same but in more efficient way.
TO: [email protected]
TO: Jason Gunthorpe <[email protected]>
TO: Mike Marciniszyn <[email protected]>
--- drivers/infiniband/hw/hfi1/sdma.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/infiniband/hw/hfi1/sdma.c +1 -2
@@ -1292,8 +1292,7 @@ void sdma_clean(struct hfi1_devdata *dd, size_t num_engines)sdma_map_free (rcu_access_pointer (dd->sdma_map));RCU_INIT_POINTER (dd->sdma_map,NULL );spin_unlock_irq (&dd->sde_map_lock); -synchronize_rcu (); -kfree (dd->per_sdma); +kvfree_rcu (dd->per_sdma); dd->per_sdma =NULL ;if (dd->sdma_rht) {
Signature · 1 line
2.30.2
Uladzislau Rezki
maintainerRe: [PATCH] RDMA/hfi1: Switch to kvfree_rcu() API
Quoted 30 lines · Uladzislau Rezki (Sony)
Instead of invoking a
synchronize_rcu()to free a pointer after a grace period we can directly make use of new API that does the same but in more efficient way.TO: [email protected]
TO: Jason Gunthorpe <[email protected]>
TO: Mike Marciniszyn <[email protected]>Acked-by Mike Marciniszyn <[email protected]>Signed-off-by Uladzislau Rezki (Sony) <[email protected]>--- drivers/infiniband/hw/hfi1/sdma.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)drivers/infiniband/hw/hfi1/sdma.c +1
-2@@ -1292,8 +1292,7 @@ void sdma_clean(struct hfi1_devdata *dd, size_t num_engines)sdma_map_free (rcu_access_pointer (dd->sdma_map));RCU_INIT_POINTER (dd->sdma_map,NULL );spin_unlock_irq (&dd->sde_map_lock); -synchronize_rcu (); -kfree (dd->per_sdma); +kvfree_rcu (dd->per_sdma); dd->per_sdma =NULL ;if (dd->sdma_rht) {Signature · 1 line
2.30.2
+ [email protected]
+ Jason Gunthorpe <[email protected]>
+ Mike Marciniszyn <[email protected]>
--
Vlad Rezki
Jason Gunthorpe
maintainerRe: [PATCH] RDMA/hfi1: Switch to kvfree_rcu() API
Quoted 25 lines · Uladzislau Rezki
Quoted 24 lines · Uladzislau Rezki (Sony)
Instead of invoking a
synchronize_rcu()to free a pointer after a grace period we can directly make use of new API that does the same but in more efficient way.TO: [email protected]
TO: Jason Gunthorpe <[email protected]>
TO: Mike Marciniszyn <[email protected]>Acked-by Mike Marciniszyn <[email protected]>Signed-off-by Uladzislau Rezki (Sony) <[email protected]>drivers/infiniband/hw/hfi1/sdma.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)drivers/infiniband/hw/hfi1/sdma.c +2
-2+++ b/drivers/infiniband/hw/hfi1/sdma.c@@ -1292,8 +1292,7 @@ void sdma_clean(struct hfi1_devdata *dd, size_t num_engines)sdma_map_free (rcu_access_pointer (dd->sdma_map));RCU_INIT_POINTER (dd->sdma_map,NULL );spin_unlock_irq (&dd->sde_map_lock); -synchronize_rcu (); -kfree (dd->per_sdma); +kvfree_rcu (dd->per_sdma); dd->per_sdma =NULL ;
Quoted 4 lines
drivers/infiniband/hw/hfi1/sdma.c void sdma_clean(struct hfi1_devdata *dd, size_t num_engines) · line 1298
Quoted 1 line
drivers/infiniband/hw/hfi1/sdma.c +0
-0if (dd->sdma_rht) {+ [email protected]
+ Jason Gunthorpe <[email protected]>
+ Mike Marciniszyn <[email protected]>
If it is not in the rdma patchworks it won't get applied..
https://patchwork.kernel.org/project/linux-rdma/list/
Jason
Uladzislau Rezki
maintainerRe: [PATCH] RDMA/hfi1: Switch to kvfree_rcu() API
Quoted 27 lines · Jason Gunthorpe
Quoted 25 lines · Uladzislau Rezki
Quoted 24 lines · Uladzislau Rezki (Sony)
Instead of invoking a
synchronize_rcu()to free a pointer after a grace period we can directly make use of new API that does the same but in more efficient way.TO: [email protected]
TO: Jason Gunthorpe <[email protected]>
TO: Mike Marciniszyn <[email protected]>Acked-by Mike Marciniszyn <[email protected]>Signed-off-by Uladzislau Rezki (Sony) <[email protected]>drivers/infiniband/hw/hfi1/sdma.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)drivers/infiniband/hw/hfi1/sdma.c +2
-2+++ b/drivers/infiniband/hw/hfi1/sdma.c@@ -1292,8 +1292,7 @@ void sdma_clean(struct hfi1_devdata *dd, size_t num_engines)sdma_map_free (rcu_access_pointer (dd->sdma_map));RCU_INIT_POINTER (dd->sdma_map,NULL );spin_unlock_irq (&dd->sde_map_lock); -synchronize_rcu (); -kfree (dd->per_sdma); +kvfree_rcu (dd->per_sdma); dd->per_sdma =NULL ;
Quoted 9 lines
Quoted 4 lines
drivers/infiniband/hw/hfi1/sdma.c void sdma_clean(struct hfi1_devdata *dd, size_t num_engines) · line 1298
Quoted 1 line
drivers/infiniband/hw/hfi1/sdma.c +0
-0if (dd->sdma_rht) {+ [email protected]
+ Jason Gunthorpe <[email protected]>
+ Mike Marciniszyn <[email protected]>If it is not in the rdma patchworks it won't get applied..
Do you mean that i should:
instead?
Thanks!
Signature · 1 line
Uladzislau Rezki
Uladzislau Rezki (Sony)
maintainerPATCH 1/1 scsi: core: Switch to kvfree_rcu() API
In reply to Uladzislau Rezki (Sony)Instead of invoking a synchronize_rcu() to free a pointer after a grace period we can directly make use of new API that does the same but in more efficient way.
TO: James E.J. Bottomley <[email protected]>
TO: Martin K. Petersen <[email protected]>
TO: [email protected]
--- drivers/scsi/device_handler/scsi_dh_alua.c | 3 +-- drivers/scsi/device_handler/scsi_dh_rdac.c | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-)
drivers/scsi/device_handler/scsi_dh_alua.c +1 -2
@@ -1238,8 +1238,7 @@ static void alua_bus_detach(struct scsi_device *sdev)kref_put (&pg->kref, release_port_group); } sdev->handler_data =NULL ; -synchronize_rcu (); -kfree (h); +kvfree_rcu (h); }static struct scsi_device_handler alua_dh = {
drivers/scsi/device_handler/scsi_dh_rdac.c +1 -2
@@ -782,8 +782,7 @@ static void rdac_bus_detach( struct scsi_device *sdev ) }spin_unlock (&list_lock); sdev->handler_data =NULL ; -synchronize_rcu (); -kfree (h); +kvfree_rcu (h); }static struct scsi_device_handler rdac_dh = {
Signature · 1 line
2.30.2
Uladzislau Rezki
maintainerRe: [PATCH] scsi: core: Switch to kvfree_rcu() API
Quoted 44 lines · Uladzislau Rezki (Sony)
Instead of invoking a
synchronize_rcu()to free a pointer after a grace period we can directly make use of new API that does the same but in more efficient way.TO: James E.J. Bottomley <[email protected]>
TO: Martin K. Petersen <[email protected]>
TO: [email protected]Signed-off-by Uladzislau Rezki (Sony) <[email protected]>--- drivers/scsi/device_handler/scsi_dh_alua.c | 3 +-- drivers/scsi/device_handler/scsi_dh_rdac.c | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-)drivers/scsi/device_handler/scsi_dh_alua.c +1
-2@@ -1238,8 +1238,7 @@ static void alua_bus_detach(struct scsi_device *sdev)kref_put (&pg->kref, release_port_group); } sdev->handler_data =NULL ; -synchronize_rcu (); -kfree (h); +kvfree_rcu (h); }static struct scsi_device_handler alua_dh = {drivers/scsi/device_handler/scsi_dh_rdac.c +1
-2@@ -782,8 +782,7 @@ static void rdac_bus_detach( struct scsi_device *sdev ) }spin_unlock (&list_lock); sdev->handler_data =NULL ; -synchronize_rcu (); -kfree (h); +kvfree_rcu (h); }static struct scsi_device_handler rdac_dh = {Signature · 1 line
2.30.2
+ James E.J. Bottomley <[email protected]>
+ Martin K. Petersen <[email protected]>
+ [email protected]
--
Vlad Rezki
Uladzislau Rezki
maintainerQuoted 91 lines · Uladzislau Rezki (Sony)
Instead of invoking a
synchronize_rcu()to free a pointer after a grace period we can directly make use of new API that does the same but in more efficient way.TO: Jens Axboe <[email protected]>
TO: Philipp Reisner <[email protected]>
TO: Jason Gunthorpe <[email protected]>
TO: [email protected]
TO: [email protected]Signed-off-by Uladzislau Rezki (Sony) <[email protected]>--- drivers/block/drbd/drbd_nl.c | 9 +++------ drivers/block/drbd/drbd_receiver.c | 6 ++---- drivers/block/drbd/drbd_state.c | 3 +-- 3 files changed, 6 insertions(+), 12 deletions(-)drivers/block/drbd/drbd_nl.c +3
-6@@ -1679,8 +1679,7 @@ int drbd_adm_disk_opts(struct sk_buff *skb, struct genl_info *info)drbd_send_sync_param (peer_device); } -synchronize_rcu (); -kfree (old_disk_conf); +kvfree_rcu (old_disk_conf);kfree (old_plan);mod_timer (&device->request_timer, jiffies +HZ ); goto success;@@ -2511,8 +2510,7 @@ int drbd_adm_net_opts(struct sk_buff *skb, struct genl_info *info)mutex_unlock (&connection->resource->conf_update);mutex_unlock (&connection->data.mutex); -synchronize_rcu (); -kfree (old_net_conf); +kvfree_rcu (old_net_conf);if (connection->cstate >=C_WF_REPORT_PARAMS ) {struct drbd_peer_device *peer_device;@@ -2925,8 +2923,7 @@ int drbd_adm_resize(struct sk_buff *skb, struct genl_info *info) new_disk_conf->disk_size = (sector_t )rs.resize_size;rcu_assign_pointer (device->ldev->disk_conf, new_disk_conf);mutex_unlock (&device->resource->conf_update); -synchronize_rcu (); -kfree (old_disk_conf); +kvfree_rcu (old_disk_conf); new_disk_conf =NULL ; }drivers/block/drbd/drbd_receiver.c +2
-4@@ -3799,8 +3799,7 @@ static int receive_protocol(struct drbd_connection *connection, struct packet_indrbd_info (connection,"peer data-integrity-alg: %s\n" , integrity_alg[0 ] ? integrity_alg :"(none)" ); -synchronize_rcu (); -kfree (old_net_conf); +kvfree_rcu (old_net_conf);return 0 ; disconnect_rcu_unlock:@@ -4168,8 +4167,7 @@ static int receive_sizes(struct drbd_connection *connection, struct packet_inforcu_assign_pointer (device->ldev->disk_conf, new_disk_conf);mutex_unlock (&connection->resource->conf_update); -synchronize_rcu (); -kfree (old_disk_conf); +kvfree_rcu (old_disk_conf);drbd_info (device,"Peer sets u_size to %lu sectors (old: %lu)\n" , (unsigned long )p_usize, (unsigned long )my_usize);drivers/block/drbd/drbd_state.c +1
-2@@ -2071,8 +2071,7 @@ static int w_after_conn_state_ch(struct drbd_work *w, int unused)conn_free_crypto (connection);mutex_unlock (&connection->resource->conf_update); -synchronize_rcu (); -kfree (old_conf); +kvfree_rcu (old_conf); }if (ns_max.susp_fen) {Signature · 1 line
2.30.2
+ Jens Axboe <[email protected]>
+ Philipp Reisner <[email protected]>
+ Jason Gunthorpe <[email protected]>
+ [email protected]
+ [email protected]
--
Vlad Rezki