misc: vmw_vmci: Switch to kvfree_rcu() API
authorUladzislau Rezki (Sony) <urezki@gmail.com>
Wed, 15 Dec 2021 11:18:42 +0000 (12:18 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 21 Dec 2021 09:25:15 +0000 (10:25 +0100)
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.

Signed-off-by: Uladzislau Rezki (Sony) <urezki@gmail.com>
Link: https://lore.kernel.org/r/20211215111845.2514-6-urezki@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/misc/vmw_vmci/vmci_context.c
drivers/misc/vmw_vmci/vmci_event.c

index c0b5e339d5a1d889e90480a537b55addbeafb11a..6cf3e21c760444146b7ff6ebc187000267ecf7af 100644 (file)
@@ -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);
 
index e3436abf39f4585f3a2599fbb620f6e7d3dc73d9..2100297c94ad02ef18c9e06e0f3bd1938d396536 100644 (file)
@@ -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;
 }