Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755337AbbBTTol (ORCPT ); Fri, 20 Feb 2015 14:44:41 -0500 Received: from mail-ie0-f182.google.com ([209.85.223.182]:38057 "EHLO mail-ie0-f182.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752301AbbBTToj (ORCPT ); Fri, 20 Feb 2015 14:44:39 -0500 Message-ID: <1424461477.5565.29.camel@edumazet-glaptop2.roam.corp.google.com> Subject: Re: [PATCH 6/7 linux-next] wan: cosa: replace current->state by set_current_state() From: Eric Dumazet To: Peter Zijlstra Cc: Sergei Shtylyov , Fabian Frederick , linux-kernel@vger.kernel.org, Ingo Molnar , Greg Kroah-Hartman , "Jan \"Yenya\" Kasprzak" , netdev@vger.kernel.org Date: Fri, 20 Feb 2015 11:44:37 -0800 In-Reply-To: <1424460713.5565.28.camel@edumazet-glaptop2.roam.corp.google.com> References: <1424455977-21903-1-git-send-email-fabf@skynet.be> <1424455977-21903-6-git-send-email-fabf@skynet.be> <54E77E34.6050909@cogentembedded.com> <20150220185800.GR2896@worktop.programming.kicks-ass.net> <1424460713.5565.28.camel@edumazet-glaptop2.roam.corp.google.com> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.10.4-0ubuntu2 Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1169 Lines: 29 On Fri, 2015-02-20 at 11:31 -0800, Eric Dumazet wrote: > On Fri, 2015-02-20 at 19:58 +0100, Peter Zijlstra wrote: > > On Fri, Feb 20, 2015 at 09:34:28PM +0300, Sergei Shtylyov wrote: > > > Hello. > > > > > > On 02/20/2015 09:12 PM, Fabian Frederick wrote: > > > > > > >Use helper functions to access current->state. > > > >Direct assignments are prone to races and therefore buggy. > > > > > > >current->state = TASK_RUNNING is replaced by __set_current_state() > > > > > > You sometimes use __set_current_state() and sometimes set_current_state(). > > > > It depends on which state; setting yourself TASK_RUNNING is free of > > wakeup races -- you're already running after all, so it can safely use > > __set_current_state(). > > Maybe this might be self documented in set_current_state(), > as we have about 120 calls to __set_current_state(TASK_RUNNING) And about 138 calls to set_current_state(TASK_RUNNING) -- 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/