diff options
author | Minchan Kim <minchan@google.com> | 2021-06-22 15:33:12 -0700 |
---|---|---|
committer | Sidath Senanayake <sidaths@google.com> | 2021-06-22 23:09:48 +0000 |
commit | 24a95def66c45fab8f881ea186c7df6f44d88d80 (patch) | |
tree | 83d300c02ef5e88a1fcc612ec9d72cf9db12c04b /mali_pixel | |
parent | f0d34749d288be085505e6938b40891241ac16bf (diff) | |
download | gpu-24a95def66c45fab8f881ea186c7df6f44d88d80.tar.gz |
mali_pixel: mgm: Print warning after GPU allocations pass 4 GiB
Print rate limited warnings once the total GPU private allocation
exceeds 4 GiB.
This should be removed once the linked bug has been resolved.
Bug: 190617821
Signed-off-by: Minchan Kim <minchan@google.com>
Change-Id: I1e12930e5d621ba160b9e096620becd0b5ab94fb
Diffstat (limited to 'mali_pixel')
-rw-r--r-- | mali_pixel/memory_group_manager.c | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/mali_pixel/memory_group_manager.c b/mali_pixel/memory_group_manager.c index 2072e89..4c6263f 100644 --- a/mali_pixel/memory_group_manager.c +++ b/mali_pixel/memory_group_manager.c @@ -345,28 +345,35 @@ static void mgm_sysfs_term(struct mgm_groups *data) kobject_put(&data->kobj); } +static atomic64_t total_gpu_pages = ATOMIC64_INIT(0); + static void update_size(struct memory_group_manager_device *mgm_dev, int group_id, int order, bool alloc) { + static DEFINE_RATELIMIT_STATE(gpu_alloc_rs, 10*HZ, 1); struct mgm_groups *data = mgm_dev->data; switch (order) { case ORDER_SMALL_PAGE: - if (alloc) + if (alloc) { atomic_inc(&data->groups[group_id].size); - else { + atomic64_inc(&total_gpu_pages); + } else { WARN_ON(atomic_read(&data->groups[group_id].size) == 0); atomic_dec(&data->groups[group_id].size); + atomic64_dec(&total_gpu_pages); } break; case ORDER_LARGE_PAGE: - if (alloc) + if (alloc) { atomic_inc(&data->groups[group_id].lp_size); - else { + atomic64_add(1 << ORDER_LARGE_PAGE, &total_gpu_pages); + } else { WARN_ON(atomic_read( &data->groups[group_id].lp_size) == 0); atomic_dec(&data->groups[group_id].lp_size); + atomic64_sub(1 << ORDER_LARGE_PAGE, &total_gpu_pages); } break; @@ -374,6 +381,10 @@ static void update_size(struct memory_group_manager_device *mgm_dev, int dev_err(data->dev, "Unknown order(%d)\n", order); break; } + + if (atomic64_read(&total_gpu_pages) >= (4 << (30 - PAGE_SHIFT)) && + __ratelimit(&gpu_alloc_rs)) + pr_warn("total_gpu_pages %lu\n", atomic64_read(&total_gpu_pages)); } static struct page *mgm_alloc_page( |