From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on gnuweeb.org X-Spam-Level: X-Spam-Status: No, score=-0.8 required=5.0 tests=ALL_TRUSTED,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NO_DNS_FOR_FROM,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.6 Received: from localhost.localdomain (unknown [180.246.144.41]) by gnuweeb.org (Postfix) with ESMTPSA id A2A218060C; Tue, 16 Aug 2022 16:53:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gnuweeb.org; s=default; t=1660668808; bh=ktYjtZYKFTsGwzfOhNUoXdRsu92C/yw6FHhaObeCvIc=; h=From:To:Cc:Subject:Date:From; b=lKCDJNjgfzWululbE3TiH76ZfJTapl5PI8PIGhCeFB/qjws6OxO8cVMyWvlW+00VO lgFZ1afSsq4BVG8uygGyDUsakvWXYZiGvIk2Puy7eHZAjSfCoeCPCDJ8mHNf4pSMlZ R1msbTO1ZuH/owkcge/472utt2UdaJhgRIo0zMo/bHKwPRbPFPksTEdy5oIadmFBku xlRPLNEm5guX2qKitOaUVelPan5g62GVnigEO/hENY+psmpJ5w1qpe7VHlFHR16zyG bPp7+jP9MXN+aqREwN1TU6FrqeTVDmEV3rYKHkn2RbR4/bd+wI8DQnaE/NdkXhr0i+ ebZmGlpCm/Jtg== From: Ammar Faizi To: Alviro Iskandar Setiawan Cc: Ammar Faizi , GNU/Weeb Mailing List Subject: [PATCH ncns v1 0/4] chnet ring cleanups Date: Tue, 16 Aug 2022 23:53:10 +0700 Message-Id: <20220816165314.3875649-1-ammarfaizi2@gnuweeb.org> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: Hi Al, This series contains small cleanups and fixes. Summary: 1) Refactor SQE handling. Make everything about SQE handling simpler and rename them to represent the function purpose better. 2) Improve `PostCQE()` waiting mechanism. Don't use sleep(1) in a loop to wait for the CQE slot be free, instead, use a conditional variable to reduce the loop cycle and also to reduce the latency because the wake up doesn't need to wait for a full second. It just waits until it's signaled whenever the CQE slot becomes available again. 3) Make sure we are holding the lock when calling `cqe_size()`. In `CNRingCtx::WaitCQE`, the first call to `cqe_size()` is not protected by the cqe_lock. Protect it. 4) Only notify CQE free slot when it's available. In `CNRingCtx::WaitCQE`, we don't actually always need to call `NotifyWaitCQEFreeSlot()`. To reduce the call overhead, just check whether the CQE slot is available or not. If it's available, then call it, otherwise, just don't. Signed-off-by: Ammar Faizi --- Ammar Faizi (4): chnet: ring: Refactor SQE handling chnet: ring: Improve `PostCQE()` waiting mechanism chnet: ring: Make sure we are holding the lock when calling `cqe_size()` chnet: ring: Only notify CQE free slot when it's available chnet/chnet_ring.cc | 198 +++++++++++++++++++++++++++++--------------- chnet/chnet_ring.h | 23 ++--- 2 files changed, 143 insertions(+), 78 deletions(-) base-commit: 498d5a49cf6e372fa386c832caca4a64987ea78c -- Ammar Faizi