Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751711AbbH0VM0 (ORCPT ); Thu, 27 Aug 2015 17:12:26 -0400 Received: from mail-wi0-f174.google.com ([209.85.212.174]:37302 "EHLO mail-wi0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751367AbbH0VMZ (ORCPT ); Thu, 27 Aug 2015 17:12:25 -0400 Date: Thu, 27 Aug 2015 23:12:21 +0200 From: Frederic Weisbecker To: Jason Low Cc: Peter Zijlstra , Ingo Molnar , Thomas Gleixner , Oleg Nesterov , "Paul E. McKenney" , linux-kernel@vger.kernel.org, Linus Torvalds , Davidlohr Bueso , Steven Rostedt , Andrew Morton , Terry Rudd , Rik van Riel , Scott J Norton Subject: Re: [PATCH 3/3] timer: Reduce unnecessary sighand lock contention Message-ID: <20150827211219.GA25501@lerouge> References: <1440559068-29680-1-git-send-email-jason.low2@hp.com> <1440559068-29680-4-git-send-email-jason.low2@hp.com> <20150826225628.GD11992@lerouge> <1440631954.32300.26.camel@j-VirtualBox> <20150827125300.GA21105@lerouge> <1440707390.32300.100.camel@j-VirtualBox> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1440707390.32300.100.camel@j-VirtualBox> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1321 Lines: 42 On Thu, Aug 27, 2015 at 01:29:50PM -0700, Jason Low wrote: > On Thu, 2015-08-27 at 14:53 +0200, Frederic Weisbecker wrote: > > Sure, like: > > > > #define CPUTIMER_RUNNING 0x1 > > #define CPUTIMER_CHECKING 0x2 > > > > struct thread_group_cputimer { > > struct task_cputime_atomic cputime_atomic; > > int status; > > } > > > > So from cputimer_running() you just need to check: > > > > if (cputimer->status & CPUTIMER_RUNNING) > > > > And from run_posix_cpu_timer() fast-path: > > > > if (cputimer->status == CPUTIMER_RUNNING) > > > > so that ignores CPUTIMER_CHECKING case. > > Right, having just 1 "status" field can simply things a bit. The > (cputimer->status == CPUTIMER_RUNNING) check does appear misleading > though, since we're technically not only checking for if the "cputimer > is running". > > Maybe something like: > > int status = cputimer->status; > if ((status & CPUTIMER_RUNNING) && !(status & CPUTIMER_CHECKING)) > > makes it more obvious what's going on here. The result is the same but it may clarify the code indeed. Thanks. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/