qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Juan Quintela <quintela@redhat.com>
To: qemu-devel@nongnu.org
Cc: "Eric Blake" <eblake@redhat.com>,
	"Richard Henderson" <richard.henderson@linaro.org>,
	"Corey Minyard" <minyard@acm.org>,
	"Li Zhijian" <lizhijian@fujitsu.com>,
	"Marcel Apfelbaum" <marcel.apfelbaum@gmail.com>,
	"Hanna Reitz" <hreitz@redhat.com>, "John Snow" <jsnow@redhat.com>,
	"David Gibson" <david@gibson.dropbear.id.au>,
	"Gerd Hoffmann" <kraxel@redhat.com>,
	"Stefan Hajnoczi" <stefanha@redhat.com>,
	"Halil Pasic" <pasic@linux.ibm.com>,
	"Peter Maydell" <peter.maydell@linaro.org>,
	"Corey Minyard" <cminyard@mvista.com>,
	"Mark Cave-Ayland" <mark.cave-ayland@ilande.co.uk>,
	"Kevin Wolf" <kwolf@redhat.com>,
	qemu-s390x@nongnu.org, "Cédric Le Goater" <clg@kaod.org>,
	qemu-arm@nongnu.org, libvir-list@redhat.com,
	"Stefan Weil" <sw@weilnetz.de>,
	"Nicholas Piggin" <npiggin@gmail.com>,
	"Daniel Henrique Barboza" <danielhb413@gmail.com>,
	"Marc-André Lureau" <marcandre.lureau@redhat.com>,
	"Peter Xu" <peterx@redhat.com>,
	"Leonardo Bras" <leobras@redhat.com>,
	"Jason Wang" <jasowang@redhat.com>, "Fam Zheng" <fam@euphon.net>,
	"Christian Borntraeger" <borntraeger@linux.ibm.com>,
	"David Hildenbrand" <david@redhat.com>,
	"Thomas Huth" <thuth@redhat.com>,
	"Fabiano Rosas" <farosas@suse.de>,
	"Ilya Leoshkevich" <iii@linux.ibm.com>,
	"Harsh Prateek Bora" <harshpb@linux.ibm.com>,
	"Samuel Thibault" <samuel.thibault@ens-lyon.org>,
	"Eric Farman" <farman@linux.ibm.com>,
	"Juan Quintela" <quintela@redhat.com>,
	"Markus Armbruster" <armbru@redhat.com>,
	"Stefan Berger" <stefanb@linux.vnet.ibm.com>,
	qemu-ppc@nongnu.org, "Michael S. Tsirkin" <mst@redhat.com>,
	qemu-block@nongnu.org
Subject: [PULL 09/39] migration: Remove save_page_use_compression()
Date: Tue, 24 Oct 2023 15:12:35 +0200	[thread overview]
Message-ID: <20231024131305.87468-10-quintela@redhat.com> (raw)
In-Reply-To: <20231024131305.87468-1-quintela@redhat.com>

After previous patch, we disable the posiblity that we use compression
together with xbzrle.  So we can use directly migrate_compress().

Once there, now we don't need the rs parameter, so remove it.

Reviewed-by: Fabiano Rosas <farosas@suse.de>
Signed-off-by: Juan Quintela <quintela@redhat.com>
Message-ID: <20231019110724.15324-4-quintela@redhat.com>
---
 migration/ram.c | 34 +++++++---------------------------
 1 file changed, 7 insertions(+), 27 deletions(-)

diff --git a/migration/ram.c b/migration/ram.c
index e0ad732ee8..8246663f64 100644
--- a/migration/ram.c
+++ b/migration/ram.c
@@ -1291,8 +1291,6 @@ static int ram_save_multifd_page(QEMUFile *file, RAMBlock *block,
     return 1;
 }
 
-static bool save_page_use_compression(RAMState *rs);
-
 static int send_queued_data(CompressParam *param)
 {
     PageSearchStatus *pss = &ram_state->pss[RAM_CHANNEL_PRECOPY];
@@ -1329,9 +1327,9 @@ static int send_queued_data(CompressParam *param)
     return len;
 }
 
