From patchwork Wed Feb 19 10:32:41 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Juri Lelli X-Patchwork-Id: 24935 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-yk0-f199.google.com (mail-yk0-f199.google.com [209.85.160.199]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 37491201EE for ; Wed, 19 Feb 2014 10:33:04 +0000 (UTC) Received: by mail-yk0-f199.google.com with SMTP id 10sf727794ykt.2 for ; Wed, 19 Feb 2014 02:33:03 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:message-id:date:from:user-agent :mime-version:to:cc:subject:references:in-reply-to:sender:precedence :list-id:x-original-sender:x-original-authentication-results :mailing-list:list-post:list-help:list-archive:list-unsubscribe :content-type:content-transfer-encoding; bh=OTCB7BF69qzWdliBurGfMzF+J/19WXOUBBO1MepLg0k=; b=LY5pFqcn29KWrszNg/Nk24jPGgWPS5lB26Z2yt/Z9AjFz3nhuBxGRb9z90afSGVRai NDrPt0yjhUXW8AEsD3i/6ZWq4yaEsHCwVEJgLGjG0uALqKQZKkoimMUphBCyNXavnyWp 7jxB4bIoYi0w9XmfOQMADjti1D7Kv9sNDRozXXZh7IO0eAPYtPGRFVtiLZoOLqyRClex k6WtBNkX5/NNbbOEj/RpWqpGfSN/9/rMuPyOoegNu5db6BnLuYlnTXsST5TSPZXNUQb9 unwn2RV/QXJCCkD41cjZalyDa3k+ZwdJK+s+zL28CaQpA84xZYnPzZV1tRj1A1/TGNKL AJ4w== X-Gm-Message-State: ALoCoQkQqUwpKZZpr6xuGL1cyfZf71g6+cZYbrvp90FRz0wM0xMexgg5dXEZN0VwBkZvSi7q+yO8 X-Received: by 10.224.4.202 with SMTP id 10mr14902037qas.7.1392805983964; Wed, 19 Feb 2014 02:33:03 -0800 (PST) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.93.199 with SMTP id d65ls41157qge.12.gmail; Wed, 19 Feb 2014 02:33:03 -0800 (PST) X-Received: by 10.220.106.84 with SMTP id w20mr25008052vco.18.1392805983847; Wed, 19 Feb 2014 02:33:03 -0800 (PST) Received: from mail-ve0-x232.google.com (mail-ve0-x232.google.com [2607:f8b0:400c:c01::232]) by mx.google.com with ESMTPS id bj3si6586006vcb.139.2014.02.19.02.33.03 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 19 Feb 2014 02:33:03 -0800 (PST) Received-SPF: neutral (google.com: 2607:f8b0:400c:c01::232 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=2607:f8b0:400c:c01::232; Received: by mail-ve0-f178.google.com with SMTP id oy12so174635veb.37 for ; Wed, 19 Feb 2014 02:33:03 -0800 (PST) X-Received: by 10.52.164.39 with SMTP id yn7mr17743875vdb.25.1392805983749; Wed, 19 Feb 2014 02:33:03 -0800 (PST) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.220.174.196 with SMTP id u4csp286674vcz; Wed, 19 Feb 2014 02:33:03 -0800 (PST) X-Received: by 10.66.246.229 with SMTP id xz5mr1373673pac.119.1392805982276; Wed, 19 Feb 2014 02:33:02 -0800 (PST) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id pk8si21514987pab.97.2014.02.19.02.33.01; Wed, 19 Feb 2014 02:33:01 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751994AbaBSKce (ORCPT + 27 others); Wed, 19 Feb 2014 05:32:34 -0500 Received: from mail-ee0-f46.google.com ([74.125.83.46]:33810 "EHLO mail-ee0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750800AbaBSKcb (ORCPT ); Wed, 19 Feb 2014 05:32:31 -0500 Received: by mail-ee0-f46.google.com with SMTP id c13so122346eek.33 for ; Wed, 19 Feb 2014 02:32:30 -0800 (PST) X-Received: by 10.15.93.203 with SMTP id w51mr39949611eez.33.1392805950154; Wed, 19 Feb 2014 02:32:30 -0800 (PST) Received: from [10.30.3.54] (nat-cataldo.sssup.it. [193.205.81.5]) by mx.google.com with ESMTPSA id m1sm81364305een.7.2014.02.19.02.32.27 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 19 Feb 2014 02:32:29 -0800 (PST) Message-ID: <53048849.3000601@gmail.com> Date: Wed, 19 Feb 2014 11:32:41 +0100 From: Juri Lelli User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.2.0 MIME-Version: 1.0 To: Peter Zijlstra , Steven Rostedt CC: LKML , Linus Torvalds , Ingo Molnar , Thomas Gleixner , Andrew Morton Subject: Re: [PATCH v3] sched/deadline: Fix bad accounting of nr_running References: <20140214235946.60a89b65@gandalf.local.home> <53022F2D.8040301@gmail.com> <20140218215012.209059c0@gandalf.local.home> <20140219084618.GF27965@twins.programming.kicks-ass.net> In-Reply-To: <20140219084618.GF27965@twins.programming.kicks-ass.net> Sender: linux-kernel-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Original-Sender: juri.lelli@gmail.com X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 2607:f8b0:400c:c01::232 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org; dkim=neutral (bad format) header.i=@gmail.com; dmarc=fail (p=NONE dis=NONE) header.from=gmail.com Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , On 02/19/2014 09:46 AM, Peter Zijlstra wrote: > On Tue, Feb 18, 2014 at 09:50:12PM -0500, Steven Rostedt wrote: >> >>> Rationale for this odd behavior is that, when a task is throttled, it >>> is removed only from the dl_rq, but we keep it on_rq (as this is not >>> a "full dequeue", that is the task is not actually sleeping). But, it >>> is also true that, while throttled a task behaves like it is sleeping >>> (e.g., its timer will fire on a new CPU if the old one is dead). So, >>> Steven's fix sounds also semantically correct. >> >> Actually, it seems that I was hitting it again, but this time getting a >> negative number. OK, after looking at the code a bit more, I think we >> should update the runqueue nr_running only when the task is officially >> enqueued and dequeued, and all accounting within, will not touch that >> number. This is a different way to get the same result (mildly tested on my box): --- kernel/sched/deadline.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) -- We touch nr_running only when we don't enqueue back as a consequence of a replenishment. > > But if the task is throttled it should still very much decrement the > number. There's places that very much rely on nr_running be exactly the > number of runnable tasks. > This is a different thing, and V2 seemed to implement this behavior (that's why I said it looked semantically correct). Thanks, - Juri -- 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/ diff --git a/kernel/sched/deadline.c b/kernel/sched/deadline.c index 0dd5e09..675dad3 100644 --- a/kernel/sched/deadline.c +++ b/kernel/sched/deadline.c @@ -837,7 +837,8 @@ static void enqueue_task_dl(struct rq *rq, struct task_struct *p, int flags) if (!task_current(rq, p) && p->nr_cpus_allowed > 1) enqueue_pushable_dl_task(rq, p); - inc_nr_running(rq); + if (!(flags & ENQUEUE_REPLENISH)) + inc_nr_running(rq); } static void __dequeue_task_dl(struct rq *rq, struct task_struct *p, int flags)