Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 711352e2 authored by Lynus Vaz's avatar Lynus Vaz
Browse files

msm: kgsl: Defer the pagetable destroy to a separate thread



The pagetable destroy process requires a mutex, so it must be called
from a context that can sleep. Defer it to a thread that can sleep.

Change-Id: I0e86e0f88223715ac4bb7b8085707d135e79379d
Signed-off-by: default avatarLynus Vaz <lvaz@codeaurora.org>
parent e9e45533
Loading
Loading
Loading
Loading
+13 −4
Original line number Diff line number Diff line
@@ -26,6 +26,17 @@

static void pagetable_remove_sysfs_objects(struct kgsl_pagetable *pagetable);

static void _deferred_destroy(struct work_struct *ws)
{
	struct kgsl_pagetable *pagetable = container_of(ws,
					struct kgsl_pagetable, destroy_ws);

	if (PT_OP_VALID(pagetable, mmu_destroy_pagetable))
		pagetable->pt_ops->mmu_destroy_pagetable(pagetable);

	kfree(pagetable);
}

static void kgsl_destroy_pagetable(struct kref *kref)
{
	struct kgsl_pagetable *pagetable = container_of(kref,
@@ -33,10 +44,7 @@ static void kgsl_destroy_pagetable(struct kref *kref)

	kgsl_mmu_detach_pagetable(pagetable);

	if (PT_OP_VALID(pagetable, mmu_destroy_pagetable))
		pagetable->pt_ops->mmu_destroy_pagetable(pagetable);

	kfree(pagetable);
	kgsl_schedule_work(&pagetable->destroy_ws);
}

static inline void kgsl_put_pagetable(struct kgsl_pagetable *pagetable)
@@ -299,6 +307,7 @@ kgsl_mmu_createpagetableobject(struct kgsl_mmu *mmu, unsigned int name)
	kref_init(&pagetable->refcount);

	spin_lock_init(&pagetable->lock);
	INIT_WORK(&pagetable->destroy_ws, _deferred_destroy);

	pagetable->mmu = mmu;
	pagetable->name = name;
+1 −0
Original line number Diff line number Diff line
@@ -42,6 +42,7 @@ struct kgsl_pagetable {
	struct list_head list;
	unsigned int name;
	struct kobject *kobj;
	struct work_struct destroy_ws;

	struct {
		atomic_t entries;