Message ID | 20211210224609.9QkKor7T0%akpm@linux-foundation.org (mailing list archive) |
---|---|
State | New |
Headers | show |
Series | [01/21] Increase default MLOCK_LIMIT to 8 MiB | expand |
On Fri, Dec 10, 2021 at 2:46 PM Andrew Morton <akpm@linux-foundation.org> wrote: > > -#define MLOCK_LIMIT ((PAGE_SIZE > 64*1024) ? PAGE_SIZE : 64*1024) > +#define MLOCK_LIMIT ((PAGE_SIZE > 8*1024*1024) ? PAGE_SIZE : 8*1024*1024) I think I'll just make this #define MLOCK_LIMIT (8*1024*1024) because at the point where it's that big, there's no point in comparing it against PAGE_SIZE any more. If some config has that big of a page size, all the rest of the kernel infrastructure would basically be screwed. We do a lot of core kernel allocations in one-page chunks.. Linus
--- a/include/uapi/linux/resource.h~increase-default-mlock_limit-to-8-mib +++ a/include/uapi/linux/resource.h @@ -66,10 +66,17 @@ struct rlimit64 { #define _STK_LIM (8*1024*1024) /* - * GPG2 wants 64kB of mlocked memory, to make sure pass phrases - * and other sensitive information are never written to disk. + * Limit the amount of locked memory by some sane default: + * root can always increase this limit if needed. + * + * The main use-cases are (1) preventing sensitive memory + * from being swapped; (2) real-time operations; (3) via + * IOURING_REGISTER_BUFFERS. + * + * The first two don't need much. The latter will take as + * much as it can get. 8MB is a reasonably sane default. */ -#define MLOCK_LIMIT ((PAGE_SIZE > 64*1024) ? PAGE_SIZE : 64*1024) +#define MLOCK_LIMIT ((PAGE_SIZE > 8*1024*1024) ? PAGE_SIZE : 8*1024*1024) /* * Due to binary compatibility, the actual resource numbers