From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751337AbbGaEha (ORCPT ); Fri, 31 Jul 2015 00:37:30 -0400 Received: from e35.co.us.ibm.com ([32.97.110.153]:50822 "EHLO e35.co.us.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751197AbbGaEh2 (ORCPT ); Fri, 31 Jul 2015 00:37:28 -0400 X-Helo: d03dlp02.boulder.ibm.com X-MailFrom: paulmck@linux.vnet.ibm.com X-RcptTo: linux-kernel@vger.kernel.org Date: Thu, 30 Jul 2015 21:37:25 -0700 From: "Paul E. McKenney" To: josh@joshtriplett.org Cc: linux-kernel@vger.kernel.org Subject: [PATCH RFC] rcu: Don't disable preemption for Tiny and Tree RCU readers Message-ID: <20150731043725.GA27728@linux.vnet.ibm.com> Reply-To: paulmck@linux.vnet.ibm.com MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 15073104-0013-0000-0000-00001576C853 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org rcu: Don't disable preemption for Tiny and Tree RCU readers Because preempt_disable() maps to barrier() for non-debug builds, it forces the compiler to spill and reload registers. Because Tree RCU and Tiny RCU now only appear in CONFIG_PREEMPT=n builds, these barrier() instances generate needless extra code for each instance of rcu_read_lock() and rcu_read_unlock(). This extra code slows down Tree RCU and bloats Tiny RCU (though probably not significantly). This commit therefore removes the preempt_disable() and preempt_enable() from the non-preemptible implementations of __rcu_read_lock() and __rcu_read_unlock(), respectively. Signed-off-by: Paul E. McKenney diff --git a/include/linux/rcupdate.h b/include/linux/rcupdate.h index 78af46c98e55..927c5e60c1dd 100644 --- a/include/linux/rcupdate.h +++ b/include/linux/rcupdate.h @@ -298,12 +298,14 @@ void synchronize_rcu(void); static inline void __rcu_read_lock(void) { - preempt_disable(); + if (!IS_ENABLED(CONFIG_TINY_RCU)) + preempt_disable(); } static inline void __rcu_read_unlock(void) { - preempt_enable(); + if (!IS_ENABLED(CONFIG_TINY_RCU)) + preempt_enable(); } static inline void synchronize_rcu(void)