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

Commit 1939948f authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "msm: kgsl: Add accounting for memory mapped in userspace"

parents e2fa1179 e58813a8
Loading
Loading
Loading
Loading
+3 −1
Original line number Original line Diff line number Diff line
/* Copyright (c) 2008-2015, The Linux Foundation. All rights reserved.
/* Copyright (c) 2008-2016, The Linux Foundation. All rights reserved.
 *
 *
 * This program is free software; you can redistribute it and/or modify
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
 * it under the terms of the GNU General Public License version 2 and
@@ -147,6 +147,7 @@ struct kgsl_memdesc_ops {
 * @gpuaddr: GPU virtual address
 * @gpuaddr: GPU virtual address
 * @physaddr: Physical address of the memory object
 * @physaddr: Physical address of the memory object
 * @size: Size of the memory object
 * @size: Size of the memory object
 * @mapsize: Size of memory mapped in userspace
 * @priv: Internal flags and settings
 * @priv: Internal flags and settings
 * @sgt: Scatter gather table for allocated pages
 * @sgt: Scatter gather table for allocated pages
 * @ops: Function hooks for the memdesc memory type
 * @ops: Function hooks for the memdesc memory type
@@ -163,6 +164,7 @@ struct kgsl_memdesc {
	uint64_t gpuaddr;
	uint64_t gpuaddr;
	phys_addr_t physaddr;
	phys_addr_t physaddr;
	uint64_t size;
	uint64_t size;
	uint64_t mapsize;
	unsigned int priv;
	unsigned int priv;
	struct sg_table *sgt;
	struct sg_table *sgt;
	struct kgsl_memdesc_ops *ops;
	struct kgsl_memdesc_ops *ops;
+5 −5
Original line number Original line Diff line number Diff line
/* Copyright (c) 2002,2008-2015, The Linux Foundation. All rights reserved.
/* Copyright (c) 2002,2008-2016, The Linux Foundation. All rights reserved.
 *
 *
 * This program is free software; you can redistribute it and/or modify
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
 * it under the terms of the GNU General Public License version 2 and
@@ -144,12 +144,12 @@ static int print_mem_entry(int id, void *ptr, void *data)


	kgsl_get_memory_usage(usage, sizeof(usage), m->flags);
	kgsl_get_memory_usage(usage, sizeof(usage), m->flags);


	seq_printf(s, "%pK %pK %16llu %5d %8s %10s %16s %5d",
	seq_printf(s, "%pK %pK %16llu %5d %8s %10s %16s %5d %16llu",
			(uint64_t *)(uintptr_t) m->gpuaddr,
			(uint64_t *)(uintptr_t) m->gpuaddr,
			(unsigned long *) m->useraddr,
			(unsigned long *) m->useraddr,
			m->size, entry->id, flags,
			m->size, entry->id, flags,
			memtype_str(kgsl_memdesc_usermem_type(m)),
			memtype_str(kgsl_memdesc_usermem_type(m)),
			usage, m->sgt->nents);
			usage, m->sgt->nents, m->mapsize);


	if (entry->metadata[0] != 0)
	if (entry->metadata[0] != 0)
		seq_printf(s, " %s", entry->metadata);
		seq_printf(s, " %s", entry->metadata);
@@ -163,9 +163,9 @@ static int process_mem_print(struct seq_file *s, void *unused)
{
{
	struct kgsl_process_private *private = s->private;
	struct kgsl_process_private *private = s->private;


	seq_printf(s, "%8s %8s %8s %5s %8s %10s %16s %5s\n",
	seq_printf(s, "%16s %16s %16s %5s %8s %10s %16s %5s %16s\n",
		   "gpuaddr", "useraddr", "size", "id", "flags", "type",
		   "gpuaddr", "useraddr", "size", "id", "flags", "type",
		   "usage", "sglen");
		   "usage", "sglen", "mapsize");


	spin_lock(&private->mem_lock);
	spin_lock(&private->mem_lock);
	idr_for_each(&private->mem_idr, print_mem_entry, s);
	idr_for_each(&private->mem_idr, print_mem_entry, s);
+5 −1
Original line number Original line Diff line number Diff line
/* Copyright (c) 2002,2007-2015, The Linux Foundation. All rights reserved.
/* Copyright (c) 2002,2007-2016, The Linux Foundation. All rights reserved.
 *
 *
 * This program is free software; you can redistribute it and/or modify
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
 * it under the terms of the GNU General Public License version 2 and
@@ -385,6 +385,8 @@ static int kgsl_page_alloc_vmfault(struct kgsl_memdesc *memdesc,
			get_page(page);
			get_page(page);
			vmf->page = page;
			vmf->page = page;


			memdesc->mapsize += PAGE_SIZE;

			return 0;
			return 0;
		}
		}


@@ -550,6 +552,8 @@ static int kgsl_contiguous_vmfault(struct kgsl_memdesc *memdesc,
	else if (ret == -EFAULT)
	else if (ret == -EFAULT)
		return VM_FAULT_SIGBUS;
		return VM_FAULT_SIGBUS;


	memdesc->mapsize += PAGE_SIZE;

	return VM_FAULT_NOPAGE;
	return VM_FAULT_NOPAGE;
}
}