Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp1428730iob; Thu, 5 May 2022 00:34:49 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyl17o1GuCzHj8dG5Fz4meB5J/HnSQ2j01N6G4SYtrENMdbySfAsD48KaEOtH8zEH8a5yGS X-Received: by 2002:a63:a512:0:b0:3c6:d89:1021 with SMTP id n18-20020a63a512000000b003c60d891021mr2573653pgf.126.1651736089326; Thu, 05 May 2022 00:34:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1651736089; cv=none; d=google.com; s=arc-20160816; b=B7G1mAzMbQKKOTnDygfrqnkwKDzAunzu/MTVVuqeNHlAQPJpo8BRJbRLZiExPM8+ah ejq2RoaPz8nB3f/d+2BzJWEcxyOsf+B3Oq3X2xuMtoSq54nGKgDkLtWH8+J5eaZtJnmD Q8MF9ouUov/3eiZ501cjvINkt4FgAADSzccvCGBzd/TCsKVvUV/l92o84CKlTOC+HD71 xpbqU8RKoo0yEFoHZxuvGNURvaDR1b6w++G0qAYjDRbuIcRoAMryyRqbwibo5tDZqByU +H9SZyDAYkQMZMEzOQTOauXFOsTnAylFEMMwC9kFVNq3i2ptdZD111yGbJoN3pq6caiD RCPg== 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=lIRWsrtQMQJmxVZKJdEApR7ea2YJQu7cRItS3a5Vwg8=; b=RKHXwvMVr8i1u4VuJ4iut172PqGHsUv4vCskSrjEpkS/HHtElDQFWP9GbGEC7YvY/h QtNBuEbXoNgsQTMisI7Gd/aUmN/XaDuAx7vXxxugyG3a2gowD6oOjAkTwTmYQL9qhpCC WERwRhcStMvaotyRC7k86SHCzUSSpMMYgoiz85Mmom24SXy62DQ5NXl1cPK8iw1c3/2r 3aykVS70Rd7k+fmW0cNNn0hz5ts7owHOQmFQH/RIF/Z83Ua9SwUl/vgvBqhKxC3CFx5Z 4tyhl0juW7sBTm2YiOXE18yhab6oH379oKzIT5mjO02PVmTBwoFLZeNQds3DqkjKe6sK 88fQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=MFnT0W+6; 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=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id m3-20020a170902f64300b0015d2fb717c9si943031plg.619.2022.05.05.00.34.34; Thu, 05 May 2022 00:34:49 -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=@linaro.org header.s=google header.b=MFnT0W+6; 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=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349841AbiEDMnA (ORCPT + 99 others); Wed, 4 May 2022 08:43:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57110 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245654AbiEDMm5 (ORCPT ); Wed, 4 May 2022 08:42:57 -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 183AB32EE1 for ; Wed, 4 May 2022 05:39:22 -0700 (PDT) Received: by mail-yw1-x1134.google.com with SMTP id 00721157ae682-2ebf4b91212so13584227b3.8 for ; Wed, 04 May 2022 05:39:22 -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=lIRWsrtQMQJmxVZKJdEApR7ea2YJQu7cRItS3a5Vwg8=; b=MFnT0W+63TtrQlSSrKtXilZLFxNUx+Q8TiJJDLulh1w4MPXUB1PfyUGT1MBQjNjkfX LAEPoEB0mVbyfibLfVHyWibxOscAvmfQV8HNzveVqeYDTkyccD7KMNyQekHZji1fdri8 eD7HoNPPvyvHhfi6WFQDK5sQ5qHZR4tgwf8tzXOGDT0waevOpjgrdret/w2Jgr7QNNoU XRagWEYbr1G+084KAREQc/PP4tjaGutCbBoqcAwgiISS4dSCVSmbQ4TrcBjkj68N5FGh 5dd5HVGI8DEXwTvw7WmhllOJyA0jAFOomQ+4GRbay/n1ATaVRgHWqUYUXDisHlIlCyg7 ofIw== 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=lIRWsrtQMQJmxVZKJdEApR7ea2YJQu7cRItS3a5Vwg8=; b=ej39eWqqOgjLKFl9l8hhqI3FbwERlMGABPQmKa4KkX/wuIVJiHyDC8Zpz8yPz0Yqir Dj0ktB9jl3MmZJxZaMbGfS99w2hE7294+152Dd3jnQDgX9zy//DPRjF/xWcsLtnNBMax uo1pQKeDQ2Y9qttRD3DvCZu6mkBrHhUlycbod9xAHnzlwdnbVRdt5NENUl5/kY/PWKuN SOpSMEzL+UGNM+t9rghG11Ck8biN9WAXVVLQxriYWmjzDQPl7rvENHEGUylhIx873njc vduK5ryxU2TXlMqg2g/H9x2A7k2DWVpp8m1rfLec8fMUzPYBt4yJo77Q5Tdj60ox7o/o y6zQ== X-Gm-Message-State: AOAM530tV6dR5OxyMYcD25mpNq7ctsQ4lfyr02uOGTc9hFzf5A5bY3zB a3jF/SI3A/rVkcCN520/yXbpiMUWKT5v8SOTYu95+Q== X-Received: by 2002:a0d:fa01:0:b0:2d6:595d:81d4 with SMTP id k1-20020a0dfa01000000b002d6595d81d4mr19427974ywf.86.1651667961309; Wed, 04 May 2022 05:39:21 -0700 (PDT) MIME-Version: 1.0 References: <20220311161406.23497-1-vincent.guittot@linaro.org> <20220311161406.23497-6-vincent.guittot@linaro.org> In-Reply-To: From: Vincent Guittot Date: Wed, 4 May 2022 14:39:10 +0200 Message-ID: Subject: Re: [RFC 5/6] sched/fair: Take into account latency nice at wakeup To: Chen Yu Cc: Ingo Molnar , "Peter Zijlstra (Intel)" , Juri Lelli , Dietmar Eggemann , Steven Rostedt , Ben Segall , Mel Gorman , Linux Kernel Mailing List , parth@linux.ibm.com, qais.yousef@arm.com, chris.hyser@oracle.com, pkondeti@codeaurora.org, Valentin Schneider , patrick.bellasi@matbug.net, David.Laight@aculab.com, Paul Turner , Pavel Machek , tj@kernel.org, dhaval.giani@oracle.com, qperret@google.com, Tim Chen , Chen Yu Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE 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 On Wed, 4 May 2022 at 13:15, Chen Yu wrote: > > On Sat, Mar 12, 2022 at 7:11 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. > > > ---------->8------------------- > > #endif /* CONFIG_SMP */ > > > > +static long wakeup_latency_gran(int latency_weight) > > +{ > > + long thresh = sysctl_sched_latency; > If I understood correctly, this is to consider the latency weight and > 'shrink/expand' > current task's time slice thus to facilitate preemption. And may I > know why don't we use > __sched_period() but to use sysctl_sched_latency directly? Is it > possible the rq has > more than 8(sched_nr_latency) tasks thus the period is longer than > sysctl_sched_latency? Main reason is to be aligned with place_entity which also uses sysctl_sched_latency to cap entity's vruntime to be higher than min_vruntime-sysctl_sched_latency > > Thanks, > Chenyu > > + > > + if (!latency_weight) > > + return 0; > > + > > + if (sched_feat(GENTLE_FAIR_SLEEPERS)) > > + thresh >>= 1; > > + > > + /* > > + * Clamp the delta to stay in the scheduler period range > > + * [-sysctl_sched_latency:sysctl_sched_latency] > > + */ > > + latency_weight = clamp_t(long, latency_weight, > > + -1 * NICE_LATENCY_WEIGHT_MAX, > > + NICE_LATENCY_WEIGHT_MAX); > > + > > + return (thresh * latency_weight) >> NICE_LATENCY_SHIFT; > > +} > > +