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=1.2 required=5.0 tests=DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,NICE_REPLY_A, SPF_HELO_PASS,SPF_SOFTFAIL autolearn=no autolearn_force=no version=3.4.6 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1CDB7C43334 for ; Wed, 8 Jun 2022 11:28:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238180AbiFHL2R (ORCPT ); Wed, 8 Jun 2022 07:28:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48220 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238173AbiFHL2R (ORCPT ); Wed, 8 Jun 2022 07:28:17 -0400 Received: from mail-ed1-x531.google.com (mail-ed1-x531.google.com [IPv6:2a00:1450:4864:20::531]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BAD0B188E95 for ; Wed, 8 Jun 2022 04:28:14 -0700 (PDT) Received: by mail-ed1-x531.google.com with SMTP id w27so26601236edl.7 for ; Wed, 08 Jun 2022 04:28:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=message-id:date:mime-version:user-agent:subject:content-language:to :cc:references:from:in-reply-to:content-transfer-encoding; bh=ooa0ts79AhsM4MjeUdR7S19XIdWN9TmCmO69zPY+Sb8=; b=ITM033+xUinVgi0x+lJ5hziMfbItv9+EkKEwUgjZcNO86JrtLiWsOVDx9rwsSqCwZ/ pNx30atbY5esY7TRCG8N35xf07hsx1wSP/SCT/ph+zlDg6xtW1kbfJlN5W6DdPEt0zdL SKcP3PpIGvN6TUeld6g5nKYCInUU3s7GDlDgSH4XT4Gn4jIZOx9lz9IZ9RqHFleIP8+S jAupZdZLxndIuY5vhFmKPkOfEsqFBOGCL11IashGdA9Z7hDWntVUDJcsm157oMzxkxNB FB+1gvSdm8i42u0R9Qz/FWW9cJPUuvVSPqNPZI/3PreJ1Vqv898SnD3JF7R45kn9TNrf /gsw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent:subject :content-language:to:cc:references:from:in-reply-to :content-transfer-encoding; bh=ooa0ts79AhsM4MjeUdR7S19XIdWN9TmCmO69zPY+Sb8=; b=0ZQLXmK27pUyYgqZOtUBM5yo30zH6zPF1srMh+GctXv+NTv3q/VdhrcZoia8OuU676 +O5ePtJNkt4tt5JQ2QKsdCPsnAGJ8vWwd2vvBKOQrRqh7uXc0gJ7Bo2yMBaCOAW/7xr0 QTQ+pDJxumHNPkqn0GKY8JY6L/8eGkZV5Kld8pXyOFa7f0yzxiqKrTF+bdSSM4b2FIlA +522TLS3R2elDPHtk2BikxvznI2M97bTTMkLQ/n4JkCrRtgdmKhcrj/wDfYPGrKMkLLH ZpMhwLCkrqZ5D5Ucd1MHwiY7A94LISEhU9sCYKlic7k4PPV0+EUWpwzd+y0vW2X6CbNL w96A== X-Gm-Message-State: AOAM531vpZvhTrkDamyxyfldhXeLlwvqGVFRPOdhhARZCkvmwGjgyYdJ hGoQ3whLwQlF7lwMZoK5PkOf/bADzh4= X-Google-Smtp-Source: ABdhPJwlqka8bnjAJv8yfcwplbTPQCoB7wFoWVqXKZl9fsD4wpCSbbabS9hyllmC0SLMYKdcXDyytQ== X-Received: by 2002:a05:6402:1d4a:b0:42e:9ec8:320b with SMTP id dz10-20020a0564021d4a00b0042e9ec8320bmr30126718edb.119.1654687693160; Wed, 08 Jun 2022 04:28:13 -0700 (PDT) Received: from [192.168.8.198] (188.28.125.106.threembb.co.uk. [188.28.125.106]) by smtp.gmail.com with ESMTPSA id h9-20020a1709063b4900b007043b29dfd9sm8981604ejf.89.2022.06.08.04.28.12 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 08 Jun 2022 04:28:12 -0700 (PDT) Message-ID: Date: Wed, 8 Jun 2022 12:27:53 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.9.1 Subject: Re: [PATCH v3] io_uring: switch cancel_hash to use per entry spinlock Content-Language: en-US To: Hao Xu , io-uring@vger.kernel.org Cc: Jens Axboe References: <20220608111259.659536-1-hao.xu@linux.dev> From: Pavel Begunkov In-Reply-To: <20220608111259.659536-1-hao.xu@linux.dev> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: io-uring@vger.kernel.org On 6/8/22 12:12, Hao Xu wrote: > From: Hao Xu > > Add a new io_hash_bucket structure so that each bucket in cancel_hash > has separate spinlock. Use per entry lock for cancel_hash, this removes > some completion lock invocation and remove contension between different > cancel_hash entries. Thanks for making the changes, the big picture looks good, I'll review in a day or two > Signed-off-by: Hao Xu > --- > > v1->v2: > - Add per entry lock for poll/apoll task work code which was missed > in v1 > - add an member in io_kiocb to track req's indice in cancel_hash > > v2->v3: > - make struct io_hash_bucket align with cacheline to avoid cacheline > false sharing. > - re-calculate hash value when deleting an entry from cancel_hash. > (cannot leverage struct io_poll to store the indice since it's > already 64 Bytes) > > io_uring/cancel.c | 14 +++++++-- > io_uring/cancel.h | 6 ++++ > io_uring/fdinfo.c | 9 ++++-- > io_uring/io_uring.c | 8 +++-- > io_uring/io_uring_types.h | 2 +- > io_uring/poll.c | 64 +++++++++++++++++++++------------------ > 6 files changed, 65 insertions(+), 38 deletions(-) -- Pavel Begunkov