lkml.org 
[lkml]   [2021]   [Dec]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH] misc: vmw_vmci: Switch to kvfree_rcu() API
Date
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 <gregkh@linuxfoundation.org>
TO: Jorgen Hansen <jhansen@vmware.com>
TO: Vishnu Dasa <vdasa@vmware.com>
TO: pv-drivers@vmware.com

Signed-off-by: Uladzislau Rezki (Sony) <urezki@gmail.com>
---
drivers/misc/vmw_vmci/vmci_context.c | 6 ++----
drivers/misc/vmw_vmci/vmci_event.c | 3 +--
2 files changed, 3 insertions(+), 6 deletions(-)

diff --git a/drivers/misc/vmw_vmci/vmci_context.c b/drivers/misc/vmw_vmci/vmci_context.c
index c0b5e339d5a1..6cf3e21c7604 100644
--- a/drivers/misc/vmw_vmci/vmci_context.c
+++ b/drivers/misc/vmw_vmci/vmci_context.c
@@ -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);

diff --git a/drivers/misc/vmw_vmci/vmci_event.c b/drivers/misc/vmw_vmci/vmci_event.c
index e3436abf39f4..2100297c94ad 100644
--- a/drivers/misc/vmw_vmci/vmci_event.c
+++ b/drivers/misc/vmw_vmci/vmci_event.c
@@ -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;
}
--
2.30.2
\
 
 \ /
  Last update: 2021-12-15 12:19    [W:0.165 / U:0.088 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site