public inbox for dwz@sourceware.org
 help / color / mirror / Atom feed
From: Tom de Vries <tdevries@suse.de>
To: dwz@sourceware.org, jakub@redhat.com
Subject: [committed] Improve handling of running into both low-mem and max die-limits
Date: Tue, 01 Jan 2019 00:00:00 -0000	[thread overview]
Message-ID: <20191126144716.GA14977@delia> (raw)

Hi,

If both the low-mem die-limit as well as the max die-limit are triggered, we
find out about the low-mem die-limit during counting, and about the max
die-limit during parsing in low-mem mode:
...
$ dwz cc1 -o 1 -l1000 -L10000000 --devel-trace
Compressing 1
Counting DIEs
Hit low-mem die-limit
Compressing 1 in low-mem mode
htab: off_htab allocation
      size: 131071
dwz: cc1: Too many DIEs, not optimizing
htab: off_htab final
      size: 2097143
      elements: 427544, occupancy: 0.203870
      searches: 1985541, collisions: 0.602202
...

Fix this such that we find out about both limits during counting:
...
$ dwz cc1 -o 1 -l1000 -L10000000 --devel-trace
Compressing 1
Counting DIEs
Hit low-mem die-limit
dwz: cc1: Too many DIEs, not optimizing
...

Committed to trunk.

Thanks,
- Tom

Improve handling of running into both low-mem and max die-limits

2019-11-26  Tom de Vries  <tdevries@suse.de>

	* dwz.c (try_debug_info): Keep going after hitting low-mem die-limit,
	if we might hit the max die-limit.

---
 dwz.c | 16 +++++++++++++---
 1 file changed, 13 insertions(+), 3 deletions(-)

diff --git a/dwz.c b/dwz.c
index d5e477b..4e42062 100644
--- a/dwz.c
+++ b/dwz.c
@@ -4933,6 +4933,7 @@ try_debug_info (DSO *dso)
   unsigned int ndies;
   unsigned ret = 1;
   int kind = DEBUG_INFO;
+  bool low_mem_die_limit_hit = false;
 
   if (tracing)
     fprintf (stderr, "Counting DIEs\n");
@@ -5032,8 +5033,14 @@ try_debug_info (DSO *dso)
 	    {
 	      if (tracing)
 		fprintf (stderr, "Hit low-mem die-limit\n");
-	      ret = 2;
-	      goto fail;
+	      if (estimate_nr_dies () > max_die_limit)
+		/* Keep going, we still might hit the max die-limit.  */
+		low_mem_die_limit_hit = true;
+	      else
+		{
+		  ret = 2;
+		  goto fail;
+		}
 	    }
 	  ndies++;
 	  t = htab_find_with_hash (abbrev, &tag, tag.entry);
@@ -5047,7 +5054,10 @@ try_debug_info (DSO *dso)
 	}
     }
 
-  ret = 0;
+  if (low_mem_die_limit_hit)
+    ret = 2;
+  else
+    ret = 0;
 
  fail:
   if (abbrev)

                 reply	other threads:[~2019-11-26 14:47 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20191126144716.GA14977@delia \
    --to=tdevries@suse.de \
    --cc=dwz@sourceware.org \
    --cc=jakub@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).