Received: by 2002:a05:6a10:1a4d:0:0:0:0 with SMTP id nk13csp2998872pxb; Thu, 3 Feb 2022 21:34:53 -0800 (PST) X-Google-Smtp-Source: ABdhPJzFwUYMYUCtMRJWjkxXpr+SLltDVIaei0DCG2GKYczynD1zfZKVzFthb3bg9meiVWhKo5O+ X-Received: by 2002:a05:6402:2741:: with SMTP id z1mr1442611edd.264.1643952893158; Thu, 03 Feb 2022 21:34:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643952893; cv=none; d=google.com; s=arc-20160816; b=gxvdJK2/sPkdJ2WMRBrLd6cTZm63C4fPROceIOACmDAA9s6SSRIAzfNeB1tLN+GghB LdC/6tjtjOaKo7vIK5EBxNczjLru/4F1Jkqzr33rRWc0buSPOGZgl5nObrNqdsmPEGgB kGVfiwVMnFFyy2Qg/Ts/zgz1Gqzeqt0luQ3+aQ0TKo9obzaIZqQZ5HEBeRSohW3ujGBG 0LP5Vo/MZr3yalbAdnTIXiAjsPKgNNiJRM3an4KHXtSLopbKDJEmoi4owctlRecoa4wS Qe78bJeOOU5CaM/nQOjFB6Z3Cr+Ycv+VqebTY7i3vRdS+n2lOWpyD/LY5z6x+GhD+eo5 gXjQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=Jg2HQIwBrRe3o77m7am+d1x3dh2EVdYu2F2MEWZU1To=; b=hbC1mRN+F2qn6b1Hm24L+PGNasZRfORDS9dr+dDmrxe0pZiDMjCFdMy9jeXZYZxEYy pvwzE1R1ASnTO6epwTYkF1i5euxWeSRu2uCTmKIOGzQ5YnDlBw2srYxrg/PnpsaxA69e +6+KqSuBu0SFA+lWMJN4V3Uxkkysgymxsv2L7EJwf8AZFNg3vLpUPANlzjarG1q5SBXd badzYRQh/IxF7NMYJOx9vmUFesOXbo7w62PYIg7EIDTjutdAS/92gYCPONC/jwzfbvap oyFmthwurAG6ulUSMXV72bECn0ixEf43cKV56dSi9PSnRk0atZP6gjJQQzaA2j1vT4Xa LVoA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bytedance-com.20210112.gappssmtp.com header.s=20210112 header.b=oxpxJKZm; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=bytedance.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id dz22si625803edb.240.2022.02.03.21.34.28; Thu, 03 Feb 2022 21:34:53 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@bytedance-com.20210112.gappssmtp.com header.s=20210112 header.b=oxpxJKZm; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=bytedance.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1356005AbiBCXeo (ORCPT + 99 others); Thu, 3 Feb 2022 18:34:44 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43528 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238196AbiBCXen (ORCPT ); Thu, 3 Feb 2022 18:34:43 -0500 Received: from mail-wr1-x42a.google.com (mail-wr1-x42a.google.com [IPv6:2a00:1450:4864:20::42a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F0B6BC061714 for ; Thu, 3 Feb 2022 15:34:42 -0800 (PST) Received: by mail-wr1-x42a.google.com with SMTP id j25so7343568wrb.2 for ; Thu, 03 Feb 2022 15:34:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance-com.20210112.gappssmtp.com; s=20210112; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=Jg2HQIwBrRe3o77m7am+d1x3dh2EVdYu2F2MEWZU1To=; b=oxpxJKZmkfxOsupANpn/hBsE8u2+0gQLCxhBzZHrrHvJp5zvPWw9Y+2g08Z2QUzigM hS7hQ+QlZpNBVXviMyMJaGLRq6Wkddyg517Yg61DM06iUmQaie4GcGE/Kzwv4U1MQ7uO XILqwqUGj/0f40BCqnjUrDvKFBvaNzlVemnlyYvVU9J/mqewsneqwcb4fmQzjl98FjVS KgKoQ4LDKstNTpt2uV36BKBQxQgAG3+byrB2sTu4kRVikoeoxQZZzHZe+dTypKOZOKpp X0uyMbqaR2xvDlCz9SXwAyqIC7k9UzOcnFXo/07HKqAUz0B2uIuATJwMkyf2+9W8ze+z Fmgg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=Jg2HQIwBrRe3o77m7am+d1x3dh2EVdYu2F2MEWZU1To=; b=3sKcPnDhl6PfiK5wiFFsjBfmIzIM2dVuO9/IISl0lAMKBhML5ORiUCYNo4X0YGcdeQ jj1mn3leVRCSBca0klUgnSOZAdvyG1FT6wPE39KYiM1a08uhr27+ztpxYfcD00GwB+ac JCOKtXan2RFTtiftRWJ+KAUvYoA9Wmca3OX9T0STAvoancJV+8Smzi0AMzdhIrHjpT98 Z6BpMhfWFCCAf0jOvysDb72daZxNetLaMu9HciG4lra0ekRTJ7ucMqHVYxyNKFXvnfeq NT2e9HRs4/TtZv8A2zzpPd2PUDwByIKuT7cg/jFfFj40KrPCvRcKKVKvXbD86k43RLlX kQ/g== X-Gm-Message-State: AOAM530+YbVmsFe/BRoRye/0Q28R1L/jX3uDzqS7V3IgP2WNVR0cH2TY yKXyUbA07KdAkPXjb6jb2MSPjQ== X-Received: by 2002:a5d:6da4:: with SMTP id u4mr183208wrs.611.1643931281591; Thu, 03 Feb 2022 15:34:41 -0800 (PST) Received: from usaari01.cust.communityfibre.co.uk ([2a02:6b6d:f804:0:28c2:5854:c832:e580]) by smtp.gmail.com with ESMTPSA id j15sm148494wmq.19.2022.02.03.15.34.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 03 Feb 2022 15:34:41 -0800 (PST) From: Usama Arif To: io-uring@vger.kernel.org, axboe@kernel.dk, asml.silence@gmail.com, linux-kernel@vger.kernel.org Cc: fam.zheng@bytedance.com, Usama Arif Subject: [PATCH v5 0/4] io_uring: remove ring quiesce in io_uring_register Date: Thu, 3 Feb 2022 23:34:35 +0000 Message-Id: <20220203233439.845408-1-usama.arif@bytedance.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org For opcodes relating to registering/unregistering eventfds, this is done by creating a new RCU data structure (io_ev_fd) as part of io_ring_ctx that holds the eventfd_ctx, with reads to the structure protected by rcu_read_lock and writes (register/unregister calls) protected by a mutex. With the above approach ring quiesce can be avoided which is much more expensive then using RCU lock. On the system tested, io_uring_reigster with IORING_REGISTER_EVENTFD takes less than 1ms with RCU lock, compared to 15ms before with ring quiesce. The second patch creates the RCU protected data structure and removes ring quiesce for IORING_REGISTER_EVENTFD and IORING_UNREGISTER_EVENTFD. The third patch builds on top of the second patch and removes ring quiesce for IORING_REGISTER_EVENTFD_ASYNC. The fourth patch completely removes ring quiesce from io_uring_register, as IORING_REGISTER_ENABLE_RINGS and IORING_REGISTER_RESTRICTIONS dont need them. --- v4->v5: - Remove ring quiesce completely from io_uring_register (Pavel Begunkov) - Replaced rcu_barrier with unregistering flag (Jens Axboe) - Created a faster check for ctx->io_ev_fd in io_eventfd_signal and cleaned up io_eventfd_unregister (Jens Axboe) v3->v4: - Switch back to call_rcu and use rcu_barrier incase io_eventfd_register fails to make sure all rcu callbacks have finished. v2->v3: - Switched to using synchronize_rcu from call_rcu in io_eventfd_unregister. v1->v2: - Added patch to remove eventfd from tracepoint (Patch 1) (Jens Axboe) - Made the code of io_should_trigger_evfd as part of io_eventfd_signal (Jens Axboe) Usama Arif (4): io_uring: remove trace for eventfd io_uring: avoid ring quiesce while registering/unregistering eventfd io_uring: avoid ring quiesce for IORING_REGISTER_EVENTFD_ASYNC io_uring: remove ring quiesce for io_uring_register fs/io_uring.c | 202 ++++++++++++++++---------------- include/trace/events/io_uring.h | 13 +- 2 files changed, 107 insertions(+), 108 deletions(-) -- 2.25.1