debuginfod/debuginfod.cxx:
- Added default value to fdcache_prefetch_mds and
  fdcache_prefetch_fds when -R is specified. Defaults   to one half of
  fdcache's values for those respective   variables. These values are only set
  when -R is specified

Note: the ratio of prefetch:fdcache file descriptors and MBs
          is set to 1:2 since the fdcache seems to be used less
          than the standard fdcache.
From caa420f97225c5cc31c3fa0650cc7e25af3b4e91 Mon Sep 17 00:00:00 2001
From: Noah Sanci <nsa...@redhat.com>
Date: Mon, 9 May 2022 13:15:04 -0400
Subject: [PATCH] PR29098: debuginfod - set default prefetch limits to >0
 debuginfod/debuginfod.cxx: - Added default value to fdcache_prefetch_mds and 
  fdcache_prefetch_fds when -R is specified. Defaults   to one half of
 fdcache's values for those respective   variables. These values are only set
 when -R is specified

Signed-off-by: Noah Sanci <nsa...@redhat.com>
---
 debuginfod/debuginfod.cxx | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/debuginfod/debuginfod.cxx b/debuginfod/debuginfod.cxx
index 4aaf41c0..b2fb2afb 100644
--- a/debuginfod/debuginfod.cxx
+++ b/debuginfod/debuginfod.cxx
@@ -3826,6 +3826,18 @@ main (int argc, char *argv[])
       error (EXIT_FAILURE, 0,
              "unexpected argument: %s", argv[remaining]);
 
+  // Make the prefetch cache spaces smaller than the normal
+  // fd cache if rpm scanning is on. This is to not waste memory
+  // since the prefetch cache isn't used when -R isn't specified
+  // Set to 1/2 arbitrarily
+  if ( scan_archives[".rpm"] == "cat" )
+    {
+      if ( fdcache_prefetch_fds == 0 )
+        fdcache_prefetch_fds = fdcache_fds * .5;
+      if ( fdcache_prefetch_mbs == 0 )
+        fdcache_prefetch_mbs = fdcache_mbs * .5;
+    }
+
   if (scan_archives.size()==0 && !scan_files && source_paths.size()>0)
     obatched(clog) << "warning: without -F -R -U -Z, ignoring PATHs" << endl;
 
-- 
2.31.1

Reply via email to