From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 6956 invoked by alias); 31 Jul 2013 12:35:36 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 6931 invoked by uid 89); 31 Jul 2013 12:35:36 -0000 X-Spam-SWARE-Status: No, score=0.0 required=5.0 tests=AWL,BAYES_50,KHOP_THREADED,RCVD_VIA_APNIC,RDNS_NONE,SPF_SOFTFAIL autolearn=no version=3.3.1 Received: from Unknown (HELO ozlabs.org) (203.10.76.45) by sourceware.org (qpsmtpd/0.84/v0.84-167-ge50287c) with ESMTP; Wed, 31 Jul 2013 12:35:35 +0000 Received: from kryten (ppp121-44-166-65.lns20.syd7.internode.on.net [121.44.166.65]) (using SSLv3 with cipher DHE-RSA-AES128-SHA (128/128 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPSA id 834C32C0091; Wed, 31 Jul 2013 22:35:27 +1000 (EST) Date: Wed, 31 Jul 2013 12:35:00 -0000 From: Anton Blanchard To: Pedro Alves Cc: Luis Machado , gdb-patches@sourceware.org Subject: Re: [PATCH] Improve performance of large restore commands Message-ID: <20130731223514.7c3963a9@kryten> In-Reply-To: <51F7A461.5060908@redhat.com> References: <20130725220858.58184193@kryten> <51F16780.70408@redhat.com> <20130729154457.0e6e6bd7@kryten> <51F6789B.3090404@redhat.com> <20130730092458.694febac@kryten> <51F7A461.5060908@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-SW-Source: 2013-07/txt/msg00818.txt.bz2 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 * 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);