summaryrefslogtreecommitdiff
path: root/mali_pixel
diff options
context:
space:
mode:
authorJack Diver <diverj@google.com>2024-03-13 16:33:34 +0000
committerJack Diver <diverj@google.com>2024-03-14 10:13:36 +0000
commit9052ae5d77f9ad5c8552ec915936a531cd899e2a (patch)
tree24f71cc43b730d78db1017a2bc84eab305e377c5 /mali_pixel
parenta96467622576b7f1318c55c61a862554ff6ebce9 (diff)
downloadgpu-9052ae5d77f9ad5c8552ec915936a531cd899e2a.tar.gz
[DO NOT MERGE ANYWHERE] Revert^2 "mali_pixel: mgm: Compensate for group migration"
2dd21a70c75d09b6e73838f8882e19dd734a66f0 Bug: 329447972 Change-Id: Ic4b43ec6ed408d471b50c773dbc4f74a474dc018
Diffstat (limited to 'mali_pixel')
-rw-r--r--mali_pixel/memory_group_manager.c21
1 files changed, 20 insertions, 1 deletions
diff --git a/mali_pixel/memory_group_manager.c b/mali_pixel/memory_group_manager.c
index 4d92ea7..3015468 100644
--- a/mali_pixel/memory_group_manager.c
+++ b/mali_pixel/memory_group_manager.c
@@ -376,7 +376,26 @@ static void update_size(struct memory_group_manager_device *mgm_dev, unsigned in
atomic_inc(size);
atomic64_add(1 << order, &total_gpu_pages);
} else {
- WARN_ON(atomic_dec_return(size) < 0);
+ if (atomic_dec_return(size) < 0) {
+ /* b/289501175
+ * Pages are often 'migrated' to the SLC group, which needs special
+ * accounting.
+ *
+ * TODO: Remove after SLC MGM decoupling b/290354607
+ */
+ if (!WARN_ON(group_id != MGM_SLC_GROUP_ID)) {
+ /* Undo the dec, and instead decrement the reserved group counter.
+ * This is still making the assumption that the migration came from
+ * the reserved group. Currently this is always true, however it
+ * might not be in future. It would be invasive and costly to track
+ * where every page came from, so instead this will be fixed as part
+ * of the b/290354607 effort.
+ */
+ atomic_inc(size);
+ update_size(mgm_dev, MGM_RESERVED_GROUP_ID, order, alloc);
+ return;
+ }
+ }
atomic64_sub(1 << order, &total_gpu_pages);
}