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

Commit 30986b3b authored by Chintan Pandya's avatar Chintan Pandya
Browse files

ion: Support an option to allocate buffers in 4KB chunks



For performance profiling, we want to create worst case
scenarios where system is quite fragmented and cannot
allocate buffers in chunks more than 4KB. Enable an
option which forcibly allocates in 4KB chunks only.

Change-Id: I323603de4c0dc04cdf247bf4923b94b8ff4cd9f0
Signed-off-by: default avatarChintan Pandya <cpandya@codeaurora.org>
parent ae969022
Loading
Loading
Loading
Loading
+15 −2
Original line number Diff line number Diff line
@@ -592,6 +592,19 @@ int kgsl_cache_range_op(struct kgsl_memdesc *memdesc, size_t offset,
}
EXPORT_SYMBOL(kgsl_cache_range_op);

#ifndef CONFIG_ALLOC_BUFFERS_IN_4K_CHUNKS
static inline int get_page_size(size_t size, unsigned int align)
{
	return (align >= ilog2(SZ_64K) && size >= SZ_64K)
					? SZ_64K : PAGE_SIZE;
}
#else
static inline int get_page_size(size_t size, unsigned int align)
{
	return PAGE_SIZE;
}
#endif

static int
_kgsl_sharedmem_page_alloc(struct kgsl_memdesc *memdesc,
			struct kgsl_pagetable *pagetable,
@@ -608,8 +621,8 @@ _kgsl_sharedmem_page_alloc(struct kgsl_memdesc *memdesc,

	align = (memdesc->flags & KGSL_MEMALIGN_MASK) >> KGSL_MEMALIGN_SHIFT;

	page_size = (align >= ilog2(SZ_64K) && size >= SZ_64K)
			? SZ_64K : PAGE_SIZE;
	page_size = get_page_size(size, align);

	/* update align flags for what we actually use */
	if (page_size != PAGE_SIZE)
		kgsl_memdesc_set_align(memdesc, ilog2(page_size));
+6 −0
Original line number Diff line number Diff line
@@ -32,7 +32,13 @@
static gfp_t high_order_gfp_flags = (GFP_HIGHUSER | __GFP_ZERO | __GFP_NOWARN |
				     __GFP_NORETRY) & ~__GFP_WAIT;
static gfp_t low_order_gfp_flags  = (GFP_HIGHUSER | __GFP_ZERO | __GFP_NOWARN);

#ifndef CONFIG_ALLOC_BUFFERS_IN_4K_CHUNKS
static const unsigned int orders[] = {9, 8, 4, 0};
#else
static const unsigned int orders[] = {0};
#endif

static const int num_orders = ARRAY_SIZE(orders);
static int order_to_index(unsigned int order)
{