From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933036Ab3ECHxK (ORCPT ); Fri, 3 May 2013 03:53:10 -0400 Received: from ja.ssi.bg ([178.16.129.10]:32901 "EHLO ja.ssi.bg" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1758639Ab3ECHxI (ORCPT ); Fri, 3 May 2013 03:53:08 -0400 Date: Fri, 3 May 2013 10:52:36 +0300 (EEST) From: Julian Anastasov To: "Paul E. McKenney" cc: Peter Zijlstra , Simon Horman , Eric Dumazet , Ingo Molnar , lvs-devel@vger.kernel.org, netdev@vger.kernel.org, netfilter-devel@vger.kernel.org, linux-kernel@vger.kernel.org, Pablo Neira Ayuso , Dipankar Sarma Subject: Re: [PATCH v2 1/2] sched: Add cond_resched_rcu_lock() helper In-Reply-To: <20130502223107.GB3780@linux.vnet.ibm.com> Message-ID: References: <20130501091012.GB28253@dyad.programming.kicks-ass.net> <20130501155501.GB7521@dyad.programming.kicks-ass.net> <20130502072623.GE7521@dyad.programming.kicks-ass.net> <20130502173257.GX3780@linux.vnet.ibm.com> <20130502193409.GA3780@linux.vnet.ibm.com> <20130502223107.GB3780@linux.vnet.ibm.com> User-Agent: Alpine 2.00 (LFD 1167 2008-08-23) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hello, On Thu, 2 May 2013, Paul E. McKenney wrote: > mainline, and missed the one that you added. Revisiting that, a > question: > > > +#ifdef CONFIG_PREEMPT_RCU > > +#define PREEMPT_RCU_OFFSET 1 > > Does this really want to be "1" instead of PREEMPT_OFFSET? In this case when CONFIG_PREEMPT_RCU is enabled we (RCU) do not touch the preempt counters. Instead, the units are accounted in current->rcu_read_lock_nesting: #define rcu_preempt_depth() (current->rcu_read_lock_nesting) __rcu_read_lock: current->rcu_read_lock_nesting++; and the path is __might_sleep -> preempt_count_equals -> rcu_preempt_depth For now both places do not use PREEMPT_OFFSET: - #define inc_preempt_count() add_preempt_count(1) - __rcu_read_lock: current->rcu_read_lock_nesting++; so, ... it does not matter much for me. In short, the trick is in preempt_count_equals() where preempt_offset is a combination of preempt count and RCU preempt depth: #ifdef CONFIG_PREEMPT_RCU #define PREEMPT_RCU_OFFSET (0 /* preempt */ + 1 /* RCU */) #else #define PREEMPT_RCU_OFFSET (PREEMPT_CHECK_OFFSET + 0 /* RCU */) #endif Let me know for your preference about this definition... Regards -- Julian Anastasov