-static void ram_flush_compressed_data(RAMState *rs)
+static void ram_flush_compressed_data(void)
 {
-    if (!save_page_use_compression(rs)) {
+    if (!migrate_compress()) {
         return;
     }
 
@@ -1393,7 +1391,7 @@ static int find_dirty_block(RAMState *rs, PageSearchStatus *pss)
              * Also If xbzrle is on, stop using the data compression at this
              * point. In theory, xbzrle can do better than compression.
              */
-            ram_flush_compressed_data(rs);
+            ram_flush_compressed_data();
 
             /* Hit the end of the list */
             pss->block = QLIST_FIRST_RCU(&ram_list.blocks);
@@ -2042,24 +2040,6 @@ int ram_save_queue_pages(const char *rbname, ram_addr_t start, ram_addr_t len)
     return 0;
 }
 
-static bool save_page_use_compression(RAMState *rs)
-{
-    if (!migrate_compress()) {
-        return false;
-    }
-
-    /*
-     * If xbzrle is enabled (e.g., after first round of migration), stop
-     * using the data compression. In theory, xbzrle can do better than
-     * compression.
-     */
-    if (rs->xbzrle_started) {
-        return false;
-    }
-
-    return true;
-}
-
 /*
  * try to compress the page before posting it out, return true if the page
  * has been properly handled by compression, otherwise needs other
@@ -2068,7 +2048,7 @@ static bool save_page_use_compression(RAMState *rs)
 static bool save_compress_page(RAMState *rs, PageSearchStatus *pss,
                                ram_addr_t offset)
 {
-    if (!save_page_use_compression(rs)) {
+    if (!migrate_compress()) {
         return false;
     }
 
@@ -2083,7 +2063,7 @@ static bool save_compress_page(RAMState *rs, PageSearchStatus *pss,
      * much CPU resource.
      */
     if (pss->block != pss->last_sent_block) {
-        ram_flush_compressed_data(rs);
+        ram_flush_compressed_data();
         return false;
     }
 
@@ -3135,7 +3115,7 @@ static int ram_save_iterate(QEMUFile *f, void *opaque)
              * page is sent in one chunk.
              */
             if (migrate_postcopy_ram()) {
-                ram_flush_compressed_data(rs);
+                ram_flush_compressed_data();
             }
 
             /*
@@ -3236,7 +3216,7 @@ static int ram_save_complete(QEMUFile *f, void *opaque)
         }
         qemu_mutex_unlock(&rs->bitmap_mutex);
 
-        ram_flush_compressed_data(rs);
+        ram_flush_compressed_data();
 
         int ret = rdma_registration_stop(f, RAM_CONTROL_FINISH);
         if (ret < 0) {
-- 
2.41.0



  parent reply	other threads:[~2023-10-24 13:15 UTC|newest]

Thread overview: 45+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-24 13:12 [PULL 00/39] Migration 20231024 patches Juan Quintela
2023-10-24 13:12 ` [PULL 01/39] migration/doc: Add contents Juan Quintela
2023-10-24 13:12 ` [PULL 02/39] migration/doc: Add documentation for backwards compatiblity Juan Quintela
2023-10-24 13:12 ` [PULL 03/39] migration/doc: How to migrate when hosts have different features Juan Quintela
2023-10-24 13:12 ` [PULL 04/39] migration/doc: We broke backwards compatibility Juan Quintela
2023-10-24 13:12 ` [PULL 05/39] migration: Receiving a zero page non zero is an error Juan Quintela
2023-10-24 13:12 ` [PULL 06/39] migration: Rename ram_handle_compressed() to ram_handle_zero() Juan Quintela
2023-10-24 13:12 ` [PULL 07/39] migration: Give one error if trying to set MULTIFD and XBZRLE Juan Quintela
2023-10-24 13:12 ` [PULL 08/39] migration: Give one error if trying to set COMPRESSION " Juan Quintela
2023-10-24 13:12 ` Juan Quintela [this message]
2023-10-24 13:12 ` [PULL 10/39] migration: Make compress_data_with_multithreads return bool Juan Quintela
2023-10-24 13:12 ` [PULL 11/39] migration: Simplify compress_page_with_multithread() Juan Quintela
2023-10-24 13:12 ` [PULL 12/39] migration: Move busy++ to migrate_with_multithread Juan Quintela
2023-10-24 13:12 ` [PULL 13/39] migration: Create compress_update_rates() Juan Quintela
2023-10-24 13:12 ` [PULL 14/39] migration: Export send_queued_data() Juan Quintela
2023-10-24 13:12 ` [PULL 15/39] migration: Move ram_flush_compressed_data() to ram-compress.c Juan Quintela
2023-10-24 13:12 ` [PULL 16/39] migration: Merge flush_compressed_data() and compress_flush_data() Juan Quintela
2023-10-24 13:12 ` [PULL 17/39] migration: Rename ram_compressed_pages() to compress_ram_pages() Juan Quintela
2023-10-24 13:12 ` [PULL 18/39] hw/ipmi: Don't call vmstate_register() from instance_init() functions Juan Quintela
2023-10-24 13:12 ` [PULL 19/39] hw/s390x/s390-skeys: Don't call register_savevm_live() during instance_init() Juan Quintela
2023-10-26 15:35   ` Thomas Huth
2023-10-24 13:12 ` [PULL 20/39] hw/s390x/s390-stattrib: Simplify handling of the "migration-enabled" property Juan Quintela
2023-10-26 15:37   ` Thomas Huth
2023-10-24 13:12 ` [PULL 21/39] hw/s390x/s390-stattrib: Don't call register_savevm_live() during instance_init() Juan Quintela
2023-10-24 13:12 ` [PULL 22/39] migration/ram: Fix compilation with -Wshadow=local Juan Quintela
2023-10-24 13:12 ` [PULL 23/39] migration: rename vmstate_save_needed->vmstate_section_needed Juan Quintela
2023-10-24 13:12 ` [PULL 24/39] migration: set file error on subsection loading Juan Quintela
2023-10-24 13:12 ` [PULL 25/39] migration: Create vmstate_register_any() Juan Quintela
2023-10-24 13:12 ` [PULL 26/39] migration: Use vmstate_register_any() Juan Quintela
2023-10-24 13:12 ` [PULL 27/39] migration: Use vmstate_register_any() for isa-ide Juan Quintela
2023-10-24 13:12 ` [PULL 28/39] migration: Use VMSTATE_INSTANCE_ID_ANY for slirp Juan Quintela
2023-10-24 13:12 ` [PULL 29/39] migration: Hack to maintain backwards compatibility for ppc Juan Quintela
2023-10-24 13:12 ` [PULL 30/39] migration: Check in savevm_state_handler_insert for dups Juan Quintela
2023-10-24 13:12 ` [PULL 31/39] migration: Improve example and documentation of vmstate_register() Juan Quintela
2023-10-24 13:12 ` [PULL 32/39] migration: Use vmstate_register_any() for audio Juan Quintela
2023-10-24 13:12 ` [PULL 33/39] migration: Use vmstate_register_any() for eeprom93xx Juan Quintela
2023-10-24 13:13 ` [PULL 34/39] migration: Use vmstate_register_any() for vmware_vga Juan Quintela
2023-10-24 13:13 ` [PULL 35/39] qemu-iotests: Filter warnings about block migration being deprecated Juan Quintela
2023-10-24 13:13 ` [PULL 36/39] migration: migrate 'inc' command option is deprecated Juan Quintela
2023-10-24 13:13 ` [PULL 37/39] migration: migrate 'blk' " Juan Quintela
2023-10-24 13:13 ` [PULL 38/39] migration: Deprecate block migration Juan Quintela
2023-10-24 13:13 ` [PULL 39/39] migration: Deprecate old compression method Juan Quintela
2023-10-26  0:50 ` [PULL 00/39] Migration 20231024 patches Stefan Hajnoczi
2023-10-26 15:25   ` Juan Quintela
2023-10-27  0:41     ` Stefan Hajnoczi

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=20231024131305.87468-10-quintela@redhat.com \
    --to=quintela@redhat.com \
    --cc=armbru@redhat.com \
    --cc=borntraeger@linux.ibm.com \
    --cc=clg@kaod.org \
    --cc=cminyard@mvista.com \
    --cc=danielhb413@gmail.com \
    --cc=david@gibson.dropbear.id.au \
    --cc=david@redhat.com \
    --cc=eblake@redhat.com \
    --cc=fam@euphon.net \
    --cc=farman@linux.ibm.com \
    --cc=farosas@suse.de \
    --cc=harshpb@linux.ibm.com \
    --cc=hreitz@redhat.com \
    --cc=iii@linux.ibm.com \
    --cc=jasowang@redhat.com \
    --cc=jsnow@redhat.com \
    --cc=kraxel@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=leobras@redhat.com \
    --cc=libvir-list@redhat.com \
    --cc=lizhijian@fujitsu.com \
    --cc=marcandre.lureau@redhat.com \
    --cc=marcel.apfelbaum@gmail.com \
    --cc=mark.cave-ayland@ilande.co.uk \
    --cc=minyard@acm.org \
    --cc=mst@redhat.com \
    --cc=npiggin@gmail.com \
    --cc=pasic@linux.ibm.com \
    --cc=peter.maydell@linaro.org \
    --cc=peterx@redhat.com \
    --cc=qemu-arm@nongnu.org \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-ppc@nongnu.org \
    --cc=qemu-s390x@nongnu.org \
    --cc=richard.henderson@linaro.org \
    --cc=samuel.thibault@ens-lyon.org \
    --cc=stefanb@linux.vnet.ibm.com \
    --cc=stefanha@redhat.com \
    --cc=sw@weilnetz.de \
    --cc=thuth@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 NNTP newsgroup(s).