0002-mm-preallocate-memory-only-with-glibc.patch 1.2 KB

12345678910111213141516171819202122232425262728293031323334
  1. From b668022f9b8aecf52109c9e0b7e5847054231361 Mon Sep 17 00:00:00 2001
  2. From: Zdenek Kabelac <zkabelac@redhat.com>
  3. Date: Fri, 19 Aug 2022 16:15:17 +0200
  4. Subject: [PATCH] mm: preallocate memory only with glibc
  5. Use mallinfo() only with glibc.
  6. Backported from: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=8370d117d7ef8a472c95315a3cd085696c90b3be
  7. Signed-off-by: Simon Rowe <simon.rowe@nutanix.com>
  8. ---
  9. lib/mm/memlock.c | 7 ++++++-
  10. 1 file changed, 6 insertions(+), 1 deletion(-)
  11. diff --git a/lib/mm/memlock.c b/lib/mm/memlock.c
  12. index 3d1a3927c..efcc6d91f 100644
  13. --- a/lib/mm/memlock.c
  14. +++ b/lib/mm/memlock.c
  15. @@ -160,7 +160,12 @@ static void _touch_memory(void *mem, size_t size)
  16. static void _allocate_memory(void)
  17. {
  18. -#ifndef VALGRIND_POOL
  19. +#if defined(__GLIBC__) && !defined(VALGRIND_POOL)
  20. + /* Memory allocation is currently only tested with glibc
  21. + * for different C libraries, some other mechanisms might be needed
  22. + * meanwhile let users use lvm2 code without memory preallocation.
  23. + * Compilation for VALGRIND tracing also goes without preallocation.
  24. + */
  25. void *stack_mem;
  26. struct rlimit limit;
  27. int i, area = 0, missing = _size_malloc_tmp, max_areas = 32, hblks;
  28. --
  29. 2.22.3