Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp271434rwl; Wed, 29 Mar 2023 01:18:02 -0700 (PDT) X-Google-Smtp-Source: AKy350ZujCuG6nftmos8WY0DlbKMBkC/lxh3dvedpQoP2p+tCgu4EEuLblRN5SYsfiYZX7DFg130 X-Received: by 2002:a17:906:fcc:b0:879:d438:4d1c with SMTP id c12-20020a1709060fcc00b00879d4384d1cmr20878234ejk.21.1680077882162; Wed, 29 Mar 2023 01:18:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680077882; cv=none; d=google.com; s=arc-20160816; b=XozviVEk6JAJdeFA8njxIsLy1zuRawyQ0Q+aDpgQ9zTWG+I4g+mRvo8ohP0OvPeLM0 7oOuMrvJD/XyRq357UcAZteVVteaXqWaj1CSwWWR53lz1BSGviqGOqLS/MnNuCSd6Fwr 3hU96GxpxLyP3WnskKYHQEzuGphKQa5Pf5QJrfkbSsXbybkmUyBzX3vQxC/K+8hhPJCV Udw8rtapC8PllDXsyPuz8PMIwBY1dOy63Q9e/TL62pDTQqOFDu2f5XS83gAamYyugUt5 24vhotUkvnNQ5fL8ibJXfQzj7z4z//1iAbCPio7MavRpv5nIKdsjq8o2W9d7VzbWkAFv aSSg== 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=mVRpG2dAr/nWYNSNRqghl5EEZFHlwrwTvwCgPASuUmU=; b=ollh+xtSO8C6XrOdPY0lHJYBAGBvPNSOe0l71ORdqx/VMTX5DlFHsAJlSY1WTdIRtl dgT8FSOpzH33D7VkDDFpb3nFGSiCeHFhby3983NKpAE9ET4/SbKLj3zhbjmsH9DZjBA0 zjLr9gAlkz0gaMC4ldAVi0cry5wD+yntqmTQPwJz1TFRUkK9xtt8bcWPBipPfxCbn4lk MsSdM1IxPkeWse5QoftaKSAySCiY0kJK4kmsdaRuMbYfWcoCmOG8k8EGkODY5zd3StnX EkM6nloF/tNlSHzSEglPCx2whS1kIaiwBU+NofWa6TjVhx5HPghg1dt/vBfzWJZEPG/A PNQw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bytedance.com header.s=google header.b=fjjwB2zF; 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 lv26-20020a170906bc9a00b008dc76bf3a69si26919540ejb.735.2023.03.29.01.17.38; Wed, 29 Mar 2023 01:18:02 -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=fjjwB2zF; 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 S230031AbjC2IJU (ORCPT + 99 others); Wed, 29 Mar 2023 04:09:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37322 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229750AbjC2IJS (ORCPT ); Wed, 29 Mar 2023 04:09:18 -0400 Received: from mail-pj1-x1030.google.com (mail-pj1-x1030.google.com [IPv6:2607:f8b0:4864:20::1030]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E0FC9210D for ; Wed, 29 Mar 2023 01:08:55 -0700 (PDT) Received: by mail-pj1-x1030.google.com with SMTP id e15-20020a17090ac20f00b0023d1b009f52so17796014pjt.2 for ; Wed, 29 Mar 2023 01:08:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance.com; s=google; t=1680077335; 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=mVRpG2dAr/nWYNSNRqghl5EEZFHlwrwTvwCgPASuUmU=; b=fjjwB2zFeG+SwWg0X1rPzwBGeccQqbojBL/azxEx/VC8yg0Qm5Sb+t0NfVOmibaucZ xCgCSTAIberX+90M1I05lsnIAWZKnB9rzQvEI+zmLP7W6dQiMeldn5j/30ESU917A/WM M2GmpY7IWQv5hQ/xwVyvv5I7gclcVvyIFEgTQzrHMxoWyew0bdrXRzjjgHy4jT+Wb9xQ jhWoxfiaJE+omv3VTH98A/tO9knUn3mdNKnpogad+NtkOsQmhW0NzBJWE4hOwd3sZ1G2 hxIXxoA+eJranOTs/dIbHJr/Ou4JCMK7MpqYQkOj3ZMsr7b/0+6HdBldsI8pWLe8CIwl rgig== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680077335; 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=mVRpG2dAr/nWYNSNRqghl5EEZFHlwrwTvwCgPASuUmU=; b=Fi3bXVVQw16ysTqQf579Q7UthZ5/T5ogHCxTfTN35SazV+6GfLYRZu1Kb3K9DoSsmT NXK+T/GAFijDSUkVVZc/HjQGbBlsw2Ifcz46vZvKUIFVwAkVzVoX+QHsa1nzESaWEOtJ cqrxD3CuC9FhDGQv1ObSs149dltxQHu7CpyaZNrATP9rcootESS/f7yW90ASxYKN8D6g 1IFk0pLhzgV7Ky0z6RBKaliA52X8GExtNH39kJo7zrVXUmVoU6pNM/7wQcPf8z2CUZO3 IrDOJQSwMieMmJ8Z0tLcwBrPNKLDFQz7g/q+nWSEasVKq5aSWOgypMR9QM0Egtc2BqeD g/mQ== X-Gm-Message-State: AAQBX9c/9dKztzojRW6MGOmGyx2ArN1HcQGtKG1mztKM13fDim3on+xC RBz8aSsIvw0XmuzUHkFmmBoXkQ== X-Received: by 2002:a17:90b:3ece:b0:23f:6edd:41da with SMTP id rm14-20020a17090b3ece00b0023f6edd41damr20304030pjb.29.1680077335048; Wed, 29 Mar 2023 01:08:55 -0700 (PDT) Received: from [10.3.144.50] ([61.213.176.11]) by smtp.gmail.com with ESMTPSA id b15-20020a17090ae38f00b002369e16b276sm859568pjz.32.2023.03.29.01.08.52 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 29 Mar 2023 01:08:54 -0700 (PDT) Message-ID: <2a39ced1-05f1-d696-1905-4ff5199fa41b@bytedance.com> Date: Wed, 29 Mar 2023 16:08:49 +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.0 Subject: Re: [External] Re: [PATCH V4 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-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, Xin Yin , Jingbo Xu , zhujia.zj@bytedance.com References: <20230111052515.53941-5-zhujia.zj@bytedance.com> <20230111052515.53941-1-zhujia.zj@bytedance.com> <133078.1680013145@warthog.procyon.org.uk> From: Jia Zhu In-Reply-To: <133078.1680013145@warthog.procyon.org.uk> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-0.2 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS autolearn=unavailable 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/3/28 22:19, David Howells 写道: > Jia Zhu wrote: > >> + if (!xa_empty(xa)) { >> + xa_lock(xa); >> + xa_for_each_marked(xa, index, req, CACHEFILES_REQ_NEW) { >> + if (!cachefiles_ondemand_is_reopening_read(req)) { >> + mask |= EPOLLIN; >> + break; >> + } >> + } >> + xa_unlock(xa); >> + } > > I wonder if there's a more efficient way to do this. I guess it depends on > how many reqs you expect to get in a queue. It might be worth taking the > rcu_read_lock before calling xa_lock() and holding it over the whole loop. > Thanks for the advice, will use rcu_read_lock(unlock) to replace it. > David >