Received: by 2002:a25:31c3:0:0:0:0:0 with SMTP id x186csp1881181ybx; Sat, 2 Nov 2019 08:06:42 -0700 (PDT) X-Google-Smtp-Source: APXvYqzbfSITynxc/8WQ8wHM78zbMwgMigF8EEgdRPGOpxKDL/6ve8ThuzlZ+oa5Ly1ik3R+6IRt X-Received: by 2002:aa7:d704:: with SMTP id t4mr19548052edq.23.1572707202623; Sat, 02 Nov 2019 08:06:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1572707202; cv=none; d=google.com; s=arc-20160816; b=vqIqYcBXHJkA5AvVmsA1+tUiU3exMABpXXJdo0hv+MF+PdW+TOGtLRXn0bd8cLqRXY 1rTet9qodl72SKjT0HWyq3Gj4NkLDHZYakOrTytH9mqJmJ5B/Wyyws2RlPozXisoGn+c urNromPBPGGprThvFWKElZbh0dgZA/xa1NM5awplaORp5hShtCTw7HtPYCh65kLy5CdN fiDdYIBZ0rLN87ET5fdnwCwZXJXwmA55bo6sgEgwmuqnHXPa3U0n2pIlKf5t8G3ZWskg Ab0lkVh7dQsZOzav/auc5A5HIPpZ3VlckMtOANYO7pAXAV0bKmGrE2zBldB5tZQXWY6A NCKw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:reply-to:message-id :subject:cc:to:from:date:dkim-signature; bh=uc2T7MUgj8ZerVFrQhHJq2SRmKMLLeqMaPBVbBWYIIc=; b=BlaC7ynfDxvnWGFG4pAmKCUyRvlmtb/X7cyWmcxqS0VDDx1xBKaBIjqn4Cbu+KelHE ZU27eUZJK1mBmuu+ejOgADYfDBJKqtHzXFSZeQUwONS0itFz4OObM7wV4U5b8dExIM/Q HDK/ttXWTr8B+nyxK5xB+omEq59FTA1pmKZmTSlJuLy9SPEtawucAC/9ocCQbMoI/aIN gp5XuGooDa51+xIAJEq81E1X+S21g+sjAyy6uJspqnGsCjsW7SDhj05AvrXjsKT4jjcE CPfGxV9Mo4K5yH9fZEsroAEOZphABsLNvjmWaKJvaIiWlrVXMF6akilBststNXNbb/0H VieQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=xyA4AUF+; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x31si3412900eda.334.2019.11.02.08.06.17; Sat, 02 Nov 2019 08:06:42 -0700 (PDT) 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; dkim=pass header.i=@kernel.org header.s=default header.b=xyA4AUF+; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726574AbfKBPFr (ORCPT + 99 others); Sat, 2 Nov 2019 11:05:47 -0400 Received: from mail.kernel.org ([198.145.29.99]:60352 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726437AbfKBPFr (ORCPT ); Sat, 2 Nov 2019 11:05:47 -0400 Received: from paulmck-ThinkPad-P72.home (50-39-105-78.bvtn.or.frontiernet.net [50.39.105.78]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 8B22121726; Sat, 2 Nov 2019 15:05:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1572707145; bh=1y5Bat7vPpY5QvpEoK0Vmi+ZYimxQEsWhingPtGW4ow=; h=Date:From:To:Cc:Subject:Reply-To:References:In-Reply-To:From; b=xyA4AUF+tlW9jBhFFCq7g81+9RfzwNjco+NkamqnMOz5TkvNuXuH6jgjmTtUacd+v fYAGzZJhpWIwp8Bc0gy4EE2ZRFBR0Bpj3XRNSdmzf0A542iPAVeaxcxs8BsNLa0Bj6 vjebbariy1/0tvrXQJ+opODbI2VOub3kxsivCug8= Received: by paulmck-ThinkPad-P72.home (Postfix, from userid 1000) id 555153520402; Sat, 2 Nov 2019 08:05:45 -0700 (PDT) Date: Sat, 2 Nov 2019 08:05:45 -0700 From: "Paul E. McKenney" To: Lai Jiangshan Cc: linux-kernel@vger.kernel.org, Josh Triplett , Steven Rostedt , Mathieu Desnoyers , Lai Jiangshan , Joel Fernandes , rcu@vger.kernel.org Subject: Re: [PATCH V2 0/7] rcu: introduce percpu rcu_preempt_depth Message-ID: <20191102150545.GQ20975@paulmck-ThinkPad-P72> Reply-To: paulmck@kernel.org References: <20191102124559.1135-1-laijs@linux.alibaba.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20191102124559.1135-1-laijs@linux.alibaba.com> User-Agent: Mutt/1.9.4 (2018-02-28) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, Nov 02, 2019 at 12:45:52PM +0000, Lai Jiangshan wrote: > Rather than using the generic version of preempt_count, x86 uses > a special version of preempt_count implementation that take advantage > of x86 (single instruction to access/add/decl/flip-bits of percpu > counter). It makes the preempt_count operations really cheap. > > For x86, rcu_preempt_depth can also take the same advantage by > using the same technique. > > After the patchset: > - No function call when using rcu_read_[un]lock(). > It is minor improvement, other arch can also achieve it via > moving ->rcu_read_lock_nesting and ->rcu_read_unlock_special > to thread_info, but inlined rcu_read_[un]lock() generates > more instructions and footprint in other arch generally. > - Only single instruction for rcu_read_lock(). > - Only 2 instructions for the fast path of rcu_read_unlock(). > > Patch4 simplifies rcu_read_unlock() by avoid using negative > ->rcu_read_lock_nesting, Patch7 introduces the percpu rcu_preempt_depth. > Other patches are for preparation. > > changed from v1: > drop patch1/2 of the v1 > drop merged patches > > Using special.b.deferred_qs to avoid wakeup in v1 is changed to using > preempt_count. And special.b.deferred_qs is removed. > > Lai Jiangshan (7): > rcu: use preempt_count to test whether scheduler locks is held > rcu: cleanup rcu_preempt_deferred_qs() > rcu: remove useless special.b.deferred_qs > rcu: don't use negative ->rcu_read_lock_nesting > rcu: wrap usages of rcu_read_lock_nesting > rcu: clear the special.b.need_qs in rcu_note_context_switch() > x86,rcu: use percpu rcu_preempt_depth I am getting on a plane shortly, so what I have done is start a longish rcutorture test on these. I will take a look at them later on. And I presume that answers to my questions on some of the patches in this series will be forthcoming. ;-) Thanx, Paul > arch/x86/Kconfig | 2 + > arch/x86/include/asm/rcu_preempt_depth.h | 87 +++++++++++++++++++ > arch/x86/kernel/cpu/common.c | 7 ++ > arch/x86/kernel/process_32.c | 2 + > arch/x86/kernel/process_64.c | 2 + > include/linux/rcupdate.h | 24 ++++++ > include/linux/sched.h | 2 +- > init/init_task.c | 2 +- > kernel/fork.c | 2 +- > kernel/rcu/Kconfig | 3 + > kernel/rcu/tree_exp.h | 35 ++------ > kernel/rcu/tree_plugin.h | 101 ++++++++++++++--------- > 12 files changed, 196 insertions(+), 73 deletions(-) > create mode 100644 arch/x86/include/asm/rcu_preempt_depth.h > > -- > 2.20.1 >