msm: camera: sync: Restructure sync device structure

Currently sync_device structure size allocated is nearly 424kb
which is leading to more than accepted page size order.
Sync table row which is array of 2048 is accounting
nearly 90% of total size of sync_device. To fix this
sync_table_row is made pointer based and allocated memory.

CRs-Fixed: 3558545
Change-Id: I0c8093c91ac7fec9f52613012b139192b827b8d9
Signed-off-by: Shravya Samala <quic_shravyas@quicinc.com>
This commit is contained in:
Shravya Samala
2023-07-26 16:42:33 -07:00
committed by Camera Software Integration
orang tua 8a88a07cd0
melakukan 011cc16eb5
2 mengubah file dengan 11 tambahan dan 2 penghapusan

Melihat File

@@ -2777,6 +2777,13 @@ static int cam_sync_component_bind(struct device *dev,
if (!sync_dev)
return -ENOMEM;
sync_dev->sync_table = vzalloc(sizeof(struct sync_table_row) * CAM_SYNC_MAX_OBJS);
if (!sync_dev->sync_table) {
CAM_ERR(CAM_SYNC, "Mem Allocation failed for sync table");
kfree(sync_dev);
return -ENOMEM;
}
mutex_init(&sync_dev->table_lock);
spin_lock_init(&sync_dev->cam_sync_eventq_lock);
@@ -2878,6 +2885,7 @@ mcinit_fail:
video_unregister_device(sync_dev->vdev);
video_device_release(sync_dev->vdev);
vdev_fail:
vfree(sync_dev->sync_table);
mutex_destroy(&sync_dev->table_lock);
kfree(sync_dev);
return rc;
@@ -2903,6 +2911,7 @@ static void cam_sync_component_unbind(struct device *dev,
for (i = 0; i < CAM_SYNC_MAX_OBJS; i++)
spin_lock_init(&sync_dev->row_spinlocks[i]);
vfree(sync_dev->sync_table);
kfree(sync_dev);
sync_dev = NULL;
}

Melihat File

@@ -345,7 +345,7 @@ struct cam_signalable_info {
*
* @vdev : Video device
* @v4l2_dev : V4L2 device
* @sync_table : Table of all sync objects
* @sync_table : Table of all sync objects allocated when driver initializes
* @row_spinlocks : Spinlock array, one for each row in the table
* @table_lock : Mutex used to lock the table
* @open_cnt : Count of file open calls made on the sync driver
@@ -360,7 +360,7 @@ struct cam_signalable_info {
struct sync_device {
struct video_device *vdev;
struct v4l2_device v4l2_dev;
struct sync_table_row sync_table[CAM_SYNC_MAX_OBJS];
struct sync_table_row *sync_table;
spinlock_t row_spinlocks[CAM_SYNC_MAX_OBJS];
struct mutex table_lock;
int open_cnt;