Received: by 2002:a05:6358:111d:b0:dc:6189:e246 with SMTP id f29csp3156733rwi; Tue, 1 Nov 2022 16:58:20 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6SI4iuhuMUZsCirlNBzk+oir0x0j74ujxBaQsbMqDCBNdh5WjVwtrinpD0YhgZ9XVNLpSV X-Received: by 2002:a17:902:d509:b0:187:fd9:d8e9 with SMTP id b9-20020a170902d50900b001870fd9d8e9mr18110389plg.140.1667347099755; Tue, 01 Nov 2022 16:58:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1667347099; cv=none; d=google.com; s=arc-20160816; b=FijERuGpC4tUyx7i1x2aw0UW6pimU8vzvjTGE+qT/PUV6hzEnVb8UxcRhNXtYyLLW9 +aNiGB4HMPWv0G1KRyR7OJxJSmUo5ZFsMUHekYPlOeo+bfWHVBlA6bFEyLNlRZHdwo+O YmxgqVZ/o5H1SMy/0K6ZgjGZaVHGKYeOHCpwbZbhSsTbGynqM1y7ZsKSzoUPpbDkTMO0 QK4qq6XsZsVkHmZmummutAXidRbX3E3BcXgjU6n5zTQJ1mD9R5haLTPyoIsz2jrccv6b TqH//Ibe++CFPE67Z25NqYR9WSj5QBZ4z8bxT93/UObiDFP/ymdmdaZgx8AgwJk0WFUN +IQg== 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=XVE8df/LmNSzpfTgJgBEeCPlA2Al+KApjI2VylZLJqw=; b=0C6JcnBhXeNMRgCW32FMcCS2AOc0r6edUZ8uao41i7p6zLUodSemNrFYuaZ0+LFsRi vxMFvhoFWbrZeXnkd4tDA00/oJH81TMK61gxNiD1X2luPLGRR+reCd/cySw6h7c6I9x9 435edKvtnFrcs3gPg7aaKw/JLsMCNijxEB2GkXVhsrJympiqCVCtEnGGdnrK4AcJa+0s 0Y31BHpfHYpaD9jJ7gS4iw1X093z90VVpeiuuXRfiwmZH5BkKj2re7Djz6mc8fjASFFg /Uu9KFRhFCfvVUgR0UFydMDhxyKZGNwSuyQqt3+J39OpOznkdzkw+MINmfzYciwAYVp1 keKQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b="NYNZLq/l"; 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 a192-20020a6390c9000000b0043961d06e6bsi13693425pge.787.2022.11.01.16.58.06; Tue, 01 Nov 2022 16:58:19 -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="NYNZLq/l"; 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 S230072AbiKAXjz (ORCPT + 96 others); Tue, 1 Nov 2022 19:39:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58738 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229628AbiKAXjw (ORCPT ); Tue, 1 Nov 2022 19:39:52 -0400 Received: from mail-lj1-x22d.google.com (mail-lj1-x22d.google.com [IPv6:2a00:1450:4864:20::22d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A0DDA1AD8C for ; Tue, 1 Nov 2022 16:39:51 -0700 (PDT) Received: by mail-lj1-x22d.google.com with SMTP id k19so22763271lji.2 for ; Tue, 01 Nov 2022 16:39:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=XVE8df/LmNSzpfTgJgBEeCPlA2Al+KApjI2VylZLJqw=; b=NYNZLq/lb7zvRGRcy311Vi/70AhjYWjIUDwfmocLlD/OX6i1vJfPsL30HUVv77KioE ziVq6V2dJT5uaX0Qj8OH+j4Q68D3a4Z7ezEhrxgCikcwAdT73BbDUpZz0Xx4tVa2QTsU QQ3beVk+rAoYmyTZNG/Ca4ihfmtU6d4x1uQumv5vl9ktNCqKuLvopmO6CoV9VTolLsWL gT5f25lBD0hQtzVv8s7zIMiRV7eCFWrL3Wc3YWDpGmT70rz8qnHYkjDc9ZgIRUCJOUdM JNg+OVDNnF5X+fcgQJvuHonHZW8Wmt0UYc8RTXOcpO8jE91WrC0GKnh+KGuCUsFzQh0E h39g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=XVE8df/LmNSzpfTgJgBEeCPlA2Al+KApjI2VylZLJqw=; b=wCRMwh1iutaewN3kTP86RbRAivKpoqyFKPL9sgVREwGUtO9gMnxMj3Yb/w8q6Q9dSM DuwpKT0YyM4OxMZl99nGhwhXz+02LMU86hnuy7V9TUMRURKiClkM5HpmigdGccVnVr8L FbrocDxTU7+b4O8RgWOPYn+Fy7sCbhh0c8oPb5Bz4Znd0QfioEA2YUxxQbhjMgwcAeJH saV8HeQPSR5FKQ9Se4hduAC/33+mjo94YEUYD9J78jGnjsn5iMmQi/eg4TM+r0nsxg39 GnYarscy/XA2omk0OtG63/vd7ZhHMHjXs5Yxew+wv2CtTWiCn1TDLRTHRHtWjlpkga+y Cafw== X-Gm-Message-State: ACrzQf3Cf26Sn/1J7HegJ/c7w4i0Ax5FEyLLLkICQUqBu6iWJy6JhGqg WRWcF5ou8avOQOLmrQxfXAUZdBv4j/+QWy27oBeVhw== X-Received: by 2002:a2e:3e14:0:b0:277:a3b:49dd with SMTP id l20-20020a2e3e14000000b002770a3b49ddmr7454438lja.342.1667345989783; Tue, 01 Nov 2022 16:39:49 -0700 (PDT) MIME-Version: 1.0 References: <20221027081630.34081-1-zhouchuyi@bytedance.com> <64d963b6-2d9c-3f93-d427-a1ff705fb65a@bytedance.com> <5af26ac9-3bdb-32d2-77a7-6cd8feca97aa@bytedance.com> <8142b5db-f543-57e6-0f68-f62274c0e379@bytedance.com> In-Reply-To: <8142b5db-f543-57e6-0f68-f62274c0e379@bytedance.com> From: Josh Don Date: Tue, 1 Nov 2022 16:39:37 -0700 Message-ID: Subject: Re: [PATCH] sched/fair: favor non-idle group in tick preemption To: Chuyi Zhou Cc: peterz@infradead.org, juri.lelli@redhat.com, mingo@redhat.com, vincent.guittot@linaro.org, linux-kernel@vger.kernel.org, Abel Wu 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, 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 > > Some weirdness about this change though, is that if there is a > > non-idle current entity, and the two next entities on the cfs_rq are > > idle and non-idle respectively, we'll now take longer to preempt the > > on-cpu non-idle entity, because the non-idle entity on the cfs_rq is > > 'hidden' by the idle 'first' entity. Wakeup preemption is different > > because we're always directly comparing the current entity with the > > newly woken entity. > > > You are right, this can happen with high probability. > This patch just compared the curr with the first entity in > the tick, and it seems hard to consider all the other entity > in cfs_rq. > > So, what specific negative effects this situation would cause? > For example, the "hidden" non-idle entity's latency will be worse > than before? As Abel points out in his email, it can push out the time it'll take to switch to the other non-idle entity. The change might boost some benchmarks numbers, but I don't think it is conclusive enough to say it is a generically beneficial improvement that should be integrated. By the way, I'm curious if you modified any of the sched_idle_cpu() and related load balancing around idle entities given that you've made it so that idle entities can have arbitrary weight (since, as I described in my prior email, this can otherwise cause issues there).