Received: by 10.223.176.5 with SMTP id f5csp2852864wra; Mon, 5 Feb 2018 10:59:31 -0800 (PST) X-Google-Smtp-Source: AH8x226Zt3tHY+dcU/d2GJv/ly1lSPFZ/y7Q+Zf2BuoGud4M2/Xo3kXENoTEwNj+8q9ScC6YTxeq X-Received: by 10.99.114.22 with SMTP id n22mr919107pgc.21.1517857171832; Mon, 05 Feb 2018 10:59:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517857171; cv=none; d=google.com; s=arc-20160816; b=hVjZj2pT2mC9J+WXLlH2owh4BpHHGzWOfDodxeZm/DTROq0A4tK/ZvSNIBduHR6nue uy9z1g04/WZyJ0LUAb9vAtYPrUCZ8Zoy2X3VgeV7qKGQIn+MFF5YXmhHF39K+gwRdG4/ K28gL8geJSRatGcFgWknjSFZ09eCodvIGiTjZQk98fgz/tHitRk8goTBRrdMi707TCfy qQBobz3RAa6LcaGp6TL/Y/pAZxCzHn0L/jKmeFbBrnWs3QpJwCssNFzCeCr8UHpLwZtR IgrelMaMnmAngCWZ72MWjjJ2f9ryqPQ1GFVWKKfqyMxVwBz1RhIa9I9ojJvdNZ2BMLmw J3NA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dkim-signature :arc-authentication-results; bh=6lCP+gWw1L/1iQM5S2f3UVtN76bCyIz3yFenZvghim0=; b=fBkOoMuA5ReTF0rtGI049rycO4XgUedndr3k9JNskPlAG7iLJ4CeJH8oQPLzf4iaPs uXdIDy8P422eTK2Ao5OHjeCUHkxMWo2PZ/7GwO0jtihlbQkMTJTbt4DNLZGa3SzVfEpF 9zHD5o6LsvR5tvHMBEgf7DfMC7Aka8lSisBDN4tR9CQmvmZkslyKkZ6eIk94dft6m+V9 MdxcAs+dIPjVkHfSDlGuxn5BHX2NlwOjizIcdamUgi5HpyOrBfOO5rspfSvYBhol7O5/ arWSAtQIMfivzHu2q0YHRLoR2zkkApniM5rWQwGhUJlsrXuO5Vp9yzOnrayvaWX1aD89 peNw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Do+JxWlx; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v184si696978pgb.832.2018.02.05.10.59.17; Mon, 05 Feb 2018 10:59:31 -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; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Do+JxWlx; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753685AbeBES64 (ORCPT + 99 others); Mon, 5 Feb 2018 13:58:56 -0500 Received: from mail-wm0-f44.google.com ([74.125.82.44]:54668 "EHLO mail-wm0-f44.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753870AbeBES6j (ORCPT ); Mon, 5 Feb 2018 13:58:39 -0500 Received: by mail-wm0-f44.google.com with SMTP id i186so28088538wmi.4 for ; Mon, 05 Feb 2018 10:58:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=6lCP+gWw1L/1iQM5S2f3UVtN76bCyIz3yFenZvghim0=; b=Do+JxWlxbaX+p52OUBNiEJiQC0DDnQlV9vyMdawrX9rY3iCzDPcYlS1xzKczDIeG+r yDIK1+Q27v7E0X/R84sTmX9dwAGQFjeq3M0H48KXRIgHVPurSwYpeu6G5wfZrCLLa2XB iEl9/P4vAA0pxhD+hbP0wKH6WmMYPFfKe1COQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=6lCP+gWw1L/1iQM5S2f3UVtN76bCyIz3yFenZvghim0=; b=O+XicNaHAXyp7mzlWR5/ohhfacrSYIjyxGuiOsU6v/EN93i3grpjk9WqgmTpQy1MYV rgq/iWYNLtz9uq9VwCWIR3Uaq+O5Jd93IHhs52B1pr7/R2i4C9nWoLcr2SqTvHSSglxE gn1UCSrKmlMXWlj/h4yhci5XrGcoUXcZtD4pjrml5PHdOg9rL3T9tr/jwVoZChyqcGWQ QuegHrE23rmENfcrJ+nMUlhmW5ibzW+jnWYOjKdSpprWIYzpOZGvSPb7vYGLt1HLbIL3 3sAONa7e8e+JLktPl5mysAaqzUUtcFpultOW0cRoIT/eIcXVx0aEOuKCeo0rapODB5JL XKEQ== X-Gm-Message-State: APf1xPC5A9NXuhoXwCUC7izjdPaz+gV6dnKJzCehtm+C7A/mPWzyiAWk T/b0LgVGXAppjUy80I5lft5/sdOrVet2XS9UoJn4Jw== X-Received: by 10.80.183.173 with SMTP id h42mr359816ede.287.1517857117920; Mon, 05 Feb 2018 10:58:37 -0800 (PST) MIME-Version: 1.0 Received: by 10.80.168.164 with HTTP; Mon, 5 Feb 2018 10:58:37 -0800 (PST) In-Reply-To: <20180202143521.GU19535@localhost.localdomain> References: <1517503869-3179-1-git-send-email-mathieu.poirier@linaro.org> <1517503869-3179-4-git-send-email-mathieu.poirier@linaro.org> <20180202143521.GU19535@localhost.localdomain> From: Mathieu Poirier Date: Mon, 5 Feb 2018 11:58:37 -0700 Message-ID: Subject: Re: [PATCH V2 3/7] sched/deadline: Keep new DL task within root domain's boundary To: Juri Lelli Cc: Peter Zijlstra , Li Zefan , Ingo Molnar , Steven Rostedt , Claudio Scordino , Daniel Bristot de Oliveira , Tommaso Cucinotta , "luca.abeni" , linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2 February 2018 at 07:35, Juri Lelli wrote: > Hi Mathieu, > > On 01/02/18 09:51, Mathieu Poirier wrote: >> When considering to move a task to the DL policy we need to make sure >> the CPUs it is allowed to run on matches the CPUs of the root domains of >> the runqueue it is currently assigned to. Otherwise the task will be >> allowed to roam on CPUs outside of this root domain, something that will >> skew system deadline statistics and potentially lead to over selling DL >> bandwidth. >> >> For example say we have a 4 core system split in 2 cpuset: set1 has CPU 0 >> and 1 while set2 has CPU 2 and 3. This results in 3 cpuset - the default >> set that has all 4 CPUs along with set1 and set2 as just depicted. We also >> have task A that hasn't been assigned to any CPUset and as such, is part of >> the default CPUset. >> >> At the time we want to move task A to a DL policy it has been assigned to >> CPU1. Since CPU1 is part of set1 the root domain will have 2 CPUs in it >> and the bandwidth constraint checked against the current DL bandwidth >> allotment of those 2 CPUs. > > Wait.. I'm confused. :) Rightly so - it is confusing. > > Do you disabled cpuset.sched_load_balance in the root (default) cpuset? Correct. I was trying to be as clear as possible but also avoid writing too much - I'll make that fact explicit in the next revision. > If yes, we would end up with 2 root domains and if task A happens to be > on root domain (0-1) checking its admission against 2 CPUs looks like > the right thing to do to me. So the task is running on CPU1 and as such admission control will be done against root domain (0-1). The problem here is that task A isn't part of set1 (hence root domain (0-1)), it is part of the default cpuset and that set also includes root domain (2-3) - and that is a problem. > If no, then there is a single root domain > (the root/deafult one) with 4 CPUs, and it indeed seems that we've > probably got a problem: it is possible for a DEADLINE task running on > root/default cpuset to be put in (for example) 0-1 cpuset, and so > restrict its affinity. Is it this that this patch cures? That is exactly what this patch does. It will prevent a task from being promoted to DL if it is part of a cpuset (any cpuset) that has its cpuset.sched_load_balance flag disabled and also has populated children cpusets. That way we prevent tasks from spanning multiple root domains. > > Anyway, see more comments below.. > > [...] > >> /* >> + * If setscheduling to SCHED_DEADLINE we need to make sure the task >> + * is constrained to run within the root domain it is associated with, >> + * something that isn't guaranteed when using cpusets. >> + * >> + * Speaking of cpusets, we also need to assert that a task's >> + * cpus_allowed mask equals its cpuset's cpus_allowed mask. Otherwise >> + * a DL task could be assigned to a cpuset that has more CPUs than the >> + * root domain it is associated with, a situation that yields no >> + * benefits and greatly complicate the management of DL task when >> + * cpusets are present. >> + */ >> + if (dl_policy(policy)) { >> + struct root_domain *rd = cpu_rq(task_cpu(p))->rd; > > I fear root_domain doesn't exist on UP. > > Maybe this logic can be put above changing the check we already do > against the span? Yes, indeed. I'll fix that. > > https://elixir.free-electrons.com/linux/latest/source/kernel/sched/core.c#L4174 > > Best, > > - Juri