Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp3612518pxv; Mon, 28 Jun 2021 08:34:39 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzQ/ga/zmhfSnM07PyVSgf97lC7xEAHQNztu0fW9w12QU+KT6j0vUPun3pEsD5ba0jeRT+w X-Received: by 2002:aa7:d159:: with SMTP id r25mr33887327edo.281.1624894478976; Mon, 28 Jun 2021 08:34:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624894478; cv=none; d=google.com; s=arc-20160816; b=f2pCF9v7/aDCy9mTQR11duPsGUVH7mV15z/8MS8XyJ5VMZDOixOtOTb5UxPCYfUuiZ kRtkIZIdE8lYkUVKUjV51HQhFNPZQkZEvJ/rrIpSZeljInyxcRtxaqps+XLD+ImA1Oik kmQU484Smxgpy0rGV73W9fWa4PE+88hfqoGFKaS0kJmlYhDz9gDxwW5XDJ/Fur6HjAd6 mFPTplk8mHmh6EiZZgriCDyW9RUvNQ/NPj2UXJ5Jn+JpUarFCJYTdtFCpvaindvLXFiw VVBgUBUIj8WjhCLruRAkdxOgPao4DvKkt/OCz5+gXSFYTmqFb7PzoqM5T7dHOgYfSmpE iHUQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:date:cc:to:from:subject :message-id:dkim-signature; bh=FaeD9AmQHEt2mE0PEJIb3dFsJ6ZlasWo4jVhBDChLWs=; b=zgWxPrGKm69479E3Ze8auf5FaCl+Pieyvnlg9AljFPxXHPdl1KSTXSFfXuQMSTTxf7 PhoIkWY4gok0keyHpQI+fbh6VDpDnrAJJ/Yq/ZOWFKFLxycnzjwihIsgi8v8r47eTBy6 0V/WXunVphprtTa75ThiEe9CAp2euDbEz+LBpamW+SW82O7N/tEsH4y+d7eB1jTJONG7 8aCqnBNauE7PP50whLWklaf3cPKaCg+diEFmsYmXsKGbsmuIuCEDX3xIopo/0NL3beOA mqywHFW2YvvqRjigPueqzNnMQtDu2L6zgo1em8tTh636xqeTSTY7m9Df9tp6s5fCAYck 5d5Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=f6T2RU+X; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id h3si15556397edf.193.2021.06.28.08.34.12; Mon, 28 Jun 2021 08:34:38 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=f6T2RU+X; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237869AbhF1Pc1 (ORCPT + 99 others); Mon, 28 Jun 2021 11:32:27 -0400 Received: from mail.kernel.org ([198.145.29.99]:39676 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234885AbhF1PGr (ORCPT ); Mon, 28 Jun 2021 11:06:47 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id E755B61C82; Mon, 28 Jun 2021 14:44:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1624891456; bh=l8xIVzscZoiXeJLtkWgfbXmxS5FPm4sqJlwbpgvEvNU=; h=Subject:From:To:Cc:Date:In-Reply-To:References:From; b=f6T2RU+XRroYN17GYS5iHJ6ACK46Q/2zjffbEmz+PuebhcrPFv9t6S8ELE0RGQ23s VH6vHJSis7Epu7JeXq/6BzHKhFyfs12jBSaE+uxvs2uRGGSwIlwHpkcB+3qRCPabDE eiFivBPZ3PaItXbfakAsL+4Bkd3ua5E+aLveEgClieeODxw8KwiPQ4LmWLaH5X42as P8iJV6njt3flIsCC95389IrQWpZ2O5RY+3tbGC45aXST6fpvB8JyK5F50Z/qWQo/ZT ScI3aYvyF8krV9axcF5TTayV92ngSAUccvOpy3yj1tcPyqKm/yWd7g7I2zMzN9vfV4 rJIu4fr41MKtw== Message-ID: <3a993a4f2b302fd4fdb6f778f29f7f81db79adda.camel@kernel.org> Subject: Re: [RFC PATCH] ceph: reduce contention in ceph_check_delayed_caps() From: Jeff Layton To: Luis Henriques Cc: Ilya Dryomov , ceph-devel@vger.kernel.org, linux-kernel@vger.kernel.org, stable@vger.kernel.org Date: Mon, 28 Jun 2021 10:44:14 -0400 In-Reply-To: References: <20210625154559.8148-1-lhenriques@suse.de> Content-Type: text/plain; charset="ISO-8859-15" User-Agent: Evolution 3.40.2 (3.40.2-1.fc34) MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 2021-06-28 at 10:04 +0100, Luis Henriques wrote: > On Fri, Jun 25, 2021 at 12:54:44PM -0400, Jeff Layton wrote: > <...> > > I'm not sure this approach is viable, unfortunately. Once you've dropped > > the cap_delay_lock, then nothing protects the i_cap_delay_list head > > anymore. > > > > So you could detach these objects and put them on the private list, and > > then once you drop the spinlock another task could find one of them and > > (e.g.) call __cap_delay_requeue on it, potentially corrupting your list. > > > > I think we'll need to come up with a different way to do this... > > Ugh, yeah I see what you mean. > > Another option I can think off is to time-bound this loop, so that it > would stop after finding the first ci->i_hold_caps_max timestamp that was > set *after* the start of the current run. I'll see if I can come up with > an RFC shortly. > Sounds like a reasonable thing to do. The catch there is that those caps may end up being delayed up to 5s more than they would have, since schedule_delayed always uses a 5s delay. That delay could be made more dynamic if it becomes an issue. Maybe have the schedule_delayed callers calculate and pass in a timeout and schedule the next run for that point in the future? Then delayed_work could schedule the next run to coincide with the timeout of the next entry on the list. -- Jeff Layton