From nobody Tue Feb 10 05:39:50 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1606484715; cv=none; d=zohomail.com; s=zohoarc; b=UTCuXo5rY2aMiC17QFDZLd3BzOKPPgz5wJE2yNHVx6TX+mjyUACDmLtDojlm4g+zY8H1fHsAD4Dqtfg5mJl9WSzwzAM6stOncXzBohImeM9oceN93Cvx6cRxyo2iiZ5oWSTSgkDXYxPiZ1e3lRUUxspgqM2NdjAGlL8G3BK4ANg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1606484715; h=Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:Reply-To:References:Sender:Subject:To; bh=jOXefFhDELlQN4xhxHFqsPp2mkZpZe2Uo+aRvJd7BGc=; b=ZRQrmmVlD66rnz7TaC6eyjHQV1Bd5EFU9Q2sMKFx7p6LTCsQfOnvdaig1BmL0eE39hMvk01YDmaPJBWmHvh6IqxqqJoPmfVd9Zrr3rzMVqTOUL2dO1UUbdOt+VHIWVEbBZMEf87ilzlKPZ5dvkcrBWslcUMC+Jol35FxfpKJuTo= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass 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 1606484715521623.6632968681045; Fri, 27 Nov 2020 05:45:15 -0800 (PST) Received: from localhost ([::1]:58406 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kie3m-0006ep-7F for importer@patchew.org; Fri, 27 Nov 2020 08:45:14 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:46582) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kidwx-0007rb-M0; Fri, 27 Nov 2020 08:38:11 -0500 Received: from relay.sw.ru ([185.231.240.75]:53020 helo=relay3.sw.ru) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kidwv-0003iH-Aj; Fri, 27 Nov 2020 08:38:11 -0500 Received: from [172.16.25.136] (helo=localhost.sw.ru) by relay3.sw.ru with esmtp (Exim 4.94) (envelope-from ) id 1kidwT-00AfjY-Av; Fri, 27 Nov 2020 16:37:41 +0300 To: qemu-block@nongnu.org Cc: qemu-devel@nongnu.org, kwolf@redhat.com, mreitz@redhat.com, mdroth@linux.vnet.ibm.com, thuth@redhat.com, lvivier@redhat.com, armbru@redhat.com, dgilbert@redhat.com, pbonzini@redhat.com, den@openvz.org, vsementsov@virtuozzo.com, andrey.shinkevich@virtuozzo.com Subject: [PATCH v3 5/5] monitor: increase amount of data for monitor to read Date: Fri, 27 Nov 2020 16:35:46 +0300 Message-Id: <1606484146-913540-6-git-send-email-andrey.shinkevich@virtuozzo.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1606484146-913540-1-git-send-email-andrey.shinkevich@virtuozzo.com> References: <1606484146-913540-1-git-send-email-andrey.shinkevich@virtuozzo.com> Received-SPF: pass (zohomail.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; Received-SPF: pass client-ip=185.231.240.75; envelope-from=andrey.shinkevich@virtuozzo.com; helo=relay3.sw.ru X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Reply-to: Andrey Shinkevich From: Andrey Shinkevich via Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" QMP and HMP monitors read one byte at a time from the socket or stdin, which is very inefficient. With 100+ VMs on the host, this results in multiple extra system calls and CPU overuse. This patch increases the amount of read data up to 4096 bytes that fits the buffer size on the channel level. Suggested-by: Denis V. Lunev Signed-off-by: Andrey Shinkevich --- monitor/monitor.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/monitor/monitor.c b/monitor/monitor.c index 84222cd..43d2d3b 100644 --- a/monitor/monitor.c +++ b/monitor/monitor.c @@ -566,7 +566,7 @@ int monitor_can_read(void *opaque) { Monitor *mon =3D opaque; =20 - return !qatomic_mb_read(&mon->suspend_cnt); + return !qatomic_mb_read(&mon->suspend_cnt) ? CHR_READ_BUF_LEN : 0; } =20 void monitor_list_append(Monitor *mon) --=20 1.8.3.1