From: Lennart Poettering Date: Wed, 17 Feb 2021 13:40:13 +0000 (+0100) Subject: main: let's use physical_memory_scale() where appropriate X-Git-Tag: v248-rc1~46^2~7 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=60dcf3dc1b5b4c63e2c35ad7eba1d6f7ab5e086c;p=thirdparty%2Fsystemd.git main: let's use physical_memory_scale() where appropriate This way we can take benefit of the fact that physical_memory_scale() aligns on page sizes. --- diff --git a/src/core/main.c b/src/core/main.c index f29449d691c..67189fef6d3 100644 --- a/src/core/main.c +++ b/src/core/main.c @@ -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),