Received: by 2002:ab2:3141:0:b0:1ed:23cc:44d1 with SMTP id i1csp583409lqg; Fri, 1 Mar 2024 14:29:36 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCUX3TBBSloNEPjAzE7ZB1nimjEdsxYbdq1YENSE6qIDk8fPJ0fDwGjb0zWWiqDbm/R2rz60sKg8bRUvUNZ+9rS8NAsvEueStqMyrnPHlw== X-Google-Smtp-Source: AGHT+IEgEd7qEQVRhnOEq4jdbOq/QlRhshVqUwDDGa9z8v2g/5R5apkzgOt4tOUZuux7Siil/5jR X-Received: by 2002:a0c:de01:0:b0:68c:7ca9:8e52 with SMTP id t1-20020a0cde01000000b0068c7ca98e52mr3464495qvk.56.1709332176487; Fri, 01 Mar 2024 14:29:36 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709332176; cv=pass; d=google.com; s=arc-20160816; b=lieyc4HRPFUKe6yhZ8OTyI2Mo9HCEFE1cRqPSGuja+hGIZfboEGECRnBSiDwt//mEk sK/75MEZjOoGBsj/qENdUt7FkjaR4n3nsrsdZU3Lc7TUHOoNmmMMjGg07S1iQaN0LRO/ TbxGbEdCp4PUCOdECmo0BQUQSgrLQ5AyPTv3GquCeA341AcMVvgfr03uYqEB8qk5y/ga bypxKpTpsSA6GNBXrjSHC/fXMsoRIsYYYsEGBqlO04xb7PvCkvt+mDgYXYRIWDSYiU63 tM0imIPBscu9OYF6src8/vcbVMg6o//Qr17HhBoZpPsFHE/4cEStdGUrCnycQBURSeLg Pddw== 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:reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=GJNqV5vkHOHqG6xVmrWOL8mp91r9n+ErNhvK6HSQNVQ=; fh=VUaf5418lkm9PIyFDEgZmTJti4lfz/mSAiC50UK1GcI=; b=kcY6oAEWZ+3d3jBsW5qichJhu9srmm6ia4ayXQJhNpLA6O25NcCbuUWEsUaaNMalJA ADhWfU8sQXBZI+avC/BHc7j5r2nYJ1rbNE8P1D2jZdF++Ktn2aULrBstFLmxM33JODuT eEUYYXhhjkOCebpNSnNSDWoAq3hS/Y8KB8woXXcnjpZ2X5ikk30VOQknQaHLWd7wEMqA DjpOPGZWAje5Kb9KjFnDamv2TumbaTMlxYee5G7MX8ENXGOysve3yF8jvLQ8DMN2LW3/ DZo5DRhwaDiuS4clcoHK/lsFyo/+9L+67V1fA3A1sf9GlSkDM3f6A1/1CEulZiajMUYN BGVQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=ZyKTYPwx; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-89198-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-89198-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id jr11-20020a0562142a8b00b0068f6580893dsi4371071qvb.134.2024.03.01.14.29.36 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Mar 2024 14:29:36 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-89198-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=ZyKTYPwx; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-89198-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-89198-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 3BD6F1C21562 for ; Fri, 1 Mar 2024 22:29:36 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 0767059B61; Fri, 1 Mar 2024 22:29:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="ZyKTYPwx" 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 1D71C3BB33; Fri, 1 Mar 2024 22:29:24 +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=1709332165; cv=none; b=t1ONf4TQukZ4fIZGzWadO9Zos2+UrWIbQM2P5QCCvPLwFe58tXnaG4echmR6NHu988MxyPUhDoPpmhxdhaAc0Ue9WBEP/9sqwrmIuSKVrn9QTijA6z9/c1HaYy4w1v30ws3OmBiwxSiMrNSzv30obf8lFgOWyeRqwXJhxnpO3q4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709332165; c=relaxed/simple; bh=5Xj1ur1qN0aF23NjoAtLbU1HDSoN1Q1krN4IozUzHS8=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=tkTn8UjOwT3VKhOUSUPugmpmDb6iv5nGWNPc5/bhj8+IidKhIdA4JjVANuAnpjmx9rhnd3+TiwGW6YdAHZih9Xfbn7L8+c4r9upb0hj5yEJu5J+Y1BEL+tBh/qJLEU3uNjdqLy/bNrzrZ376CsCBIrc8v9NWx+FZbZvC7itrgnw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=ZyKTYPwx; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 96062C433C7; Fri, 1 Mar 2024 22:29:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1709332164; bh=5Xj1ur1qN0aF23NjoAtLbU1HDSoN1Q1krN4IozUzHS8=; h=Date:From:To:Cc:Subject:Reply-To:References:In-Reply-To:From; b=ZyKTYPwxbK8Wo4eDEQ4y1DTJrke0mAEg32I1SIdrsksERipv9lSZGApGvsRLPh/DG RY4vXU1etymGhG88U97Lnl1v5N1Z+MAVrvcOGrxh8DaOxsDDDSQjRR0hbDUntXNqg9 cPibmPieh7K5sJW3jMHndyT0EkYCBC3t6BAyGdZUDtb6hL6rpyf7kkN9ZUVKtdUlAN eCTdhMJoemcPGfDWc8PbRXfiAFTbe/S6AvIV0TYF8h78CyjtBYjAX8MZyon9sCBJUI TID3yvumGoT79UVsrpmoXELbPTu2q8Pxnwjgl+m+BZm3zg7Q6SwmvEaj4WY81uIpOC xhLSx1/hnZPCQ== Received: by paulmck-ThinkPad-P17-Gen-1.home (Postfix, from userid 1000) id 2B6AFCE140C; Fri, 1 Mar 2024 14:29:19 -0800 (PST) Date: Fri, 1 Mar 2024 14:29:19 -0800 From: "Paul E. McKenney" To: Yan Zhai Cc: Eric Dumazet , netdev@vger.kernel.org, "David S. Miller" , Jakub Kicinski , Paolo Abeni , Jiri Pirko , Simon Horman , Daniel Borkmann , Lorenzo Bianconi , Coco Li , Wei Wang , Alexander Duyck , Hannes Frederic Sowa , linux-kernel@vger.kernel.org, rcu@vger.kernel.org, bpf@vger.kernel.org, kernel-team@cloudflare.com, Joel Fernandes , Toke =?iso-8859-1?Q?H=F8iland-J=F8rgensen?= , Alexei Starovoitov , Steven Rostedt , mark.rutland@arm.com Subject: Re: [PATCH v2] net: raise RCU qs after each threaded NAPI poll Message-ID: Reply-To: paulmck@kernel.org References: 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=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: On Fri, Mar 01, 2024 at 11:30:29AM -0600, Yan Zhai wrote: > Hi Eric, > > On Fri, Mar 1, 2024 at 2:30 AM Eric Dumazet wrote: > > > > I could not see the reason for 1sec (HZ) delays. > > > > Would calling rcu_softirq_qs() every ~10ms instead be a serious issue ? > > > The trouble scenarios are often when we need to detach an ad-hoc BPF > tracing program, or restart a monitoring service. It is fine as long > as they do not block for 10+ seconds or even completely stall under > heavy traffic. Raising a QS every few ms or HZ both work in such > cases. > > > In anycase, if this all about rcu_tasks, I would prefer using a macro > > defined in kernel/rcu/tasks.h > > instead of having a hidden constant in a networking core function. > > Paul E. McKenney was suggesting either current form or > > local_bh_enable(); > if (!IS_ENABLED(CONFIG_PREEMPT_RT)) > rcu_softirq_qs_enable(local_bh_enable()); > else > local_bh_enable(); > > With an interval it might have to be > "rcu_softirq_qs_enable(local_bh_enable(), &next_qs);" to avoid an > unnecessary extern/static var. Will it make more sense to you? I was thinking in terms of something like this (untested): #define rcu_softirq_qs_enable(enable_stmt, oldj) \ do { \ if (!IS_ENABLED(CONFIG_PREEMPT_RT) && \ time_after(oldj + HZ / 10, jiffies) { \ rcu_softirq_qs(); \ (oldj) = jiffies; \ } \ do { enable_stmt; } while (0) \ } while (0) Then the call could be "rcu_softirq_qs_enable(local_bh_enable(), last_qs)", where last_qs is initialized by the caller to jiffies. The reason for putting "enable_stmt;" into anothor do-while loop is in case someone typos an "else" as the first part of the "enable_stmt" argument. Would that work? Thanx, Paul