From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1C28CC2BA19 for ; Tue, 14 Apr 2020 07:21:19 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id E23AD20575 for ; Tue, 14 Apr 2020 07:21:18 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="kBgfxi65"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="wRI9dknK" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E23AD20575 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:To:Subject:Message-ID:Date:From: In-Reply-To:References:MIME-Version:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=ES3LkV1/jCqnURKBJIzeIMO98lLaNUn/HjNthSWaZTM=; b=kBgfxi65tNcMd2 U687h7WDvfcIo4X2X7LGhVgGZjCv7UXvjd82Nu+3PqfsNUoqcbS+YmfSLfUoJsEGLBb09bpFkqRYq Gsg+YLQcDM4R+7kuL6kV6wl7b7QBhR2sx4OceItkL0mgDmremwrxUr5tcjNM61mpjG2Jbi2zrfXGn QTP/TyVaAdLCsWkyLubTGRKvYNnvLV6YrhFsvrsGIKChwPrZE8Du/6EOUQbW7KpUQthc3nL3+v8GE eZOuI8+xu8F6ME4uQy2YN4SqIswUa2ZR/LjxzfQppzDTw2Ug9cjw3+/HdIH3gW9n+wwA5OQzgXMsh 7PEQMAl6xC374Rp4B1rA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jOFsh-0001Tq-SU; Tue, 14 Apr 2020 07:21:15 +0000 Received: from mail-lf1-x144.google.com ([2a00:1450:4864:20::144]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jOFsd-0001TR-Lm for linux-arm-kernel@lists.infradead.org; Tue, 14 Apr 2020 07:21:13 +0000 Received: by mail-lf1-x144.google.com with SMTP id u10so7396431lfo.8 for ; Tue, 14 Apr 2020 00:21:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=YnugimfgLlPD7Ub15Rq+ZP2oqGldo7TE1O1Dmve7nnE=; b=wRI9dknKV5V3DYRe+7S8M3zpLgJPJdiiGSSB3ViTj+LgBtBkel7wQUYbC/TqthYAMq 8N+ZCg6krg7n/i49R72BeyHVAAi0sL3HBE3ZFuki7Cb+qEZmfRdZ1UrkQ16rIYWz+PFW FQq7ghksGAgTcBLKDGYubGuW+9BAOqg1TygoLL6uZeaOu/4TWmFfwp+couNU8xssKvDi 0/RGo61l/CBm8h8GjUZ1FpOcWg4tKnbPellLDne2hH4c5YWqDDzjjqmeBv75AiT65HWe m25ZKQZLWWspY4lreXA1g+MJ4FzZbRukIrFN5A67WRBvFEIG/+LtcTOSOELrENzRWM/q jsyQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=YnugimfgLlPD7Ub15Rq+ZP2oqGldo7TE1O1Dmve7nnE=; b=O3/ibeoQRJLuxTMqS2tfNve1cWyp9pjHClFo9zWOx98JfOfAo1NdWQXgDhq/0gSQfi ZG+0O6Tf5sIjlkg1j2eTd0ZpKKJhmclLeXjbP9L5LRMg+etdIw4K3U/85U/WqeO7O6yV 8SQHDBifQKGQJV7oEbCfYlEUKhLKUgbnH3nvKTZ1qRg7fLIZoHzN81bd8w35BkKZbQWe zGs8F+5t46R6HTEA4Tw1BEf3k7ZVqUdWH+V/LbMJhpWAJzFpHejoVJmkIMhFVDjw969d mJyGHniCTOIVcRwAu3etoiVlH867jTakLhTToupzFjNpbo1h+c9mcQC9SS0EenzeO9f2 AL5w== X-Gm-Message-State: AGi0PubFgox2P6T28TXL8RL5fTCtDpkB8KzDCB4pmPOa6C5VIk17XKDC cdnSgs4SC96b7xOR0PA4FSz6adgMYwqnLT6skLdvgA== X-Google-Smtp-Source: APiQypJ4H6n7yG0F1w2Gn8N+H5CLgqJiuZoYs6jejd2ao/p3wXioqSyoAIymYwIciCXJXV97mBqob4c/A2XaK8HU/Sw= X-Received: by 2002:ac2:5e65:: with SMTP id a5mr12666522lfr.189.1586848868714; Tue, 14 Apr 2020 00:21:08 -0700 (PDT) MIME-Version: 1.0 References: <1586779466-4439-1-git-send-email-wangqing@vivo.com> <1586779466-4439-2-git-send-email-wangqing@vivo.com> In-Reply-To: <1586779466-4439-2-git-send-email-wangqing@vivo.com> From: Vincent Guittot Date: Tue, 14 Apr 2020 09:20:57 +0200 Message-ID: Subject: Re: [PATCH 1/2] [V2 1/2]sched:add task_running_oncpu To: Wang Qing X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200414_002111_746449_1FB9F042 X-CRM114-Status: GOOD ( 15.90 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Juri Lelli , Mark Rutland , opensource.kernel@vivo.com, Peter Zijlstra , Catalin Marinas , linux-kernel , Steven Rostedt , Dave Martin , Ben Segall , jinho lim , Ingo Molnar , James Morse , Mel Gorman , Thomas Gleixner , Will Deacon , Dietmar Eggemann , LAK , "Eric W. Biederman" Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Mon, 13 Apr 2020 at 14:04, Wang Qing wrote: > > We have no interface whether the task is running, > so we need to add an interface and distinguish CONFIG_SMP. > > Signed-off-by: Wang Qing > --- > include/linux/sched.h | 10 ++++++++++ > 1 file changed, 10 insertions(+) > > diff --git a/include/linux/sched.h b/include/linux/sched.h > index 4418f5c..13cc8f5 100644 > --- a/include/linux/sched.h > +++ b/include/linux/sched.h > @@ -1843,6 +1843,11 @@ static inline unsigned int task_cpu(const struct task_struct *p) > > extern void set_task_cpu(struct task_struct *p, unsigned int cpu); > > +static inline int task_running_oncpu(const struct task_struct *p) This function name is too close from task_running_on_cpu() and can be misleading as the difference is only "_" Also, how task_running_oncpu() is different from task_running() ? > +{ > + return p->on_cpu; > +} > + > #else > > static inline unsigned int task_cpu(const struct task_struct *p) > @@ -1854,6 +1859,11 @@ static inline void set_task_cpu(struct task_struct *p, unsigned int cpu) > { > } > > +static inline int task_running_oncpu(const struct task_struct *p) > +{ > + return p == current; > +} > + > #endif /* CONFIG_SMP */ > > /* > -- > 2.7.4 > _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel