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

Commit 517cd739 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: Change the shrinker to not free reserved pages"

parents 5e2c16cc e7b78cef
Loading
Loading
Loading
Loading
+11 −3
Original line number Diff line number Diff line
@@ -197,7 +197,7 @@ _kgsl_pool_shrink(struct kgsl_page_pool *pool, int num_pages)
 * starting from higher order pool.
 */
static unsigned long
kgsl_pool_reduce(unsigned int target_pages)
kgsl_pool_reduce(unsigned int target_pages, bool exit)
{
	int total_pages = 0;
	int i;
@@ -210,6 +210,14 @@ kgsl_pool_reduce(unsigned int target_pages)
	for (i = (KGSL_NUM_POOLS - 1); i >= 0; i--) {
		pool = &kgsl_pools[i];

		/*
		 * Only reduce the pool sizes for pools which are allowed to
		 * allocate memory unless we are at close, in which case the
		 * reserved memory for all pools needs to be freed
		 */
		if (!pool->allocation_allowed && !exit)
			continue;

		total_pages -= pcount;

		nr_removed = total_pages - target_pages;
@@ -417,7 +425,7 @@ kgsl_pool_shrink_scan_objects(struct shrinker *shrinker,
	int target_pages = (nr > total_pages) ? 0 : (total_pages - nr);

	/* Reduce pool size to target_pages */
	return kgsl_pool_reduce(target_pages);
	return kgsl_pool_reduce(target_pages, false);
}

static unsigned long
@@ -448,7 +456,7 @@ void kgsl_init_page_pools(void)
void kgsl_exit_page_pools(void)
{
	/* Release all pages in pools, if any.*/
	kgsl_pool_reduce(0);
	kgsl_pool_reduce(0, true);

	/* Unregister shrinker */
	unregister_shrinker(&kgsl_pool_shrinker);