From patchwork Tue Oct 20 11:16:44 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilya Maximets X-Patchwork-Id: 1384814 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=openvswitch.org (client-ip=140.211.166.138; helo=whitealder.osuosl.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=ovn.org Received: from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4CFrgJ2MFLz9s0b for ; Tue, 20 Oct 2020 22:17:00 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id B05CF86CFD; Tue, 20 Oct 2020 11:16:58 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from whitealder.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id k-dYpRUSGBKC; Tue, 20 Oct 2020 11:16:58 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by whitealder.osuosl.org (Postfix) with ESMTP id F207A86BB7; Tue, 20 Oct 2020 11:16:57 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id DA0BAC0052; Tue, 20 Oct 2020 11:16:57 +0000 (UTC) X-Original-To: ovs-dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from silver.osuosl.org (smtp3.osuosl.org [140.211.166.136]) by lists.linuxfoundation.org (Postfix) with ESMTP id 8751CC0051 for ; Tue, 20 Oct 2020 11:16:56 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id 8401D271D9 for ; Tue, 20 Oct 2020 11:16:56 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from silver.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id bOrnlBL6gEAK for ; Tue, 20 Oct 2020 11:16:55 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from relay9-d.mail.gandi.net (relay9-d.mail.gandi.net [217.70.183.199]) by silver.osuosl.org (Postfix) with ESMTPS id 12A6C2D8B7 for ; Tue, 20 Oct 2020 11:16:54 +0000 (UTC) X-Originating-IP: 78.45.89.65 Received: from im-t490s.redhat.com (ip-78-45-89-65.net.upcbroadband.cz [78.45.89.65]) (Authenticated sender: i.maximets@ovn.org) by relay9-d.mail.gandi.net (Postfix) with ESMTPSA id BD62AFF807; Tue, 20 Oct 2020 11:16:50 +0000 (UTC) From: Ilya Maximets To: ovs-dev@openvswitch.org Date: Tue, 20 Oct 2020 13:16:44 +0200 Message-Id: <20201020111644.3207915-1-i.maximets@ovn.org> X-Mailer: git-send-email 2.25.4 MIME-Version: 1.0 Cc: Han Zhou , Ilya Maximets Subject: [ovs-dev] [PATCH] raft: Report jsonrpc backlog in kilobytes. X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ovs-dev-bounces@openvswitch.org Sender: "dev" While sending snapshots backlog on raft connections could quickly grow over 4GB and this will overflow raft-backlog counter. Let's report it in kB instead. (Using kB and not KB to match with ru_maxrss counter reported by kernel) Fixes: 3423cd97f88f ("ovsdb: Add raft memory usage to memory report.") Signed-off-by: Ilya Maximets Acked-by: Dumitru Ceara --- ovsdb/raft.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/ovsdb/raft.c b/ovsdb/raft.c index 708b0624c..3411323aa 100644 --- a/ovsdb/raft.c +++ b/ovsdb/raft.c @@ -1020,13 +1020,14 @@ void raft_get_memory_usage(const struct raft *raft, struct simap *usage) { struct raft_conn *conn; + uint64_t backlog = 0; int cnt = 0; LIST_FOR_EACH (conn, list_node, &raft->conns) { - simap_increase(usage, "raft-backlog", - jsonrpc_session_get_backlog(conn->js)); + backlog += jsonrpc_session_get_backlog(conn->js); cnt++; } + simap_increase(usage, "raft-backlog-kB", backlog / 1000); simap_increase(usage, "raft-connections", cnt); }