[PATCH] Improve performance of large restore commands
Anton Blanchard
anton@samba.org
Wed Jul 31 12:35:00 GMT 2013
Hi Pedro,
> > * target.c (memory_xfer_partial): Cap write to 4kB.
> ...
> > + subset of it. Cap writes to 4kB to mitigate this. */
> ...
>
> do write upper K, not k. Lowercase k usually indicates decimal
> 10^3. (see e.g.,
> http://en.wikipedia.org/wiki/Template:Bit_and_byte_prefixes).
Ahh sorry, I did that without thinking. Updated patch below.
Anton
--
I noticed a large (100MB) restore took hours to complete. The problem
is memory_xfer_partial repeatedly mallocs and memcpys the entire
100MB buffer for breakpoint shadow handling only to find a small portion
of it is actually written.
The testcase that originally took hours now takes 50 seconds.
--
2013-07-29 Anton Blanchard <anton@samba.org>
* target.c (memory_xfer_partial): Cap write to 4KB.
Index: b/gdb/target.c
===================================================================
--- a/gdb/target.c
+++ b/gdb/target.c
@@ -1669,6 +1669,13 @@ memory_xfer_partial (struct target_ops *
void *buf;
struct cleanup *old_chain;
+ /* A large write request is likely to be partially satisfied
+ by memory_xfer_partial_1. We will continually malloc
+ and free a copy of the entire write request for breakpoint
+ shadow handling even though we only end up writing a small
+ subset of it. Cap writes to 4KB to mitigate this. */
+ len = min (4096, len);
+
buf = xmalloc (len);
old_chain = make_cleanup (xfree, buf);
memcpy (buf, writebuf, len);
More information about the Gdb-patches
mailing list