static int ion_debug_heap_show(struct seq_file *s, void *unused) { struct ion_heap *heap = s->private; struct ion_device *dev = heap->dev; struct rb_node *n; mutex_lock(&dev->lock); seq_printf(s, "%16.s %16.s %16.s\n", "client", "pid", "size"); for (n = rb_first(&dev->clients); n; n = rb_next(n)) { struct ion_client *client = rb_entry(n, struct ion_client, node); size_t size = ion_debug_heap_total(client, heap->id); if (!size) continue; if (client->task) { char task_comm[TASK_COMM_LEN]; get_task_comm(task_comm, client->task); seq_printf(s, "%16.s %16u %16u\n", task_comm, client->pid, size); } else { seq_printf(s, "%16.s %16u %16u\n", client->name, client->pid, size); } } ion_heap_print_debug(s, heap); mutex_unlock(&dev->lock); return 0; }
static int ion_debug_heap_show(struct seq_file *s, void *unused) { struct ion_heap *heap = s->private; struct ion_device *dev = heap->dev; struct rb_node *n; #if defined(CONFIG_MACH_LGE_L9II_OPEN_EU) mutex_lock(&dev->buffer_lock); #else mutex_lock(&dev->lock); #endif seq_printf(s, "%16.s %16.s %16.s\n", "client", "pid", "size"); for (n = rb_first(&dev->clients); n; n = rb_next(n)) { struct ion_client *client = rb_entry(n, struct ion_client, node); /* yongman.kwon : Remove this code for preventing dead lock status between thread using ion memory. */ #if defined(CONFIG_MACH_LGE_L9II_OPEN_EU) size_t size = ion_debug_heap_total(client, heap->id); #else size_t size = 0; mutex_unlock(&dev->lock); size = ion_debug_heap_total(client, heap->id); mutex_lock(&dev->lock); #endif if (!size) continue; if (client->task) { char task_comm[TASK_COMM_LEN]; get_task_comm(task_comm, client->task); seq_printf(s, "%16.s %16u %16u\n", task_comm, client->pid, size); } else { seq_printf(s, "%16.s %16u %16u\n", client->name, client->pid, size); } } ion_heap_print_debug(s, heap); #if defined(CONFIG_MACH_LGE_L9II_OPEN_EU) mutex_unlock(&dev->buffer_lock); #else mutex_unlock(&dev->lock); #endif return 0; }