From nobody Mon Feb 9 06:34:19 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org ARC-Seal: i=1; a=rsa-sha256; t=1603992068; cv=none; d=zohomail.com; s=zohoarc; b=Kdn4r6xp9ldQru9O7hVKImxd0AMX4oFzReZg+0dEJacPjjqHkjaoidiCsOauKnHdfp9pR1gdxcjnFM9+Pqk1HEy2pUnaR88aEWRuTgxvZbBy9WJt+3/FUrTOrVF3QSb8S3RqbFEgBMmO6rTCfAdd/D1lMrkBMH8RNhzE8MgAjUk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1603992068; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=8HnEje+bi5L28ovh7GxYhMDV/iYGgk+hVnPKuTzQjbY=; b=j6n7Cvi4mW8bvI4JviozerrBsaDqjFW82P4Q2wmNbBoPTRVq0Ht7DFXLLq9s4sigXkgKCKSlOZtLNG65uDd0BNLGkkv8w7ALV8h7S/nzY1arbRPzYqO6dz3pDBMhBX8D/BXCsKGlOj8qjzUdvtMtBB+pdUNHhvFKVLMRU1xjg8k= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1603992068035473.0695871613468; Thu, 29 Oct 2020 10:21:08 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.14438.35763 (Exim 4.92) (envelope-from ) id 1kYBbY-0004P0-Tc; Thu, 29 Oct 2020 17:20:52 +0000 Received: by outflank-mailman (output) from mailman id 14438.35763; Thu, 29 Oct 2020 17:20:52 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1kYBbY-0004Ol-NM; Thu, 29 Oct 2020 17:20:52 +0000 Received: by outflank-mailman (input) for mailman id 14438; Thu, 29 Oct 2020 17:20:51 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1kYBbX-0003MC-M4 for xen-devel@lists.xenproject.org; Thu, 29 Oct 2020 17:20:51 +0000 Received: from mo4-p02-ob.smtp.rzone.de (unknown [81.169.146.170]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id c87f4a73-4a17-4d15-a0fc-66c914d8e5f4; Thu, 29 Oct 2020 17:20:21 +0000 (UTC) Received: from sender by smtp.strato.de (RZmta 47.3.0 DYNA|AUTH) with ESMTPSA id j0b1afw9THKE3fM (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256 bits)) (Client did not present a certificate); Thu, 29 Oct 2020 18:20:14 +0100 (CET) Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1kYBbX-0003MC-M4 for xen-devel@lists.xenproject.org; Thu, 29 Oct 2020 17:20:51 +0000 Received: from mo4-p02-ob.smtp.rzone.de (unknown [81.169.146.170]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id c87f4a73-4a17-4d15-a0fc-66c914d8e5f4; Thu, 29 Oct 2020 17:20:21 +0000 (UTC) Received: from sender by smtp.strato.de (RZmta 47.3.0 DYNA|AUTH) with ESMTPSA id j0b1afw9THKE3fM (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256 bits)) (Client did not present a certificate); Thu, 29 Oct 2020 18:20:14 +0100 (CET) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: c87f4a73-4a17-4d15-a0fc-66c914d8e5f4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; t=1603992020; s=strato-dkim-0002; d=aepfle.de; h=References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: X-RZG-CLASS-ID:X-RZG-AUTH:From:Subject:Sender; bh=8HnEje+bi5L28ovh7GxYhMDV/iYGgk+hVnPKuTzQjbY=; b=Tz1p1IUBUd9B3S95popNAy44u2KWyhewJA6OQIaykQVWTfzCZMJK8k9C/YiGeJgmR8 OPtpyy/H7A4kri4DKD/vQScMHpg75ec9ogZuVmsPz95l1LNBhkgBiA32wun1zylBdKrN 1P504CQ3SdNpTjjqh4g8hE9i/FFhAKDTBJRMrII+g3FaNmOLR0rZJ9FF/b2PyC1yTRV9 eoY4RLgSubMDPHbh5iiAWlruR4yuyz4Giz/0p/U4bpxnKdPQtaEDi78kJ3+FFePEhyxi RLd3Z1Fdp/P/ElRsqB3vHP2nqyFmbMa1BHF6hpCMl0EbywMUhgIS41+L8X9Taemqu8KW mVNQ== X-RZG-AUTH: ":P2EQZWCpfu+qG7CngxMFH1J+3q8wa/QXkBR9MXjAuzBW/OdlBZQ4AHSS3G1Jjw==" X-RZG-CLASS-ID: mo00 From: Olaf Hering To: xen-devel@lists.xenproject.org Cc: Olaf Hering , Ian Jackson , Wei Liu , Anthony PERARD Subject: [PATCH v1 15/23] tools/guest: restore: move pfns array Date: Thu, 29 Oct 2020 18:19:55 +0100 Message-Id: <20201029172004.17219-16-olaf@aepfle.de> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20201029172004.17219-1-olaf@aepfle.de> References: <20201029172004.17219-1-olaf@aepfle.de> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" Remove allocation from hotpath, move pfns array into preallocated space. Signed-off-by: Olaf Hering --- tools/libs/guest/xg_sr_common.h | 2 ++ tools/libs/guest/xg_sr_restore.c | 6 ++---- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/tools/libs/guest/xg_sr_common.h b/tools/libs/guest/xg_sr_commo= n.h index 2a020fef5c..516d9b9fb5 100644 --- a/tools/libs/guest/xg_sr_common.h +++ b/tools/libs/guest/xg_sr_common.h @@ -224,6 +224,8 @@ struct xc_sr_save_arrays { }; =20 struct xc_sr_restore_arrays { + /* handle_page_data */ + xen_pfn_t pfns[MAX_BATCH_SIZE]; }; =20 struct xc_sr_context diff --git a/tools/libs/guest/xg_sr_restore.c b/tools/libs/guest/xg_sr_rest= ore.c index 4a9ece9681..7d1447e86c 100644 --- a/tools/libs/guest/xg_sr_restore.c +++ b/tools/libs/guest/xg_sr_restore.c @@ -315,7 +315,7 @@ static int handle_page_data(struct xc_sr_context *ctx, = struct xc_sr_record *rec) unsigned int i, pages_of_data =3D 0; int rc =3D -1; =20 - xen_pfn_t *pfns =3D NULL, pfn; + xen_pfn_t *pfns =3D ctx->restore.m->pfns, pfn; uint32_t *types =3D NULL, type; =20 /* @@ -363,9 +363,8 @@ static int handle_page_data(struct xc_sr_context *ctx, = struct xc_sr_record *rec) goto err; } =20 - pfns =3D malloc(pages->count * sizeof(*pfns)); types =3D malloc(pages->count * sizeof(*types)); - if ( !pfns || !types ) + if ( !types ) { ERROR("Unable to allocate enough memory for %u pfns", pages->count); @@ -412,7 +411,6 @@ static int handle_page_data(struct xc_sr_context *ctx, = struct xc_sr_record *rec) &pages->pfn[pages->count]); err: free(types); - free(pfns); =20 return rc; }