Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp1315068pxb; Thu, 21 Oct 2021 21:16:11 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzHctZpUteUMu+sG911j35W44/d4kKTq2YwBTBtiNdJmgnSt19voX/Jun+N6/TwtCkDXcu+ X-Received: by 2002:a05:6402:190f:: with SMTP id e15mr14023521edz.310.1634876170815; Thu, 21 Oct 2021 21:16:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634876170; cv=none; d=google.com; s=arc-20160816; b=PeXYOVcg+NU+nK9FQelf47kDTUFCPUUo9pbqtFQ+jsd2DHeuQJa521FYGd1yFVzt/D GtMxq0SidEgB07gXdyvq2dFgidntk9m7uCshT2KCvRtuiG5kuIxIHxzggGS+mG77JipL 9Kzna4+a7edHpFBw+rIltlQBx+RSpiW9XoiQWRfazGiUYmLmhOZ+x1s89/lxaLHJ6A1E 4/Rymex9qzzFZGILUQlAMPvl7zABXCJNWdqM9rgCGOTjHTK7gYg6mBZV/oeAkogQX/r0 KA5PlsL9/e70yXmt950qS/1XF3nj/zaQ3ps4SkipUll11GVYAOV/dYrLI4/EthCyl58k OUgA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=2RAf+30VthxJNIntOmbsMzoSO67ZM+hopN1JOMueg6M=; b=JR1viZ/xrU/BW/o8poo/yMkhzThd7sMypbttOnSoRWYHPIPbhWZAUfATX3iurpy36E bU5I7P3zkVdsz4G3WRgsW0o1xrYKR+rTYtMY/yOd7ShviNiFcSBFlFYeWTkn+2c/xe/8 dYReSxKSq1AJiKVCrYXI8Wqm+70OunrqNbxesxX0ppF0OSX63N6rrvx30mScbZpvroIf y23WaJ23ecVPFn3kU4lraI1oGBARtyOjo61yCjDxQE0cDAzwKetD+Edkxo6QpRZ/EAo+ m8dYBJRsQfFzqSQBInfxMDorSJBUfAIk2ZXT4A26Sff9U7R1ttvwUhgkDsi+jViHlk0X TI3Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=dg7AN74q; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id m9si13269902edd.600.2021.10.21.21.15.44; Thu, 21 Oct 2021 21:16:10 -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=@gmail.com header.s=20210112 header.b=dg7AN74q; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230238AbhJVEOZ (ORCPT + 99 others); Fri, 22 Oct 2021 00:14:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57046 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229463AbhJVEOY (ORCPT ); Fri, 22 Oct 2021 00:14:24 -0400 Received: from mail-io1-xd35.google.com (mail-io1-xd35.google.com [IPv6:2607:f8b0:4864:20::d35]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D2214C061764; Thu, 21 Oct 2021 21:12:07 -0700 (PDT) Received: by mail-io1-xd35.google.com with SMTP id z69so3679884iof.9; Thu, 21 Oct 2021 21:12:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=2RAf+30VthxJNIntOmbsMzoSO67ZM+hopN1JOMueg6M=; b=dg7AN74qs0MPTlN5NHxAgdYGSOPz9HPMqSd0/zLMqy5xUkkCPzNsEYMzq5K4XLiHkn 5PjBbP+3m+xLktvkqvXbX554XO/nDY+ue6z89QuuSElqQKtML+Sj4l344LNHmrZjrCfY Xq9I3v2rxsDuRo0VOcjt6gBD9QN/aKs+pJ1lKJKgGcWnOwTmtiKXtFRSkzGDPpfj7+zk C/oJwVHJkvzatohrAasGbVm7jDUxLSqPjdOn6wkC/NHl28fBrhc9pZ0tQLuWhEc9RE94 X8/tbmrPJfBf1Twq5srCOo6CAXxwUgeT+4XXmRyKnSASO03yRp1eb1FjIoUmCX4uw21E ezow== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=2RAf+30VthxJNIntOmbsMzoSO67ZM+hopN1JOMueg6M=; b=MpoX2rUfeu0k0cIlPehphkfO/ejEdXY5ffLkoscMSd6kD5sA9ptWSBfL3p8hRVcIT3 CywlYR24jAQTL4ti6AfIZ+QBRg/RA+ESArwsT92SA/8hMznEfJ/SKLqeVdBbuiTDVdIx W0PgDb1AhqpAmJbMFVr0jKx30PwA+k00EjUZ7CIyuLYgZ4oewVfdtPQD2IPivA7qpfTN c2ZBp7H76P3pRPgxhXAtQHVD0r6lYr0kKH/fMEwQ78QlVhbtCJWzBRtVG9jN7XbMxaFQ HgFA5GEd64Ct6Be1OAfLzmlqq9nDM1V8Dgnk5VxEs3yEBJfATmJ5bk5hcsoNvJH1wg4m d6tg== X-Gm-Message-State: AOAM530nu+FFuw9nevF8+Vs90twHfaxuUer+myXM2pGehPf9i3gtCvoL hEIXOGBk1HIPderdIDKqv7a1TGvGMg/cs1TlOwzihHfK1dI= X-Received: by 2002:a05:6602:1594:: with SMTP id e20mr7314773iow.14.1634875927330; Thu, 21 Oct 2021 21:12:07 -0700 (PDT) MIME-Version: 1.0 References: <20211020110638.797389-1-pbonzini@redhat.com> <659fbd82-7d18-0e76-6fe4-b311897b4ae0@redhat.com> In-Reply-To: <659fbd82-7d18-0e76-6fe4-b311897b4ae0@redhat.com> From: Lai Jiangshan Date: Fri, 22 Oct 2021 12:11:55 +0800 Message-ID: Subject: Re: [PATCH] rcuwait: do not enter RCU protection unless a wakeup is needed To: Paolo Bonzini Cc: Peter Zijlstra , LKML , kvm@vger.kernel.org, Davidlohr Bueso , Oleg Nesterov , Ingo Molnar , "Paul E . McKenney" , Wanpeng Li Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Oct 20, 2021 at 7:39 PM Paolo Bonzini wrote: > > On 20/10/21 13:17, Peter Zijlstra wrote: > > AFAICT, rcu_read_lock() for PREEMPT_RCU is: > > > > WRITE_ONCE(current->rcu_read_lock_nesting, READ_ONCE(current->rcu_read_lock_nesting) + 1); > > barrier(); > > rcu_read_unlock() is the expensive one if you need to go down > rcu_read_unlock_special(). > If "actual likelihood of a wakeup is very low." as stated in the changelog, the likelihood of rcu_read_unlock_special() is also very low. rcu_read_lock() for PREEMPT_RCU is a function call, is it relevant? (It is possible to remove the function call if the include-hell can be resolved or remove the function call via LTO or just remove the function call in X86 via percpu.) Thanks Lai > Paolo > > > Paul? >