Received: by 2002:ab2:7a55:0:b0:1f4:4a7d:290d with SMTP id u21csp328325lqp; Thu, 4 Apr 2024 14:42:49 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVJ+VI5a2C5Xf+i6kcAyvEDXes/tCNjUJa8zW1FwBWwNGmAlC21XcvEJHXotwjIJRJKtmDc6enseat8WtXRa7NvE5+QgZoUosGyNWCMeg== X-Google-Smtp-Source: AGHT+IFOXJ5kEmIOZyQVJIcCE/poWrBC+8PAHJ1Hcne9ziCWfsLZJT5+b1GPR4JVFhRkgvdr2Ge6 X-Received: by 2002:a17:902:bc4c:b0:1e2:3078:c00e with SMTP id t12-20020a170902bc4c00b001e23078c00emr774180plz.20.1712266968976; Thu, 04 Apr 2024 14:42:48 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712266968; cv=pass; d=google.com; s=arc-20160816; b=LCDXfKYfOi0Xkw4keLYGoF0svVUhwRe3quC4Q9BYRgSWMS1e7QgdX3nAG4lvYtIX4R Lgj8Fw+0zksFTiyjUPp6NJJYBMktB4mw73QHabH4EVP1yrzVGXbWoo8kho67dpeVMm7W kq445TRyJHeQGKkfLxj6hRMF0aGo6p7j9wrkhQoeczuv2qus8NHNFBznXy/bkVEY9lHD L2OOjawKBElJFcS3fiEtePOzQr0NtJLMF51XDfw5DClPTcy6jrwc02qIgh31pLlax8iA Q32fuuvmZqbyCOI/YCrBDPaloX+vUChAkYeTzz2FUxOngcQo9DcXHdu43TVTqjafvGMA sDZw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :references:message-id:subject:cc:to:from:date:dkim-signature; bh=6F4iF8L+1YkUC20EolBITQFz/nS89GdTjraUte6v2bw=; fh=KLjmOtprTXTdD97ZXE01kFWGqSP/jAw+vwkQDuUlrkg=; b=q6RS33LoIBXkLh8mxjgOJxPU+PRRoMhh/0xXlTKMiIr8Igz6hRyc03aHtGTUUObJcv 6IEcs127XeJRLEvmJ8XxCcFWAyGGoE4e6yJXiZLEkfZdcXYLmk0NPot7XbtamkxDuFrp HnqSpvPQDCYWHDRMv8n1scQrkNWeV19W4TWAxUm6HbfGCETy+HZ/npqCIE4TXnTw49yI r//xK3mk5dPeFQRJrcQwLZvqXvPgRpiN0CVJ9lLmE7t6pzcFY5mwhhVLtuPZexqoOKRx Xufwn24ZL1JbpJerw0TIPc4GLzB85rpRuZkim/y7Paw0NA9KtreSDsZ5duvGICtOw/AD qbew==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=VrJJUjBj; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-132170-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-132170-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id i13-20020a170902c94d00b001e10a526a94si164459pla.129.2024.04.04.14.42.48 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Apr 2024 14:42:48 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-132170-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=VrJJUjBj; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-132170-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-132170-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org 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 sv.mirrors.kernel.org (Postfix) with ESMTPS id A21A0281E5A for ; Thu, 4 Apr 2024 21:42:48 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id BE17813C3C2; Thu, 4 Apr 2024 21:42:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="VrJJUjBj" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 E19E482D90; Thu, 4 Apr 2024 21:42:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712266962; cv=none; b=ATyFr2AOsL0sghQ6Lvc2+jHUR5OKH0FOoTZ5feG78v82iA/Gfsx8bCa07kekSOSXF7XZWOkkD+DgCN+ME6SkuAN++fZ8S+pf3YHRNr5t4PDl+T7XfZUMcnQIBknkpXG/0meSOnz98CXwKSVcPvBGgvNdtYv6qBL/QL6uP4OBKDM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712266962; c=relaxed/simple; bh=Xyh52LJT/Gq5z0Hoib95KyYOLCM70uEqSNbBLWZh9cw=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=SvklDP4XYbHueVg7usHUyo7oxXYLM8SJjkAnto32cW/whWz+UVOPY9nwEAEZ5L3mdAWA/Eml4Vu0cVCUTysVbXFgjpQMsRiwLTojQy6aJNsZmN6Ejh6KybJROY0xLGjFxUhAZnIcNigfquntJWFzo5ycfWsC8rC/7bbrNLi07F8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=VrJJUjBj; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id DDBAEC433F1; Thu, 4 Apr 2024 21:42:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1712266961; bh=Xyh52LJT/Gq5z0Hoib95KyYOLCM70uEqSNbBLWZh9cw=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=VrJJUjBjtvE5nSfzJg7iyIX1RC55IgB5MVx3PESMue0xrJZlkr56PK9AuYMWai7Dm arZdeSo4SuOHJ+UJYZL823GXxYtbJJSUV8Po93pjIhXqzTYPz4LqXgH63HA/dD7oTd DJ164AkiMz4Z10MhIduLAapP14qFgEnY0znpfibK68q1ocwgWSVhLf+WX9uKWXl3jK yuUS3syeccAeycsdbyLVk8vE8N29vIv/Xc+NcbJJ0jaQjSfuS5XELHZS9UrDE9TgiE NFpWIxmDtm8jHLwf9EbWR4odMEc0kbI1Jnszh7V6BYQhI91n+d1kpkrWbeBhv4Ugac EvhI57RoGOU5Q== Date: Thu, 4 Apr 2024 23:42:38 +0200 From: Frederic Weisbecker To: Neeraj Upadhyay Cc: paulmck@kernel.org, joel@joelfernandes.org, urezki@gmail.com, josh@joshtriplett.org, boqun.feng@gmail.com, rostedt@goodmis.org, mathieu.desnoyers@efficios.com, jiangshanlai@gmail.com, qiang.zhang1211@gmail.com, rcu@vger.kernel.org, linux-kernel@vger.kernel.org, neeraj.upadhyay@kernel.org Subject: Re: [PATCH v2] rcu: Reduce synchronize_rcu() delays when all wait heads are in use Message-ID: References: <20240403105212.237354-1-Neeraj.Upadhyay@amd.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20240403105212.237354-1-Neeraj.Upadhyay@amd.com> Le Wed, Apr 03, 2024 at 04:22:12PM +0530, Neeraj Upadhyay a ?crit : > When all wait heads are in use, which can happen when > rcu_sr_normal_gp_cleanup_work()'s callback processing > is slow, any new synchronize_rcu() user's rcu_synchronize > node's processing is deferred to future GP periods. This > can result in long list of synchronize_rcu() invocations > waiting for full grace period processing, which can delay > freeing of memory. Mitigate this problem by using first > node in the list as wait tail when all wait heads are in use. > While methods to speed up callback processing would be needed > to recover from this situation, allowing new nodes to complete > their grace period can help prevent delays due to a fixed > number of wait head nodes. > > Signed-off-by: Neeraj Upadhyay Looking at it again, I'm not sure if it's a good idea to optimize the thing that far. It's already a tricky state machine to review and the workqueue has SR_NORMAL_GP_WAIT_HEAD_MAX - 1 = 4 grace periods worth of time to execute. Such a tense situation may happen of course but, should we really work around that? I let you guys judge. In the meantime, I haven't found correctness issues: Reviewed-by: Frederic Weisbecker Thanks.