Received: by 2002:a25:31c3:0:0:0:0:0 with SMTP id x186csp3710468ybx; Mon, 4 Nov 2019 01:29:26 -0800 (PST) X-Google-Smtp-Source: APXvYqz3huy/Ri6Imcw2IO38HTXcm9mPpBMPboWk9MeZ+NGB65yA0+ii/PVQxNwcBP4NN0QHZaVr X-Received: by 2002:a17:906:5010:: with SMTP id s16mr22445168ejj.67.1572859766610; Mon, 04 Nov 2019 01:29:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1572859766; cv=none; d=google.com; s=arc-20160816; b=dDCfZrJoNSWkSPjeEExmwXxucK1FY+Pt0jVGuyirZ4E++Nw75T1O/HvssSSPEDjO5y z9XJk0DJF1L8oE26+uXS7lib91/uloaziwpCECy6GAFuhdywQVKuVun9GJbbofkMkkHZ aYEP3oU8UYeN8uwqKBc4O7jRoD+B926B/08Ww96eok1GHXM/xez3eYBML6Ui0yD9fJuz zGyvZebxppTwnfsNRTwwOvRTsrjilekXe1X2M+at/YKKPgyadY6EJsY8pu/jgm+nvPKY +5H+uBpvJeLjwgIorFsgPDPQDgOTAtWqtg7OivyJIBXpuxsD4ISJUb62rZ3knxezvUPx EhCA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=Iy44L2dcqImsTpVpsb3zDktNfFWqpEmYcJOAa7eHtHM=; b=rTu9/oE5iCI6kovRRFfY+Nf9gbyAfR7jC4QhjGa19497Uryad14u8jtw/ZijQqQJMY X/XDMtbp0rpZ27FnQ9OKyDcOMe2p7nRuKEqRsbYT39Y2m0wiiIRMk9X8cn9nMIDdkA/I osBD1MfCSdAoPAy54xokloDBe959//Qe+NqGZulwig9qalIfVmXDkvJpFbPHTtLA1KB2 pNQXmDe4J+m2QgZMdGP9NgcpCTZNPMdXZi94blS8v93GQ8Egq9x2jkQRDqv3PP75xh2P LAL+UXGh3XU4Qn6DwrpXs0wfbk1AgulvoBgxyZNh6hgiLLqKvp1ymuHZFgG4H413XeeV CCdA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q15si1383358ejm.31.2019.11.04.01.29.02; Mon, 04 Nov 2019 01:29:26 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727444AbfKDJ0T (ORCPT + 99 others); Mon, 4 Nov 2019 04:26:19 -0500 Received: from Galois.linutronix.de ([193.142.43.55]:36766 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726100AbfKDJ0S (ORCPT ); Mon, 4 Nov 2019 04:26:18 -0500 Received: from bigeasy by Galois.linutronix.de with local (Exim 4.80) (envelope-from ) id 1iRYbv-0003QI-G0; Mon, 04 Nov 2019 10:25:19 +0100 Date: Mon, 4 Nov 2019 10:25:19 +0100 From: Sebastian Andrzej Siewior To: Lai Jiangshan Cc: linux-kernel@vger.kernel.org, Lai Jiangshan , Peter Zijlstra , Thomas Gleixner , Ingo Molnar , Borislav Petkov , "H. Peter Anvin" , x86@kernel.org, "Paul E. McKenney" , Josh Triplett , Steven Rostedt , Mathieu Desnoyers , Lai Jiangshan , Joel Fernandes , Andi Kleen , Andy Lutomirski , Fenghua Yu , Kees Cook , "Rafael J. Wysocki" , Dave Hansen , Babu Moger , Rik van Riel , "Chang S. Bae" , Jann Horn , David Windsor , Elena Reshetova , Yuyang Du , Anshuman Khandual , Richard Guy Briggs , Andrew Morton , Christian Brauner , Michal Hocko , Andrea Arcangeli , Al Viro , "Dmitry V. Levin" , rcu@vger.kernel.org Subject: Re: [PATCH V2 7/7] x86,rcu: use percpu rcu_preempt_depth Message-ID: <20191104092519.nukaz5qmgiskzafi@linutronix.de> References: <20191102124559.1135-1-laijs@linux.alibaba.com> <20191102124559.1135-8-laijs@linux.alibaba.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20191102124559.1135-8-laijs@linux.alibaba.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2019-11-02 12:45:59 [+0000], Lai Jiangshan wrote: > Convert x86 to use a per-cpu rcu_preempt_depth. The reason for doing so > is that accessing per-cpu variables is a lot cheaper than accessing > task_struct or thread_info variables. Is there a benchmark saying how much we gain from this? > We need to save/restore the actual rcu_preempt_depth when switch. > We also place the per-cpu rcu_preempt_depth close to __preempt_count > and current_task variable. > > Using the idea of per-cpu __preempt_count. > > No function call when using rcu_read_[un]lock(). > Single instruction for rcu_read_lock(). > 2 instructions for fast path of rcu_read_unlock(). I think these were not inlined due to the header requirements. Boris pointed one thing, there is also DEFINE_PERCPU_RCU_PREEMP_DEPTH. Sebastian