Received: by 2002:a05:6358:53a8:b0:117:f937:c515 with SMTP id z40csp600121rwe; Fri, 14 Apr 2023 07:23:29 -0700 (PDT) X-Google-Smtp-Source: AKy350a/Cc5QRE9Vrq6TTdpv/aK2S5k/FfZHNSWacG6U0KJbxrQvLzk6SqAc2p09fYqP5mN1xV/F X-Received: by 2002:a17:902:e88d:b0:19c:be03:d1ba with SMTP id w13-20020a170902e88d00b0019cbe03d1bamr3690035plg.6.1681482209647; Fri, 14 Apr 2023 07:23:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681482209; cv=none; d=google.com; s=arc-20160816; b=ugarL+HpaN7lunSGw6cyoiwpwx4D0vDggH0N9oCkPwlRI4VdLxTGGmHvfpX6j2cQL5 KQ+PMPy/TdRWepLuD0JDjVoDkkjKBdXOPvP2u6sSxEKYdsutCXYIp/ef61FZ3J4Q3H7K GJ8JYAw6gf6euwmU1RciwTBzmwseyql0Pe52ZZvfrZL+ylcHv1nfrag38X2YTDq2iHAY KRzzh/n7FLh+TZmXXA9Oqv5iugjc7iQ03V1/qSOaMRL23TlmK4hrtkDhc6Ilj2pRL7OO rMPMd6mPHV+e50DYv/iRZWmuHyeq3hu1qpYL/5D0CzBKfGD0slHsvgUuquJBmpzo9b9a diGQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:subject:user-agent:mime-version:date:message-id :dkim-signature; bh=0khoLy+eSzRa5gLnIJcGGxbaem/Y8O3pCzVmwyuZdh8=; b=ABj0+VEyPpbOm2MvCKkU72tG1542noPfK8ri7oeCRB0jmuHZgvr1IhA5aH0YMM0HE9 i4XT9s5qkwPcWvXdYHSTvRscA7YLf2sMSHbbiKRqlJslt87UgC+T8vdyLci3JqlOvgjI ykRr5u8aDHj3/AKNimaGpqnrw/qGg3CUg64hRDavUK0LqoxUMgmqe93+AfiYtH/QxIwT GXXNmIIyZLQkRd2vhgZelN0O8BqJ5YdTtn0mhznmuQDtgVGyjpym+nMZ1WD3B0VL1vAI lMN24EyfLPe6UvMv0+0t6LkL1Z1CA6EU1IHRNzu5u/xEfsgXBM2DQS8KLimwxmpu6eEY g9sA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bytedance.com header.s=google header.b=aIsHBNmg; 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=pass (p=QUARANTINE sp=QUARANTINE 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 c2-20020a170903234200b001a68d4a42bfsi3950157plh.90.2023.04.14.07.23.15; Fri, 14 Apr 2023 07:23:29 -0700 (PDT) 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 header.s=google header.b=aIsHBNmg; 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=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=bytedance.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230344AbjDNOOJ (ORCPT + 99 others); Fri, 14 Apr 2023 10:14:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38600 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230324AbjDNOOI (ORCPT ); Fri, 14 Apr 2023 10:14:08 -0400 Received: from mail-pg1-x536.google.com (mail-pg1-x536.google.com [IPv6:2607:f8b0:4864:20::536]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 52FB4B769 for ; Fri, 14 Apr 2023 07:13:40 -0700 (PDT) Received: by mail-pg1-x536.google.com with SMTP id 41be03b00d2f7-5144043d9d1so1049897a12.3 for ; Fri, 14 Apr 2023 07:13:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance.com; s=google; t=1681481617; x=1684073617; h=content-transfer-encoding:in-reply-to:from:references:cc:to:subject :user-agent:mime-version:date:message-id:from:to:cc:subject:date :message-id:reply-to; bh=0khoLy+eSzRa5gLnIJcGGxbaem/Y8O3pCzVmwyuZdh8=; b=aIsHBNmgQ+I5xxhNUCld03Q4z6H1qoe/GoSM/gCG3+wIWLtddL8oXoNZjrSbJS/bX7 OVhihL6OXXevY79Zf81aJ6PLeaRS0d3iH/F4op/s0DIpUgLgnIs4xafEH1KD7kwmvkZ0 saKhz7L7R6O7RT7Aasc1MVzmcGgzFsnYITAoZvas3y7FPNGYUIlqL1BOPfvAhpgm8VKp 9iyg4vx6clQQDNddnpxk2zwOtmcyXYy/DSN0tNLAPnMtNPQHL73rQV6Ney5dmAxnVFkj K2ZqNi8YjxS7yHyeRcKQ5WqzaDqbwVq6j/yNpvUDhOuH74Pmhli9uEIgU0WZTKUcrlDb 6AlQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681481617; x=1684073617; h=content-transfer-encoding:in-reply-to:from:references:cc:to:subject :user-agent:mime-version:date:message-id:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=0khoLy+eSzRa5gLnIJcGGxbaem/Y8O3pCzVmwyuZdh8=; b=RScKb+uXKxq95fEPErC9N8E3F3YwPpWOEdjLhW/hi2GIWKUE9iN4mi5omkdBTE8FdY D6muYoT0CgaiMGN0BMf70uDd4zVCXsVXV7CijlKCziZdnDyImvmKdT1L1G7NQKOAI06I Xs67BkXQVaZ0hkZFHDZdJGtLfRYzeM3atJfc0WiutmzH34NkUnJAmtoVop3w4wBF1lOD /Ko9J+E3zhP39DcbiVjHBkvoDUxqy2r/6rrIDU3/KSgBOuhrkKlQ5FEwAi7kn15VnbCa MBeiTKCi3z7nmnRuV3pgrRk4L4d/XDY2EPGO4ZS6yk/JNRl3t99Fs0slwNB/6CLp7aJ+ P7hQ== X-Gm-Message-State: AAQBX9eyOErUL+qYtNj7NauvlmaJKuBKtca66hTTBk7nX2PXR1nc9GNa txQHcHvlXtUWgaD7A8L6LO5c879xqSB9cqwk56Uo2w== X-Received: by 2002:a05:6a00:178c:b0:63b:4e99:807d with SMTP id s12-20020a056a00178c00b0063b4e99807dmr7746205pfg.8.1681481616918; Fri, 14 Apr 2023 07:13:36 -0700 (PDT) Received: from [10.255.185.5] ([139.177.225.243]) by smtp.gmail.com with ESMTPSA id s20-20020aa78294000000b005921c46cbadsm3189981pfm.99.2023.04.14.07.13.33 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 14 Apr 2023 07:13:36 -0700 (PDT) Message-ID: <1a9c4365-aae1-b4fe-d31d-dfd9b42afae6@bytedance.com> Date: Fri, 14 Apr 2023 22:13:30 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.9.1 Subject: Re: Re: [PATCH V5 4/5] cachefiles: narrow the scope of triggering EPOLLIN events in ondemand mode To: David Howells Cc: linux-cachefs@redhat.com, linux-erofs@lists.ozlabs.org, linux-kernel@vger.kernel.org, jefflexu@linux.alibaba.com, hsiangkao@linux.alibaba.com, yinxin.x@bytedance.com, zhujia.zj@bytedance.com References: <20230329140155.53272-5-zhujia.zj@bytedance.com> <20230329140155.53272-1-zhujia.zj@bytedance.com> <1250225.1681480128@warthog.procyon.org.uk> From: Jia Zhu In-Reply-To: <1250225.1681480128@warthog.procyon.org.uk> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 在 2023/4/14 21:48, David Howells 写道: > Jia Zhu wrote: > >> if (cachefiles_in_ondemand_mode(cache)) { >> - if (!xa_empty(&cache->reqs)) >> - mask |= EPOLLIN; >> + if (!xa_empty(xa)) { >> + rcu_read_lock(); >> + xa_for_each_marked(xa, index, req, CACHEFILES_REQ_NEW) { >> + if (!cachefiles_ondemand_is_reopening_read(req)) { >> + mask |= EPOLLIN; >> + break; >> + } >> + } >> + rcu_read_unlock(); > > You should probably use xas_for_each_marked() instead of xa_for_each_marked() > as the former should perform better. > > David Hi David, Thanks for your advice. I'll revise it in next version. Jia >