msm: kgsl: Use non-atomic snapshot memory if it is unused

Over time, memory gets fragmented, and eventually, a system that is
up for a long time may have only a few physically contiguous pages.
Hence, there is a chance of atomic snapshot memory allocation failure.
Use non-atomic snapshot memory if it is unused as it is allocated
during probe time.

Change-Id: I725adeb80614a775f92213ebe9768f4f2f1c70a2
Signed-off-by: Kamal Agrawal <kamaagra@codeaurora.org>
Signed-off-by: Rohan Sethi <rohsethi@codeaurora.org>
This commit is contained in:
Kamal Agrawal 2021-06-12 04:07:14 +05:30 • committed by Rohan Sethi
commit 552f119915

View file

@ -687,13 +687,18 @@ static void kgsl_device_snapshot_atomic(struct kgsl_device *device)
}
device->snapshot_memory_atomic.size = device->snapshot_memory.size;
device->snapshot_memory_atomic.ptr = devm_kzalloc(&device->pdev->dev,
device->snapshot_memory_atomic.size, GFP_ATOMIC);
if (!device->snapshot_faultcount) {
/* Use non-atomic snapshot memory if it is unused */
device->snapshot_memory_atomic.ptr = device->snapshot_memory.ptr;
} else {
device->snapshot_memory_atomic.ptr = devm_kzalloc(&device->pdev->dev,
device->snapshot_memory_atomic.size, GFP_ATOMIC);
if (!device->snapshot_memory_atomic.ptr) {
dev_err(device->dev,
"KGSL failed to allocate memory for atomic snapshot\n");
return;
if (!device->snapshot_memory_atomic.ptr) {
dev_err(device->dev,
"KGSL failed to allocate memory for atomic snapshot\n");
return;
}
}
/* Allocate memory for the snapshot instance */