Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp668259pxk; Wed, 16 Sep 2020 13:54:34 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwxaqIaXbtj8jffwBP8pi/543HRYqL8pfSMP9loNbXKSp/ofYfzTCMm7ZyFKFBok0NL4Eav X-Received: by 2002:aa7:cb44:: with SMTP id w4mr29953162edt.139.1600289674547; Wed, 16 Sep 2020 13:54:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600289674; cv=none; d=google.com; s=arc-20160816; b=x2uQ58dIfw3c6i6rpWiScxK8pBUtshjG6zaLwd5R7yqyK0cY/QpxsUYYxw/x78ulw/ W/fOSb18qGsU731TV6QO0F5w3VZYVRtfyOfRCijkv5KGsdgwo6KrwQvLeIrc1PNI7JnG XEfjtfNWDmIZXeEbBQYZ0JvDln0FbGtBsS8SlV7WSLzN1kv3PSzmsiEBOLsc1v8naSSx xqMVh0VLdz+qAt54ByMMgDY233s59Zjx6GVqnwh8Uzng2d8FQO2h93NbnFAlHEh/2y3g WHHvQCpFUsm6Sz6JyPRkje4bBq9ttsQ9OwY/+3YLYvkmLTy8z9lfxDufH4Qxnd4UL2X9 M49A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=jkMxiPFT5lKAK7ekVlt0PVlHZXsWZmIkFuc/7f7TT2c=; b=yJOyq3jd7RkM7SMHm4QfShj3CJFIAUpErLqrIJT8Y67guU2JbYrJviXlBJlMC9Tnl1 /EGCciOKMOL5n7PZRb7RDWl4aA9Bqngzs7cgiBLOPNdGf9LW0gqLM5C3D0r5mAAPR3Qg sE4zOuHsI7eVvMC+T2paHJjFa4miNVRWPaN5Dsq8ldbDx8TTaSgALz86QcLs5ltGiqch TLhdJbUt5UPQz5OVTuF2TNVfYAUwTVu+gLbEuYc5r26K7ReuZFVuprYaU6EwGqdcF+Bt iAlUINUTPPSnb6BrZ5QIEi7PlOMHJyP5NcOmNOQkg68Dp0Y4YepfJfylWDEHdnVME7WC WBKg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=chC8gDGr; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id j22si13012623edq.572.2020.09.16.13.54.10; Wed, 16 Sep 2020 13:54:34 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=chC8gDGr; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728525AbgIPUxU (ORCPT + 99 others); Wed, 16 Sep 2020 16:53:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55270 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726311AbgIPQyL (ORCPT ); Wed, 16 Sep 2020 12:54:11 -0400 Received: from mail-pl1-x643.google.com (mail-pl1-x643.google.com [IPv6:2607:f8b0:4864:20::643]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 87068C02C2A9 for ; Wed, 16 Sep 2020 08:39:33 -0700 (PDT) Received: by mail-pl1-x643.google.com with SMTP id m15so3386999pls.8 for ; Wed, 16 Sep 2020 08:39:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=jkMxiPFT5lKAK7ekVlt0PVlHZXsWZmIkFuc/7f7TT2c=; b=chC8gDGrIcoZ1u7L9zNbLUZqlC8LoREn6h95kzDrqMI57XjPz/IR6bobKCQ2eN4bzH /INGnl+++ACFSayvGWWX7+tDVkvdtLc3+v8fOR5qWYodV69QkRWExK6CmMlQprVaRYah 77admZ3vGoIlQxpdYmn6Hn8k8qbrLxIwPBsJWg9cViYWxR+A78qby5YtFE4imM7ktFlR jzdIwHfdn0I71KxedqIqjUFqyH1K+lsCK9/AseQBeSGdlCe/Vy2W59EqDnSPPw2i0xH7 1l1mey3u/Vebjl6YoXtHXkf8RRd+IWDuFTXk1LqXskkQCCQREHp/gp2DRIH3duIFa2Wb Ay0g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=jkMxiPFT5lKAK7ekVlt0PVlHZXsWZmIkFuc/7f7TT2c=; b=Cyb2n7E5u+wFFMyQL9hzId6rN6W0425I7JOkT3HNPTR/WEJxkeYpeAZIs1IfLEq/ZV jiXUA7f6iJtYT6mJCRSaBfqzIcBcVUIHWKgR+vbThVxAGtnmiWqL758haewckp2FDaGO UeDsiCGQuCTQXeLUwjkghnUlk8kutXtcvIERwgZo4aRW6tEfqt3z+EoxYjpcL2x1bA6u /7lk8HkOIebFk4ps0YcXNnE/XmC8CgbFmKHqdGXBgkDK1+5l2d97npCZ8NThHxl+dKbz gcdqoZWdcb1E9qEl8WCtt2OFrphMmuGFtMUibFCQLVv2GZKMA2q9ophfTQXptwCClm60 e8lg== X-Gm-Message-State: AOAM533gZVljOldHo5TJ/CV9DD3N6Gm5KBH2LkU8zeStI5977mKYef9d YcRjuc8DT9abzangl1eg5BU= X-Received: by 2002:a17:90a:8d05:: with SMTP id c5mr4383433pjo.222.1600270773046; Wed, 16 Sep 2020 08:39:33 -0700 (PDT) Received: from iZj6chx1xj0e0buvshuecpZ ([47.75.1.235]) by smtp.gmail.com with ESMTPSA id z1sm12445510pfj.113.2020.09.16.08.39.30 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 16 Sep 2020 08:39:32 -0700 (PDT) Date: Wed, 16 Sep 2020 23:39:28 +0800 From: Peng Liu To: Juri Lelli Cc: mingo@redhat.com, peterz@infradead.org, vincent.guittot@linaro.org, dietmar.eggemann@arm.com, rostedt@goodmis.org, bsegall@google.com, mgorman@suse.de, bristot@redhat.com, valentin.schneider@arm.com, raistlin@linux.it, linux-kernel@vger.kernel.org Subject: Re: [PATCH] sched/deadline: Fix sched_dl_global_validate() Message-ID: <20200916153928.GA27602@iZj6chx1xj0e0buvshuecpZ> References: <20200915152048.GA25835@iZj6chx1xj0e0buvshuecpZ> <20200916094203.GA6652@localhost.localdomain> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200916094203.GA6652@localhost.localdomain> User-Agent: Mutt/1.9.4 (2018-02-28) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Sep 16, 2020 at 11:42:03AM +0200, Juri Lelli wrote: > Hi, > > On 15/09/20 23:20, Peng Liu wrote: > > When user changes sched_rt_{runtime, period}_us, then > > > > sched_rt_handler() > > --> sched_dl_bandwidth_validate() > > { > > new_bw = global_rt_runtime()/global_rt_period(); > > > > for_each_possible_cpu(cpu) { > > dl_b = dl_bw_of(cpu); > > if (new_bw < dl_b->total_bw) > > ret = -EBUSY; > > } > > } > > > > Under CONFIG_SMP, dl_bw is per root domain , but not per CPU, > > dl_b->total_bw is the allocated bandwidth of the whole root domain. > > we should compare dl_b->total_bw against cpus*new_bw, where 'cpus' > > is the number of CPUs of the root domain. > > Hummm, I think you are right. Guess nobody played a lot with changing > global values. :-/ > > > Also, below annotation(in kernel/sched/sched.h) implied implementation > > only appeared in SCHED_DEADLINE v2[1], then deadline scheduler kept > > evolving till got merged(v9), but the annotation remains unchanged, > > meaningless and misleading, correct it. > > > > * With respect to SMP, the bandwidth is given on a per-CPU basis, > > * meaning that: > > * - dl_bw (< 100%) is the bandwidth of the system (group) on each CPU; > > * - dl_total_bw array contains, in the i-eth element, the currently > > * allocated bandwidth on the i-eth CPU. > > > > [1] https://lkml.org/lkml/2010/2/28/119 > > > > Signed-off-by: Peng Liu > > --- > > In fact, I'm not 100% sure that's a bug, since it's too 'obvious' and > > not newly introduced code. > > > > Also, the introduced #ifdef...#endif pairs look ugly, I have no idea > > how to eliminate them. Ideas and comments are welcome. Thanks. > > Can't we just use dl_bw_cpus() ? > Oh, good idea, I will have a try. Thanks for your time! > Thanks, > Juri >