lowmem-limit: Remove useless max limit size check 96/302696/2
authorUnsung Lee <unsung.lee@samsung.com>
Thu, 9 Nov 2023 07:37:23 +0000 (16:37 +0900)
committerUnsung Lee <unsung.lee@samsung.com>
Thu, 28 Dec 2023 09:30:01 +0000 (18:30 +0900)
Resourced already resizes limit size when limit size is larger than total memory size.

Change-Id: I71cf191f07c398e1916bbe6d1397874e7f6df302
Signed-off-by: Unsung Lee <unsung.lee@samsung.com>
src/resource-limiter/memory/lowmem-limit.c

index b2f5a57..3c4004b 100644 (file)
@@ -448,9 +448,8 @@ int lowmem_limit_set_system_service(pid_t pid, unsigned long long limit_bytes,
 {
        _cleanup_free_ char *path = NULL;
        int result;
-       unsigned long long totalram_bytes = lowmem_get_totalram();
 
-       if (limit_bytes < MIN_LIMIT_VALUE || limit_bytes > totalram_bytes) {
+       if (limit_bytes < MIN_LIMIT_VALUE) {
                _E("[MEMORY-LIMIT] It's meaningless to set memory limit with size (%llu) bytes", limit_bytes);
                return RESOURCED_ERROR_INVALID_PARAMETER;
        }
@@ -499,9 +498,8 @@ int lowmem_limit_set_app(unsigned long long limit_bytes, struct proc_app_info *p
        _cleanup_free_ char *path = NULL;
        GSList *iter = NULL;
        int result;
-       unsigned long long totalram_bytes = lowmem_get_totalram();
 
-       if (limit_bytes < MIN_LIMIT_VALUE || limit_bytes > totalram_bytes) {
+       if (limit_bytes < MIN_LIMIT_VALUE) {
                _E("[MEMORY-LIMIT] It's meaningless to set memory limit with size (%llu) bytes", limit_bytes);
                return RESOURCED_ERROR_INVALID_PARAMETER;
        }