Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp3612649iob; Tue, 17 May 2022 03:58:37 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzkkaoXAzNOQckhalRk0P3h9BrU8AGSuLLGGUHDQ0J9lpE75WTsdrkYTIZ3O95PAsWusspQ X-Received: by 2002:a63:ff54:0:b0:3db:9acf:a087 with SMTP id s20-20020a63ff54000000b003db9acfa087mr16923177pgk.185.1652785117429; Tue, 17 May 2022 03:58:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652785117; cv=none; d=google.com; s=arc-20160816; b=vWitJoQFy/gphc1OqciEb6otcog/SA3hdX+178jfLMz967B606b1pkyQFWkGqBffBy S/VpJn3Q/YcSHdF4RgbC0KUTwwydSBHDg/i5taSV+poM3wMSbLgCkS42//MB3M902P6F 2LOKidaeZPFsmNIFeIuxDrMHb96i88MaQX0yFIrfIjd9coa5MpI79bSTeKWj6pOSERIy MCaPRwrx2Qcek2wSI/UXtk2gozCrUtgMpnKJWtqDmocFUgvVpuGhRYUjzx2nCmn2A1eX 7HT4E955hPKtFayuq5E+cQ7xWGtOSr1kc0ZKW87pM/Nncp3cVmPaFJ7nzIz5WOIvt/K8 fzNw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=f3T7zEU19sGE5Plnl9Vaht4RrmQHbsRiV5kkfiBBdKc=; b=Fmmphyha74AnQs3BIpoGEfhs129z2ONjqMv6StJPAyQ0OiLd0MKm/AnCgP/vZG7M5s 69yRIbg5s7OkJNKPgNpekdEWUlEXIMKdpatIdT3E4/tnHbvdnRr7eBhIvz11UhCh0q3i ada9P7NIG3TAAsq4X+5LOJ/0SKN0gsnDlI1L6sA1/8aTYl5HmqOEF1PGiYvfjtj/DFv+ 5fJXICZtgFLRxHc20VvgtE0OJvBZ8pChBREaYTYlOREst33TtR9sQjU0tCXMFh3EMCXV xb+p6jmKk3UAUHHCiPqVFT5TVoPIqH4zf8MHRJOwf3Ov3R17eDxT9W63qDguzY2vCYog PzqQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=RtjGPlT3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 37-20020a630b25000000b003c208b3b945si16245164pgl.651.2022.05.17.03.58.26; Tue, 17 May 2022 03:58:37 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=RtjGPlT3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232650AbiEQAyq (ORCPT + 99 others); Mon, 16 May 2022 20:54:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57138 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229885AbiEQAyo (ORCPT ); Mon, 16 May 2022 20:54:44 -0400 Received: from mail-yw1-x1134.google.com (mail-yw1-x1134.google.com [IPv6:2607:f8b0:4864:20::1134]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9C28333E80 for ; Mon, 16 May 2022 17:54:43 -0700 (PDT) Received: by mail-yw1-x1134.google.com with SMTP id 00721157ae682-2fefb051547so43648607b3.5 for ; Mon, 16 May 2022 17:54:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=f3T7zEU19sGE5Plnl9Vaht4RrmQHbsRiV5kkfiBBdKc=; b=RtjGPlT3zqjBi6g/bDTHvJiXmIQtqmJgz2y8SJCSDQZoPDbsOcEQ9kKU6Hk8Rwh0ZT Xz3KInguaZKzd1GDQe2SKxFzMm4vKqQuiNc+5Z5SVC0KZVm1jfkAB+XM63DUzLn7iMuU BFVqfj7t2xSxUdNvYa65Upc+Fv0iVnjgehEyvKENoFyN8idIx91a1vkyeV/4ktQEshOw IeCujLLP/SNLdwKEA2RNk5hvscn+0Q7fu9v5nQHRwdW19wDRG8ImGoZntuv3mRD10Z8v uCk6yKebGGiRT+P6u647Ou/zGBnK3yiTvo7sjff5sAyGOeLvGHEmpY0LKwRfYlNlrjHu lupg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=f3T7zEU19sGE5Plnl9Vaht4RrmQHbsRiV5kkfiBBdKc=; b=T2003T1sy++8Xuv6VkSsol6h367XuF5h0XPwzKEZCMaCX43yjwvXH0HDJriTNfjmuT fMusaxLZbT2Sb8oP12OauWfFaeJ0j6S+6S09W6zpMGy/C4pgcG9At1yxh0kjDik6H8bw c7AcCEFQT/51a81nU8wJrECoz0xWRYUlepeWEK5xDNdKpF8vE6jPRJWy6F+nQhcl2zU3 WRP8XFbB+Lf7JVP9v3jNq3dLwQTTX9Ms79n8UjNGinIhIHsOBBGiQcX5msDXecE3U0Se de69dpuYFDQhrEze7eWPH5UD5LxRFNrxHzRCjhyGTG6OtQtUYn7YbjhocJ3jMwrPxIRd CUEg== X-Gm-Message-State: AOAM531k/75SNlIcpn6rQqvnMVQYAqCvv5+iNXr889teWbWzZnP1vF81 EFDqA7EnZlm7gNPbTofbRYoG5RsCRqSwBKKRkcdG6w== X-Received: by 2002:a81:108:0:b0:2fb:9664:cbac with SMTP id 8-20020a810108000000b002fb9664cbacmr23163974ywb.167.1652748882601; Mon, 16 May 2022 17:54:42 -0700 (PDT) MIME-Version: 1.0 References: <20220512163534.2572-1-vincent.guittot@linaro.org> <20220512163534.2572-6-vincent.guittot@linaro.org> In-Reply-To: <20220512163534.2572-6-vincent.guittot@linaro.org> From: Josh Don Date: Mon, 16 May 2022 17:54:31 -0700 Message-ID: Subject: Re: [PATCH v2 5/7] sched/fair: Take into account latency nice at wakeup To: Vincent Guittot Cc: Ingo Molnar , Peter Zijlstra , Juri Lelli , Dietmar Eggemann , Steven Rostedt , Benjamin Segall , Mel Gorman , Daniel Bristot de Oliveira , Valentin Schneider , linux-kernel , parth@linux.ibm.com, Qais Yousef , "Hyser,Chris" , Valentin Schneider , patrick.bellasi@matbug.net, David.Laight@aculab.com, Paul Turner , pavel@ucw.cz, Tejun Heo , Quentin Perret , Tim Chen Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-17.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE,USER_IN_DEF_DKIM_WL,USER_IN_DEF_SPF_WL autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Vincent, On Thu, May 12, 2022 at 9:36 AM Vincent Guittot wrote: > > Take into account the nice latency priority of a thread when deciding to > preempt the current running thread. We don't want to provide more CPU > bandwidth to a thread but reorder the scheduling to run latency sensitive > task first whenever possible. > > As long as a thread didn't use its bandwidth, it will be able to preempt > the current thread. > > At the opposite, a thread with a low latency priority will preempt current > thread at wakeup only to keep fair CPU bandwidth sharing. Otherwise it will > wait for the tick to get its sched slice. Following up from the discussion on the prior series, I'm still not sure why this approach is exclusive of extending the entity placement code; I think both changes together would be useful. By only changing the wakeup preemption decision, you're only guaranteeing that the latency-sensitive thing on cpu won't be preempted until the next sched tick, which can occur at any time offset from the wakeup, from 0ns to the length of one tick. If a latency-tolerant task wakes up with a lot of sleeper credit, it would pretty quickly preempt a latency-sensitive task on-cpu, even if it doesn't initially do so due to the above changes to wakeup preemption. Adjusting place_entity wouldn't impact cpu bandwidth in steady-state competition between threads of different latency prio, it would only impact slightly at wakeup, in a similar but more consistent manner to the changes above to wakeup_preempt_entity (ie. a task that is not latency sensitive might have to wait a few ticks to preempt a latency sensitive task, even if it was recently sleeping for a while).