From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754575AbbCQOrK (ORCPT ); Tue, 17 Mar 2015 10:47:10 -0400 Received: from metis.ext.pengutronix.de ([92.198.50.35]:58581 "EHLO metis.ext.pengutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753573AbbCQOrI (ORCPT ); Tue, 17 Mar 2015 10:47:08 -0400 Date: Tue, 17 Mar 2015 15:47:01 +0100 From: Uwe =?iso-8859-1?Q?Kleine-K=F6nig?= To: Steven Rostedt Cc: Christoph Lameter , LKML , Ingo Molnar , Thomas Gleixner , "H. Peter Anvin" , linux-arm-kernel@lists.infradead.org, Russell King Subject: Re: [PATCH v2] ring-buffer: Replace this_cpu_*() with __this_cpu_*() Message-ID: <20150317144701.GJ10068@pengutronix.de> References: <20150316173154.537b80ee@gandalf.local.home> <20150317081341.0f9a8b4c@gandalf.local.home> <20150317101113.32f5618a@gandalf.local.home> <20150317104038.312e73d1@gandalf.local.home> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20150317104038.312e73d1@gandalf.local.home> User-Agent: Mutt/1.5.21 (2010-09-15) X-SA-Exim-Connect-IP: 2001:67c:670:100:1d::c0 X-SA-Exim-Mail-From: ukl@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-kernel@vger.kernel.org Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Guten Morgen Steven, On Tue, Mar 17, 2015 at 10:40:38AM -0400, Steven Rostedt wrote: > static __always_inline void trace_recursive_unlock(void) > { > - unsigned int val = this_cpu_read(current_context); > + unsigned int val = __this_cpu_read(current_context); > + unsigned int val2; > > - val--; > - val &= this_cpu_read(current_context); > - this_cpu_write(current_context, val); > + val2 = val - 1; > + val &= val2; > + __this_cpu_write(current_context, val); You could use: unsigned int val = __this_cpu_read(current_context); val = val & (val - 1); __this_cpu_write(current_context, val); and save a few lines and still make it more readable (IMHO). BTW, this patch makes the additional lines in the trace disappear, so if you think that makes a Tested-by applicable, feel free to add it. Best regards Uwe -- Pengutronix e.K. | Uwe Kleine-König | Industrial Linux Solutions | http://www.pengutronix.de/ |