Received: by 2002:a05:6358:53a8:b0:117:f937:c515 with SMTP id z40csp552373rwe; Fri, 14 Apr 2023 06:51:04 -0700 (PDT) X-Google-Smtp-Source: AKy350aVn6gF5GdCHKdnLkGl1+8sUp3qynBBQJ8OXjrtHpH8ufyFzvcNrdM01u2s+MY8OeSdLHEl X-Received: by 2002:a17:903:8c3:b0:19d:b02:cca5 with SMTP id lk3-20020a17090308c300b0019d0b02cca5mr2911087plb.12.1681480264009; Fri, 14 Apr 2023 06:51:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681480263; cv=none; d=google.com; s=arc-20160816; b=F8kxY1Po3IlCs5AaGybVzghAAIG+COXGxYAInA73gMnLydnWsfnaN6mZFnYbXpG2sO MJxPtjzMRxYPnXJFalh0AEJ92Rmdt6P/Su+DVZhnA2IGvTH/N5aqLWD+BSN3WjduNxty qptulDVezxACeBtKZFzmrAfrbLDpCM9CA2Rd4aI273lSYi8WOmIIbtppcS26rurEl5zL MLMpteUZXjOv6uJVLkipbHKOl8NadkYK2STfuH2yd9XzKWD+cZrR22xX3+2PBUh8MrK/ GXhq+9meqFbSxIBrGuEyxzlhW20NozTNZcRiB8dRf7jnwVB3/dOIvt6lFzUp8wmoTJ3t xO0Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:date:content-id:mime-version:subject :cc:to:references:in-reply-to:from:organization:dkim-signature; bh=n9KTxwucszaTPogQTyzYW05x/84ce5RmeI1lCrNY9JY=; b=CwIymimomN4xdPqczkSNMD7WygGJb3qe1aW9foQ5XMmiwJS2KV02buNBNWW9AD+ERo OgrSaXSe2pHj2Oa6LuuTjeHyG1Bt9+NB27KKLvG4WSH04CfdMPLH14BPwXs2a2geJz+3 FhGNdReeVg57KS6mtf5+yA1nMP2UZbdDKKvnc74Xip6VB49/XEej3WmZIQW93afxeENF tsENyM3kWrcQvBXjLGGXuu/pyXSto/0cg1iRdueF272vG76Kpynrhd0Qpg+nNwwaJd4/ buWUeZU+ZxMm7pcawOfs7ssvM6ngXzfK0ni7KDr3hkMcQQXXdkU8lNaXK6eAv1shgD+0 vX0w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=QtssD3cR; 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=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b23-20020a63eb57000000b004fb96b91c57si4712897pgk.125.2023.04.14.06.50.50; Fri, 14 Apr 2023 06:51:03 -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=@redhat.com header.s=mimecast20190719 header.b=QtssD3cR; 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=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229703AbjDNNuF (ORCPT + 99 others); Fri, 14 Apr 2023 09:50:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38536 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229735AbjDNNuD (ORCPT ); Fri, 14 Apr 2023 09:50:03 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7B741E4 for ; Fri, 14 Apr 2023 06:48:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1681480134; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=n9KTxwucszaTPogQTyzYW05x/84ce5RmeI1lCrNY9JY=; b=QtssD3cR/1Rrgizi0YHuavkP4o/nSrf3wtfvO6oiyjFye78srFyt91pICvRMTfdzRV/8+x 74R8P6WdAIdwfAh5u//wbluQcq5TkZlDgN4r12IgO4TM1bBAOkH0CmFB5XA/soX2XvzasH jwoA10ghDKpVS3kTtBAl7dBnSolZ/QU= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-536-RwSb7RRiNreUmN_e4zUG7w-1; Fri, 14 Apr 2023 09:48:51 -0400 X-MC-Unique: RwSb7RRiNreUmN_e4zUG7w-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id ACF8110334A6; Fri, 14 Apr 2023 13:48:50 +0000 (UTC) Received: from warthog.procyon.org.uk (unknown [10.33.36.5]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8577E2166B26; Fri, 14 Apr 2023 13:48:49 +0000 (UTC) Organization: Red Hat UK Ltd. Registered Address: Red Hat UK Ltd, Amberley Place, 107-111 Peascod Street, Windsor, Berkshire, SI4 1TE, United Kingdom. Registered in England and Wales under Company Registration No. 3798903 From: David Howells In-Reply-To: <20230329140155.53272-5-zhujia.zj@bytedance.com> References: <20230329140155.53272-5-zhujia.zj@bytedance.com> <20230329140155.53272-1-zhujia.zj@bytedance.com> To: Jia Zhu Cc: dhowells@redhat.com, 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 Subject: Re: [PATCH V5 4/5] cachefiles: narrow the scope of triggering EPOLLIN events in ondemand mode MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <1250224.1681480128.1@warthog.procyon.org.uk> Date: Fri, 14 Apr 2023 14:48:48 +0100 Message-ID: <1250225.1681480128@warthog.procyon.org.uk> X-Scanned-By: MIMEDefang 3.1 on 10.11.54.6 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE,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 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