Received: by 2002:ab2:69cc:0:b0:1fd:c486:4f03 with SMTP id n12csp74299lqp; Mon, 10 Jun 2024 19:12:26 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWL3ZYDTWc07eWPuXStXVsJ2E+L+wcN8pp0g6we5a9gb6tOujFKWKbj4/LHY22GE9O/kLdX8vtuneA0gNPkEaXOdtydQBzd5aK7N/kcRg== X-Google-Smtp-Source: AGHT+IE6oGdrNbfrCscYgIJ/oHw86gudNmpiBeK0Lsfu36cdl9lbP0r+Rb8aihRDeBNfHVBup6ju X-Received: by 2002:a17:906:1547:b0:a6f:376a:fda3 with SMTP id a640c23a62f3a-a6f376afe94mr37128266b.10.1718071946275; Mon, 10 Jun 2024 19:12:26 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1718071946; cv=pass; d=google.com; s=arc-20160816; b=LbU+qhRoxPoisiIERaWQsNTqwG7a1i0NiQRwWEqjeVTxIAXmZra29vY6WAfg7N/Qh2 sLVpAcrdTQUR0QPuqoqeTy866KxjuyfSQ/XkKhVwJnpKpCP4QbRWW3BMB+vRhLnYyk7y Odi+/Riv8iPoc7BN9RATX2J8OkobnHQ7+lcwXiNQm5D+JYiJ29MFqA8DT8ZzvHp38xAU eKjlxWqafnex5fTbdJAH4qaqAXCiIlOxt/5Vm7GE21OpirFTbBI2geWrtKS1jD20Q7tv DTZ6qXK7zs75jeK4/HS/cuPLvUkw0Afsmv25glqEjhyw4i6kP/l8ileaa3rnGW4oK3UZ s98A== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id:dkim-signature; bh=Rl1gGO4UgKTAEFs1CZF/0wGX2Tf6+LMOtr2l88VGC+Q=; fh=fmkWZIBGxx+guUalPU1e+ts+4nGfA9X9E6w8PbCpRNs=; b=asdeUeArXtPyBXNO0SA1W93oKF/uyj90eM6fpIarFJh0VW2O7dL8AFugINt9Ya4ciE r3Dge7qBzqDHe+6CewjAC3uJ1dDeSyTVvxAPAA+WInMfBrbOiizVBnVysVoEQOq9MpCD ociuHEzkbEGCVVsaJVGOqEAWhYyCKybySe3M5xAmKmmuw5Rk7rkVCccLxUDkmE9p8cmB T/gsseINzKWrs0I7aE5YPOmQR779AMH3E94HvgqJwg1yG9uRL11j3r6w+vn/lqB4iqP0 cI1x0nEJMzFiFyDL8dnQo2yqFmxgYkUPaaK5QMe7z4cjLebua1qIaeFdw2fGEaVq/9l2 Eygw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="J/AGzViK"; arc=pass (i=1 spf=pass spfdomain=redhat.com dkim=pass dkdomain=redhat.com dmarc=pass fromdomain=redhat.com); spf=pass (google.com: domain of linux-kernel+bounces-209173-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-209173-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id a640c23a62f3a-a6e33beee41si373110366b.183.2024.06.10.19.12.26 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 10 Jun 2024 19:12:26 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-209173-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="J/AGzViK"; arc=pass (i=1 spf=pass spfdomain=redhat.com dkim=pass dkdomain=redhat.com dmarc=pass fromdomain=redhat.com); spf=pass (google.com: domain of linux-kernel+bounces-209173-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-209173-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id CD0261F231A5 for ; Tue, 11 Jun 2024 02:12:25 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 52F94BE78; Tue, 11 Jun 2024 02:12:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="J/AGzViK" Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B929733D8 for ; Tue, 11 Jun 2024 02:12:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718071934; cv=none; b=RnUL3vR2atTX5j7QOJu/t7kqoZ3xJHd5YvKmCp2poLXvSIPhS6HmM2BZ+Fnv1Mcuj4SzbsJV5DpRpnZBtgVA9DPQ1qPgZH7j9y2v7s3WJjePkf+vPlnsdhKPJhsKVn4DQ0bZbdA3qgtaWtf9F7QEzhqUgwSFZTCmYGUHVzWDxdA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718071934; c=relaxed/simple; bh=6xP1ei76jr5aHAJqlhhcWItU2AXyK4KV8+AWVUgjv+A=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=QK02aYxz/kRhJiABFGNQbLSbVTtVT7QggA8HY3OI37ugT8kLJZl8sx+16pydA0z8d7ZZ/T1izH3FMAnGRmRzAuFB9zglhgsuljfscDYl7EiWIEIRknsXlvGp46VWRODBEI9MXoZPZ/MeZoMIZ0n4UH5kSUuM5GGizZ4XSPTfh+o= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=J/AGzViK; arc=none smtp.client-ip=170.10.129.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1718071931; 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: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Rl1gGO4UgKTAEFs1CZF/0wGX2Tf6+LMOtr2l88VGC+Q=; b=J/AGzViKK2rqqivt1Gj1TUFGyadTksiNXYii3+u4xg0Li/aLLttmi1SqvY5PGpy1CLDSNr uoIANqrX3Ju/uL2SaR4mYs2dq81JO1bWtJXq9e77IGuUwhO0tspeAvltFXw5t2MYs1bAzQ tOi0k1nq42E3RYkQficUOY8sHRuyLKk= Received: from mail-pj1-f71.google.com (mail-pj1-f71.google.com [209.85.216.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-77-qpqaSwZ9N4S0SXqrw_1BPw-1; Mon, 10 Jun 2024 22:12:06 -0400 X-MC-Unique: qpqaSwZ9N4S0SXqrw_1BPw-1 Received: by mail-pj1-f71.google.com with SMTP id 98e67ed59e1d1-2bf5bb2a414so4783441a91.1 for ; Mon, 10 Jun 2024 19:12:06 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718071926; x=1718676726; h=content-transfer-encoding:in-reply-to:from:content-language :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=Rl1gGO4UgKTAEFs1CZF/0wGX2Tf6+LMOtr2l88VGC+Q=; b=OqDhNprzmcsNDtj+Ocv3Xul0o85oZMa3fp4FWwahEX2/zuonL2FkXsjNiFyA/DMHWx yagJ2lRjWUHB53dm9pZj5pqwmFQ+o7+RZC69sVibOgyA91UNpRrzCkQ87G69k6bPoYB+ FtL1Zq5Xq/NLgjx8mohizCRTYSV8e91dZCcCjgKveHHXes3YAW8mkdnPmIXNCGFpgGlL o2chaGezvENu7YZLiN71AeGujVZQ7GY3mBvlgl5bmAmeXqTkfuuEtzinIbIv9DFzH8ad +cdMNXUWgAZzfqlnBlgGc9j8XzVd/2x7QbhI75Z3CwRxUNubL2IY5olVS4mk0hqV7QoW pXjA== X-Gm-Message-State: AOJu0YzMmAl0/HDha614eaz0L3YMsJAw+Qd71WDqjOmIFb8J5Su3IzqL fpT8IvWPrKbH317Wyz5jNUioXsJ+oR1Dxmbbg6ENugWgLbdaUnx5kw9PDXso7wpXbG/XtePd4Uk 1ZXlJY1FqgJDIAeMblAqweKv4px/r2JORpK4IMu56IITVdPdzvcSomKCmcZCEYQ== X-Received: by 2002:a17:902:d2c8:b0:1f2:fc8b:ebfe with SMTP id d9443c01a7336-1f6d0389353mr119517825ad.48.1718071925837; Mon, 10 Jun 2024 19:12:05 -0700 (PDT) X-Received: by 2002:a17:902:d2c8:b0:1f2:fc8b:ebfe with SMTP id d9443c01a7336-1f6d0389353mr119517745ad.48.1718071925468; Mon, 10 Jun 2024 19:12:05 -0700 (PDT) Received: from [10.72.116.2] ([43.228.180.230]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-1f6bd778fc2sm89270965ad.119.2024.06.10.19.12.02 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 10 Jun 2024 19:12:05 -0700 (PDT) Message-ID: Date: Tue, 11 Jun 2024 10:11:44 +0800 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] fs/ceph/mds_client: use cap_wait_list only if debugfs is enabled To: Max Kellermann , idryomov@gmail.com, ceph-devel@vger.kernel.org Cc: linux-kernel@vger.kernel.org References: <20240606164157.3765143-1-max.kellermann@ionos.com> Content-Language: en-US From: Xiubo Li In-Reply-To: <20240606164157.3765143-1-max.kellermann@ionos.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 6/7/24 00:41, Max Kellermann wrote: > Only debugfs uses this list. By omitting it, we save some memory and > reduce lock contention on `caps_list_lock`. > > Signed-off-by: Max Kellermann > --- > fs/ceph/caps.c | 6 ++++++ > fs/ceph/mds_client.c | 2 ++ > fs/ceph/mds_client.h | 6 ++++++ > 3 files changed, 14 insertions(+) > > diff --git a/fs/ceph/caps.c b/fs/ceph/caps.c > index c4941ba245ac..772879aa26ee 100644 > --- a/fs/ceph/caps.c > +++ b/fs/ceph/caps.c > @@ -3067,10 +3067,13 @@ int __ceph_get_caps(struct inode *inode, struct ceph_file_info *fi, int need, > flags, &_got); > WARN_ON_ONCE(ret == -EAGAIN); > if (!ret) { > +#ifdef CONFIG_DEBUG_FS > struct ceph_mds_client *mdsc = fsc->mdsc; > struct cap_wait cw; > +#endif > DEFINE_WAIT_FUNC(wait, woken_wake_function); > > +#ifdef CONFIG_DEBUG_FS > cw.ino = ceph_ino(inode); > cw.tgid = current->tgid; > cw.need = need; > @@ -3079,6 +3082,7 @@ int __ceph_get_caps(struct inode *inode, struct ceph_file_info *fi, int need, > spin_lock(&mdsc->caps_list_lock); > list_add(&cw.list, &mdsc->cap_wait_list); > spin_unlock(&mdsc->caps_list_lock); > +#endif // CONFIG_DEBUG_FS > > /* make sure used fmode not timeout */ > ceph_get_fmode(ci, flags, FMODE_WAIT_BIAS); > @@ -3097,9 +3101,11 @@ int __ceph_get_caps(struct inode *inode, struct ceph_file_info *fi, int need, > remove_wait_queue(&ci->i_cap_wq, &wait); > ceph_put_fmode(ci, flags, FMODE_WAIT_BIAS); > > +#ifdef CONFIG_DEBUG_FS > spin_lock(&mdsc->caps_list_lock); > list_del(&cw.list); > spin_unlock(&mdsc->caps_list_lock); > +#endif > > if (ret == -EAGAIN) > continue; > diff --git a/fs/ceph/mds_client.c b/fs/ceph/mds_client.c > index c2157f6e0c69..62238f3e6e19 100644 > --- a/fs/ceph/mds_client.c > +++ b/fs/ceph/mds_client.c > @@ -5505,7 +5505,9 @@ int ceph_mdsc_init(struct ceph_fs_client *fsc) > INIT_DELAYED_WORK(&mdsc->delayed_work, delayed_work); > mdsc->last_renew_caps = jiffies; > INIT_LIST_HEAD(&mdsc->cap_delay_list); > +#ifdef CONFIG_DEBUG_FS > INIT_LIST_HEAD(&mdsc->cap_wait_list); > +#endif > spin_lock_init(&mdsc->cap_delay_lock); > INIT_LIST_HEAD(&mdsc->cap_unlink_delay_list); > INIT_LIST_HEAD(&mdsc->snap_flush_list); > diff --git a/fs/ceph/mds_client.h b/fs/ceph/mds_client.h > index cfa18cf915a0..13dd83f783ec 100644 > --- a/fs/ceph/mds_client.h > +++ b/fs/ceph/mds_client.h > @@ -416,6 +416,8 @@ struct ceph_quotarealm_inode { > struct inode *inode; > }; > > +#ifdef CONFIG_DEBUG_FS > + > struct cap_wait { > struct list_head list; > u64 ino; > @@ -424,6 +426,8 @@ struct cap_wait { > int want; > }; > > +#endif // CONFIG_DEBUG_FS > + > enum { > CEPH_MDSC_STOPPING_BEGIN = 1, > CEPH_MDSC_STOPPING_FLUSHING = 2, > @@ -512,7 +516,9 @@ struct ceph_mds_client { > spinlock_t caps_list_lock; > struct list_head caps_list; /* unused (reserved or > unreserved) */ > +#ifdef CONFIG_DEBUG_FS > struct list_head cap_wait_list; > +#endif > int caps_total_count; /* total caps allocated */ > int caps_use_count; /* in use */ > int caps_use_max; /* max used caps */ Reviewed-by: Xiubo Li