lowmem-limit: Remove useless max limit size check 27/301327/5
authorUnsung Lee <unsung.lee@samsung.com>
Thu, 9 Nov 2023 07:37:23 +0000 (16:37 +0900)
committerUnsung Lee <unsung.lee@samsung.com>
Tue, 21 Nov 2023 07:56:06 +0000 (16:56 +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 f30e327..465700a 100644 (file)
@@ -447,9 +447,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;
        }
@@ -498,9 +497,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;
        }