Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755516AbcKQSl7 (ORCPT ); Thu, 17 Nov 2016 13:41:59 -0500 Received: from mail-it0-f67.google.com ([209.85.214.67]:36481 "EHLO mail-it0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754775AbcKQSly (ORCPT ); Thu, 17 Nov 2016 13:41:54 -0500 MIME-Version: 1.0 In-Reply-To: <20161115143700.GZ4127@linux.vnet.ibm.com> References: <20161114183636.GA28589@linux.vnet.ibm.com> <20161115014445.GC12110@tardis.cn.ibm.com> <20161115143700.GZ4127@linux.vnet.ibm.com> From: Lai Jiangshan Date: Thu, 17 Nov 2016 20:18:51 +0800 Message-ID: Subject: Re: [PATCH RFC tip/core/rcu] SRCU rewrite To: "Paul E. McKenney" Cc: Boqun Feng , LKML , Ingo Molnar , dipankar@in.ibm.com, akpm@linux-foundation.org, Mathieu Desnoyers , Josh Triplett , Thomas Gleixner , Peter Zijlstra , Steven Rostedt , David Howells , edumazet@google.com, dvhart@linux.intel.com, =?UTF-8?B?RnLDqWTDqXJpYyBXZWlzYmVja2Vy?= , oleg@redhat.com, bobby.prani@gmail.com, ldr709@gmail.com Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1026 Lines: 28 On Tue, Nov 15, 2016 at 10:37 PM, Paul E. McKenney wrote: > On Tue, Nov 15, 2016 at 09:44:45AM +0800, Boqun Feng wrote: >> >> __srcu_read_lock() used to be called with preemption disabled. I guess >> the reason was because we have two percpu variables to increase. So with >> only one percpu right, could we remove the preempt_{dis,en}able() in >> srcu_read_lock() and use this_cpu_inc() here? > > Quite possibly... > it will be nicer if it is removed. The reason for the preemption-disabled was also because we have to disallow any preemption between the fetching of the idx and the increasement. so that we have at most NR_CPUS worth of readers using the old index that haven't incremented the counters. if we remove the preempt_{dis,en}able(). we must change the "NR_CPUS" in the comment into ULONG_MAX/4. (I assume one on-going reader needs at least need 4bytes at the stack). it is still safe. but we still need to think more if we want to remove the preempt_{dis,en}able(). Thanks Lai