Received: by 2002:a05:6a10:1a4d:0:0:0:0 with SMTP id nk13csp2715292pxb; Thu, 3 Feb 2022 12:35:13 -0800 (PST) X-Google-Smtp-Source: ABdhPJwFDEeNrQC2okUh8C1y6XYgKN+vBZwfARgibNqy0XKnImjIB6a8O4L5fIdXGET1ykCmr7r1 X-Received: by 2002:a05:6a00:1952:: with SMTP id s18mr35774871pfk.54.1643920513121; Thu, 03 Feb 2022 12:35:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643920513; cv=none; d=google.com; s=arc-20160816; b=K+iZcg2q9R/2Ls2Ajq5C8fBYKSpmUQCv/01WH0t9josO7yemhjJsc55zBvOOqQi9s9 E1PJGLKEFQvCceVt6iNrLtK6bCTbqxaOcooktYLKRyQFxF/8dRWd09dKBvj9SmKxi1RM KhUysQhF5ZLE7yZAVoWXohJyo/oEqHiOM9AemfN/J+pHpcajwac01iiYVCnxiMoEu9ZV lhth9ZJV8Ykz9XEyEvANAviEiWlpy7v5pWGuQ3rH4pNkzADW+nqfbOS2camL6EMGQCep dEstX3BLX7x4E05DQ6ONNEuF0QA0pQyBcIj/m+yfp/8OhNcm9BDcJx7+UzDJWvecTBZX jmbw== 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=QIZiYOb5KIYRl/qJc3StlrUHLBXvSan9TakJg38R+r0=; b=a9Ilr5dhtvnR6tlfR8PqQt8r/cdDnlxIT1xuITUhBeE+QvSL5FIsKQhJNV14AvRFN+ sEGyaTdLHc3g6EpQQ58C5YDoIqwsbzdqWfpG8oFFCXAWosTyrarpcx7LZ5dTLFiTSy5l m7/OJBU/hli9GD987rktFFc9PxN4534rMC9bWXF7xgZAOkYZeCfkN9GtcuMcHP39qSN8 LPMsXMq6v3s3wPQa8AbMbK1MyPhwl2IAxVEMwrEaj8JOeFTvNNRlVrh82j/C1tLZrSAk 1+c1kg4K0i15nb9jME1ZTYU8+kH0zxYOEPMHb+MxVgeSAUrp4ZUnwEK24LMh7UAMXzim 7jZg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bytedance-com.20210112.gappssmtp.com header.s=20210112 header.b=hBlA3xaN; 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 m3si24604086plx.483.2022.02.03.12.35.01; Thu, 03 Feb 2022 12:35:13 -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=hBlA3xaN; 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 S1353448AbiBCSYq (ORCPT + 99 others); Thu, 3 Feb 2022 13:24:46 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56926 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245555AbiBCSYp (ORCPT ); Thu, 3 Feb 2022 13:24:45 -0500 Received: from mail-wr1-x432.google.com (mail-wr1-x432.google.com [IPv6:2a00:1450:4864:20::432]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3EC51C061714 for ; Thu, 3 Feb 2022 10:24:45 -0800 (PST) Received: by mail-wr1-x432.google.com with SMTP id j25so6003097wrb.2 for ; Thu, 03 Feb 2022 10:24:45 -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=QIZiYOb5KIYRl/qJc3StlrUHLBXvSan9TakJg38R+r0=; b=hBlA3xaNLllrMEAMRhqVVebO2N0bJadJaFI+KSJaqMBuIR4QR3BSR6zVxK1U+oHfB1 yEEUIglJoDYa3z4eZN6P5y80hN7LykGGWvM8isNRSKtemPSw6JcHhqbcEf5ZLHIsgiR8 wtBA6e3oAtrz1FeG9FgkrAWPAE3RWFKH4fmeQFh0l3qvi5WpWiSLXBqFun/4CJcz579m kP2OX3zuQEeQLrmsL8L2l1ZvGo1dYIm6+FPwndq0MrpMKMbIPh59UzOf87FPUd6y8iWJ 6AhLTR4y2F1GCDac4OfMY8dcNv7YUZcs2k9O8JvIl7xAca6s5PVk6XbUO2hWRG91503u Ex6Q== 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=QIZiYOb5KIYRl/qJc3StlrUHLBXvSan9TakJg38R+r0=; b=a99HDlP0bDkxb8/cP5tBpBFTGhhECW/mdc39fC099FuCqul7X+JOvzVftjQIhtEPlE 6tSqfQ6aCXr7VEnccI70/BFWi0cE+D2XjIxjUHJRJaVhbdWGjTlVe9E9HFkeIexNXXyT zbfg4SL4sxpPPwAbFcZRgBNvCe7l+WqUHAxiXLSQojxFLGtHRKvwgAV6KFdYKi3TP0J/ /uyqcbzao4Dzfbr7VMIzhwri/UYgPNs8Nu40QcAfUFK8Fuv/UyxSUEmE76oqdYdt+nS7 A7oLu05JEmucKwo6EriRXQEf7jrfv7kskoxfQHEiTuN92a9bFedmtIZQ3Zlq5pQsXuep nYcg== X-Gm-Message-State: AOAM531FL9ZLGGBrpO25DUu11hB3xbWRjagc/7fRkMzzDS9TjgoykSJs LjiyFAE8JwjSv0UsgTo1AT6TCg== X-Received: by 2002:adf:fb0f:: with SMTP id c15mr31290512wrr.42.1643912683900; Thu, 03 Feb 2022 10:24:43 -0800 (PST) Received: from usaari01.cust.communityfibre.co.uk ([2a02:6b6d:f804:0:28c2:5854:c832:e580]) by smtp.gmail.com with ESMTPSA id h18sm3540056wro.9.2022.02.03.10.24.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 03 Feb 2022 10:24:43 -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 v4 0/3] io_uring: avoid ring quiesce in io_uring_register for eventfd opcodes Date: Thu, 3 Feb 2022 18:24:38 +0000 Message-Id: <20220203182441.692354-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 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 first patch creates the RCU protected data structure and removes ring quiesce for IORING_REGISTER_EVENTFD and IORING_UNREGISTER_EVENTFD. The second patch builds on top of the first patch and removes ring quiesce for IORING_REGISTER_EVENTFD_ASYNC. --- 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 (3): 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 fs/io_uring.c | 127 +++++++++++++++++++++++--------- include/trace/events/io_uring.h | 13 ++-- 2 files changed, 96 insertions(+), 44 deletions(-) -- 2.25.1