From patchwork Thu Nov 30 16:12:42 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Valentin Schneider X-Patchwork-Id: 17341 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:bcd1:0:b0:403:3b70:6f57 with SMTP id r17csp502146vqy; Thu, 30 Nov 2023 08:13:46 -0800 (PST) X-Google-Smtp-Source: AGHT+IGF/qQAl8cbk9HeXmcdDIASYKyCm4FLF2Gjo1mkXpcu7SgDfKhO1Eds/4FC4MzCg5OFjwNA X-Received: by 2002:a17:90b:3a90:b0:285:8cb6:6153 with SMTP id om16-20020a17090b3a9000b002858cb66153mr30066179pjb.17.1701360826380; Thu, 30 Nov 2023 08:13:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701360826; cv=none; d=google.com; s=arc-20160816; b=sCYGfTzg/BrXmCYJyAbtX7Nqw8dkJXoH0aUfJSfervtV6XRjGPZHsnXXAB2ncAVhP1 IMUjHMt917eH9UcXR6LfLULqDmrJ5aj+5lVuAxAD82SX5EGBrbtGk9kN0OWx7liIgvlE i9RtHyI9alQbyxzjBAJ++IRzdLxcxD+Jt+beXzQPiPTBBgmVQY7KDDe8IY08HLvXi+Ue TWc+iw88zuFLJ+WjqEBdqThwO0NO5mfZ7EyhedpdrHGRXWkMwPhp0T9R0njEpahsrxr6 3C85/7cR72+5eBYM6sF556knGgWJK4BMonmmEDOguQKgmZtcBywWkvD36hpArLSr4+WH fVhQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=FpCx+tElFli3PJ+oneU0SXM88BJcbodDK/a7dugXEk8=; fh=rccdXjDr7taJt1Xx8LyTJhkceurMd91O1K8pulqufws=; b=VkugxbmPOvLN0h8/qqimzqy9lt5QdxvN2SkeHcWHrWstLWt9+Kki5+dXuCJ/3Mr5aW 8sWzfz5EELBVkcHgbSmMAmoXUtNBESs9pY79kwDvYYbgBlyrB1Uc/LWi/H+VEG7JNrMo xuUlFXuU+Yxnjizm5NygwkINesCph4XfE6Op7GFhOKvZonY9UGun5c7WfQiLTNIpRM5K q77qT+kwEWdFngQd0EqCqXyeiGZC5Z84DVXUiDbdA1zEx9oLi/Qr4eO9Fp6Y+NdHt79P 1w6WY9BxFzW4KuUXHib39QvKeJXTpIwsdLK0/NCDGx6cOdgzlCuMrPJjBPQtTass35wb /yrw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=baIVJP13; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from morse.vger.email (morse.vger.email. [2620:137:e000::3:1]) by mx.google.com with ESMTPS id u8-20020a17090a400800b002864ea2384dsi434120pjc.42.2023.11.30.08.13.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 Nov 2023 08:13:46 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) client-ip=2620:137:e000::3:1; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=baIVJP13; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by morse.vger.email (Postfix) with ESMTP id DF4CB8293B32; Thu, 30 Nov 2023 08:13:43 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232180AbjK3QN2 (ORCPT + 99 others); Thu, 30 Nov 2023 11:13:28 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50010 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232206AbjK3QN0 (ORCPT ); Thu, 30 Nov 2023 11:13:26 -0500 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CF9F410F4 for ; Thu, 30 Nov 2023 08:13:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1701360808; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=FpCx+tElFli3PJ+oneU0SXM88BJcbodDK/a7dugXEk8=; b=baIVJP13w67MIpmugDykzvWlMhEjmGG+s+PctseevpeMy18ZTpuAH3FM3UFJRippnXblTw viom+Qkl6N5LKp776MmreEI8UZjOfJf+evoyEZJr4KvDkT/fEjO6jLiMktnp4siVHBzq+P 161Hh3O84pYsZHF4+0ahzX2NHWUIUdQ= Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-350-c9GEYIV5M9i-br_w5rxLiA-1; Thu, 30 Nov 2023 11:13:16 -0500 X-MC-Unique: c9GEYIV5M9i-br_w5rxLiA-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id C29B2280142B; Thu, 30 Nov 2023 16:12:59 +0000 (UTC) Received: from vschneid-thinkpadt14sgen2i.remote.csb (unknown [10.39.195.45]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 08FCEC15881; Thu, 30 Nov 2023 16:12:56 +0000 (UTC) From: Valentin Schneider To: linux-kernel@vger.kernel.org Cc: Ingo Molnar , Peter Zijlstra , Juri Lelli , Vincent Guittot , Dietmar Eggemann , Steven Rostedt , Ben Segall , Mel Gorman , Daniel Bristot de Oliveira , Phil Auld , Clark Williams , Tomas Glozar Subject: [RFC PATCH 0/2] sched/fair: Delay throttling to kernel exit Date: Thu, 30 Nov 2023 17:12:42 +0100 Message-ID: <20231130161245.3894682-1-vschneid@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.8 X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on morse.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (morse.vger.email [0.0.0.0]); Thu, 30 Nov 2023 08:13:44 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1784006129514019346 X-GMAIL-MSGID: 1784006129514019346 Hi folks I apologize for the one-big-patch-to-rule-them-all, I tried splitting but I couldn't get to anything that made sense, so it's one big patch and a small follow-up. TL;DR of what I'd like to hear about: o Is there interest in getting this in for !PREEMPT_RT reasons? o Any ideas on how to make cgroup migration less horrible so we can fully pop out the throttled cfs_rq se's? Survives a good hour of my testing below on a 4-CPU QEMU system, but I expect the throttled clocks & PELT to be busted. Testing ======= setup +++++ mount -t cgroup -o cpu none /root/cpu mkdir /root/cpu/cg0 echo 10000 > /root/cpu/cg0/cpu.cfs_period_us echo 1000 > /root/cpu/cg0/cpu.cfs_quota_us mkdir /root/cpu/cg0/cg00 mkdir /root/cpu/cg0/cg01 mkdir /root/cpu/cg0/cg00/cg000 mkdir /root/cpu/cg0/cg00/cg001 read.sh +++++++ while true; do cat /sys/devices/system/cpu/smt/active &>/dev/null; done repro.sh ++++++++ spawn() { ./read.sh & PID=$! echo "Tracing PID${PID}" echo $PID > $1 } spawn cpu/cg0/tasks spawn cpu/cg0/tasks spawn cpu/cg0/tasks spawn cpu/cg0/tasks spawn cpu/cg0/cg01/tasks spawn cpu/cg0/cg00/cg000/tasks spawn cpu/cg0/cg00/cg001/tasks sleep 1 kill $(jobs -p) Valentin Schneider (2): sched/fair: Only throttle CFS tasks on return to userspace sched/fair: Repurpose cfs_rq_throttled() include/linux/sched.h | 2 + kernel/sched/core.c | 6 +- kernel/sched/debug.c | 4 +- kernel/sched/fair.c | 296 +++++++++++++++++++++++++++--------------- kernel/sched/sched.h | 8 +- 5 files changed, 204 insertions(+), 112 deletions(-) --- 2.41.0