ANDROID: fix ABI breakage caused by percpu_rw_semaphore changes

percpu_rw_semaphore changes to allow calling percpu_free_rwsem in atomic
context cause ABI breakage. Introduce percpu_free_rwsem_atomic wrapper
and change percpu_rwsem_destroy to use it in order to keep
percpu_rw_semaphore struct intact and fix ABI breakage.

Bug: 161210518
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
Change-Id: I198a6381fb48059f2aaa2ec38b8c1e5e5e936bb0
This commit is contained in:
Suren Baghdasaryan
2021-11-24 07:43:12 -08:00
parent 6971350406
commit a4d26b9a4b
5 changed files with 20 additions and 21 deletions

View File

@@ -275,7 +275,7 @@ static DEFINE_SPINLOCK(destroy_list_lock);
static void destroy_list_workfn(struct work_struct *work)
{
struct percpu_rw_semaphore *sem, *sem2;
struct percpu_rw_semaphore_atomic *sem, *sem2;
LIST_HEAD(to_destroy);
spin_lock(&destroy_list_lock);
@@ -286,14 +286,14 @@ static void destroy_list_workfn(struct work_struct *work)
return;
list_for_each_entry_safe(sem, sem2, &to_destroy, destroy_list_entry) {
percpu_free_rwsem(sem);
percpu_free_rwsem(&sem->rw_sem);
kfree(sem);
}
}
static DECLARE_WORK(destroy_list_work, destroy_list_workfn);
void percpu_rwsem_async_destroy(struct percpu_rw_semaphore *sem)
void percpu_rwsem_async_destroy(struct percpu_rw_semaphore_atomic *sem)
{
spin_lock(&destroy_list_lock);
list_add_tail(&sem->destroy_list_entry, &destroy_list);