]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
main: let's use physical_memory_scale() where appropriate
authorLennart Poettering <lennart@poettering.net>
Wed, 17 Feb 2021 13:40:13 +0000 (14:40 +0100)
committerLennart Poettering <lennart@poettering.net>
Thu, 18 Feb 2021 21:36:34 +0000 (22:36 +0100)
This way we can take benefit of the fact that physical_memory_scale()
aligns on page sizes.

src/core/main.c

index f29449d691c9d8f3a74c9d0ed6a486515b7aee1f..67189fef6d3fc4cafee641be1907ebf3c34c6022 100644 (file)
@@ -1256,8 +1256,8 @@ static int bump_rlimit_memlock(struct rlimit *saved_rlimit) {
          * must be unsigned, hence this is a given, but let's make this clear here. */
         assert_cc(RLIM_INFINITY > 0);
 
-        mm = physical_memory() / 8; /* Let's scale how much we allow to be locked by the amount of physical
-                                     * RAM. We allow an eighth to be locked by us, just to pick a value. */
+        mm = physical_memory_scale(1, 8); /* Let's scale how much we allow to be locked by the amount of physical
+                                           * RAM. We allow an eighth to be locked by us, just to pick a value. */
 
         new_rlimit = (struct rlimit) {
                 .rlim_cur = MAX3(HIGH_RLIMIT_MEMLOCK, saved_rlimit->rlim_cur, mm),