Support memory limit exception for specific app if <limit> value is -1.
This functionality is required to exclude specific app from
ServicePerAppLimitAction, WidgetPerAppLimitAction, GUIPerAppLimitAction, and
BackgroundPerAppLimitAction.
Change-Id: Ia58c4538ca541b78adc61a32d870730063915c6f
Signed-off-by: Unsung Lee <unsung.lee@samsung.com>
If <action> is specified, <action> overwrites the global action (reference section 1.5).
If <action> is not specified, action is decided by global action (i.e., MemoryLimitTrigger).
If <limit> size is smaller than app size during app loading time, the memory limit is not applied.
+ If <limit> size is -1, then this app has no memory limitations (reference section 1.3 and 1.4)
Example: MemLimitAction=4096KB
Key: MemoryBackgroundLru
char size[3];
char *ptr = strchr(value, 'B');
if (ptr == NULL) {
- _E("[CONFIG] Cannot find 'B' in the string (%s)", value);
+ if (atoi(value) == -1) {
+ *memory_bytes = BYTE_SIZE_MAX;
+ return RESOURCED_ERROR_NONE;
+ }
+
return RESOURCED_ERROR_FAIL;
}
#define _cleanup_fclose_ _cleanup_(fclosep)
#define _cleanup_closedir_ _cleanup_(closedirp)
+#define BYTE_SIZE_MAX (uint64_t)0xffffffffffff
+
#define BYTE_TO_KBYTE(b) ((b) >> 10)
#define BYTE_TO_MBYTE(b) ((b) >> 20)
#define BYTE_TO_PAGE(b) ((b) >> 12)
return RESOURCED_ERROR_INVALID_PARAMETER;
}
+ /* This app is not interested in memory limit */
+ if (limit_bytes == BYTE_SIZE_MAX) {
+ _D("Do not set memory limit for app (%s)", pai->appid);
+ return RESOURCED_ERROR_NONE;
+ }
+
result = asprintf(&path, "%s/%s", MEMCG_PRIVATE_PATH, pai->appid);
if (result < 0) {
_E("[MEMORY-LIMIT] not enough memory");