From nobody Mon Feb 9 08:12:03 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=linux.intel.com ARC-Seal: i=1; a=rsa-sha256; t=1572051008; cv=none; d=zoho.com; s=zohoarc; b=Zyt/cn2RGmevAS3YVAy/ADF/WrljAQ5PjpW1g9WZRTDTgd6/wFeaWgfyP6wOGSzrYkiZbr8U0A7ybrwOO/iyW98Sfh+zGQ1fwlWT8+n6dG1pHwWgytbH5babHme4BKJPdAWwCSLExmt8pMk3tNzT5eQ58beIGXKbDeFJuEOEjW0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1572051008; h=Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=yT+VN31RSP1NwFBp+1YIvJsgzmjfWD/cBMNALw+Rujo=; b=V5YqJiJHZwULirfhADXNoph6BztlUHsdRpg6jv7hGFc6vVbeNR2FmyLGCFX7FnKRGiWbXFvf3B9kgUPBGDEnqrtVwbvLoXiirkrtOvWmadcMIw64UT9hpSC1tFbqMdG8DCe8WB93R6UrhXA1yXm7sM74ANW+AYHYYno747LLNj8= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1572051008533143.21269264151863; Fri, 25 Oct 2019 17:50:08 -0700 (PDT) Received: from localhost ([::1]:37646 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iOAHP-0002Y3-DP for importer@patchew.org; Fri, 25 Oct 2019 20:50:07 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:55016) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iOADG-0002hU-06 for qemu-devel@nongnu.org; Fri, 25 Oct 2019 20:45:51 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iOADE-0004mN-Vy for qemu-devel@nongnu.org; Fri, 25 Oct 2019 20:45:49 -0400 Received: from mga01.intel.com ([192.55.52.88]:5552) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iOADE-0004k9-NS for qemu-devel@nongnu.org; Fri, 25 Oct 2019 20:45:48 -0400 Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 25 Oct 2019 17:45:48 -0700 Received: from richard.sh.intel.com (HELO localhost) ([10.239.159.54]) by FMSMGA003.fm.intel.com with ESMTP; 25 Oct 2019 17:45:47 -0700 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.68,230,1569308400"; d="scan'208";a="204705117" From: Wei Yang To: quintela@redhat.com, dgilbert@redhat.com Subject: [PATCH v2 5/6] migration/multifd: use boolean for pending_job is enough Date: Sat, 26 Oct 2019 08:45:19 +0800 Message-Id: <20191026004520.5515-6-richardw.yang@linux.intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191026004520.5515-1-richardw.yang@linux.intel.com> References: <20191026004520.5515-1-richardw.yang@linux.intel.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 192.55.52.88 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: qemu-devel@nongnu.org, Wei Yang Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" After synchronization request is handled in another case, there only could be one pending_job for one send thread at most. This is fine to use boolean to represent this behavior. Signed-off-by: Wei Yang --- migration/ram.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/migration/ram.c b/migration/ram.c index 12c270e86d..fccdbfabc5 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -646,7 +646,7 @@ typedef struct { /* should this thread finish */ bool quit; /* thread has work to do */ - int pending_job; + bool pending_job; /* array of pages to sent */ MultiFDPages_t *pages; /* packet allocated len */ @@ -933,7 +933,7 @@ static int multifd_send_pages(RAMState *rs) return -1; } if (!p->pending_job) { - p->pending_job++; + p->pending_job =3D true; next_channel =3D (i + 1) % migrate_multifd_channels(); break; } @@ -1140,7 +1140,7 @@ static void *multifd_send_thread(void *opaque) } =20 qemu_mutex_lock(&p->mutex); - p->pending_job--; + p->pending_job =3D false; qemu_mutex_unlock(&p->mutex); =20 qemu_sem_post(&multifd_send_state->channels_ready); @@ -1238,8 +1238,7 @@ int multifd_save_setup(void) qemu_mutex_init(&p->mutex); qemu_sem_init(&p->sem, 0); qemu_sem_init(&p->sem_sync, 0); - p->quit =3D p->sync =3D false; - p->pending_job =3D 0; + p->quit =3D p->sync =3D p->pending_job =3D false; p->id =3D i; p->pages =3D multifd_pages_init(page_count); p->packet_len =3D sizeof(MultiFDPacket_t) --=20 2.17.1