compaction: Release lock after finishing critical section 01/306601/5 accepted/tizen/unified/20240306.174200 accepted/tizen/unified/toolchain/20240311.065611 accepted/tizen/unified/x/20240308.033413
authorUnsung Lee <unsung.lee@samsung.com>
Thu, 22 Feb 2024 09:29:32 +0000 (18:29 +0900)
committerUnsung Lee <unsung.lee@samsung.com>
Tue, 5 Mar 2024 12:09:41 +0000 (21:09 +0900)
The problem is reported in coverity with 1743722 id.

Change-Id: I49f676273056eac80824b8584735ae4791017ce2
Signed-off-by: Unsung Lee <unsung.lee@samsung.com>
src/resource-optimizer/memory/compaction.c

index 5c926997107559619c70e266ec70f43c835946f6..4b5fec3d4bd1e3f963e298c49b348cc7da0b61eb 100644 (file)
@@ -493,9 +493,13 @@ static void compact_track_frag_level(struct compact_control *compact)
                pthread_mutex_lock(&compact->lock);
                woken = compact->status & COMPACT_NOTIFIED ? 1 : 0;
                compact->status &= ~COMPACT_NOTIFIED;
+               if (compact->status & COMPACT_SKIP) {
+                       pthread_mutex_unlock(&compact->lock);
+                       break;
+               }
                pthread_mutex_unlock(&compact->lock);
 
-       } while (!(compact->status & COMPACT_SKIP));
+       } while (1);
 
 }