From nobody Mon Jun 8 22:51:09 2026 Received: from pdx-out-003.esa.us-west-2.outbound.mail-perimeter.amazon.com (pdx-out-003.esa.us-west-2.outbound.mail-perimeter.amazon.com [44.246.68.102]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id AB03818050 for ; Mon, 25 May 2026 19:37:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=44.246.68.102 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779737843; cv=none; b=dQJG3CPz3TCEFbBaai2L/gNSl6qV/yBg6GZqSvqCFfw8su9M7Ndqdmcxns349/Eq3loxleUnPvsSDMU9Zdre1haDprbTfvpeOqvCmWYxvtq+Yz4y8zqQUk+tinJGUr6QIul5fpH/wUJvWQbyzpnfSlPqpxdn9hhGtaO5wfcKqsk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779737843; c=relaxed/simple; bh=H5+dngu4A/VNWEuJ6M+Cmq67XZKZIiuFiubc4dGamgg=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=dfODK6VdwhqUUbvlCDBUzhWGST0FVTOu/dzP6BxIf5xK82a2pebVo2ynKnTLKSpwXS7+7niO8oycYFNU/d9uhK1Ji820az51soZG8MafmYF7UKEnvEEpvKU/5rMVeW1cpTtKr2naX6WYvBOxzSZATj4bUmH3p9zapz+GSDk1LOo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amazon.com; spf=pass smtp.mailfrom=amazon.com; dkim=pass (2048-bit key) header.d=amazon.com header.i=@amazon.com header.b=OprrRBxb; arc=none smtp.client-ip=44.246.68.102 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amazon.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=amazon.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=amazon.com header.i=@amazon.com header.b="OprrRBxb" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amazon.com; i=@amazon.com; q=dns/txt; s=amazoncorp2; t=1779737841; x=1811273841; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=qf114ivLzRcC55l5gllRol+HgRt1cswU4/yJKKjssGI=; b=OprrRBxbqeFWdytMPmOTHM4VSYaIcpQF3ODk02IyE2fkOVGMnvs3DBEX WSDKdcIMW3V4bnlGKFq5JHMRRJMkZ+mIagm97YxKIZOAhU7zARfV65gqk r9I/7R7NtOpfRIKYBCfLesRm3VSGasaQOSfOtlh2Xj9MlQxT5q3vVnVAS hSnusUS69QESfgcRjtm2pjSl8MJvBhR2mOvEWXRQarx8q4ez8xU2Maota UhaB5IAuMPRUEkUNoaKD3RLgV/tahxnTHcD86vCdYuUrtF/OYG2tvc3gk h8O7aXXR+KEy6jBBBEQS5+N2zUkm93maNBDEzXIAH//Rtfut6GajWHsYz Q==; X-CSE-ConnectionGUID: Zj0Ln1VIT/2qDCqnFqwpRQ== X-CSE-MsgGUID: ptsA4z8qSLmtytzotrWyag== X-IronPort-AV: E=Sophos;i="6.24,168,1774310400"; d="scan'208";a="20452615" Received: from ip-10-5-12-219.us-west-2.compute.internal (HELO smtpout.naws.us-west-2.prod.farcaster.email.amazon.dev) ([10.5.12.219]) by internal-pdx-out-003.esa.us-west-2.outbound.mail-perimeter.amazon.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 May 2026 19:37:18 +0000 Received: from EX19MTAUWB002.ant.amazon.com [205.251.233.111:8059] by smtpin.naws.us-west-2.prod.farcaster.email.amazon.dev [10.0.48.135:2525] with esmtp (Farcaster) id 9f5e6316-895d-40f4-8143-6a58146c79a2; Mon, 25 May 2026 19:37:18 +0000 (UTC) X-Farcaster-Flow-ID: 9f5e6316-895d-40f4-8143-6a58146c79a2 Received: from EX19D001UWA001.ant.amazon.com (10.13.138.214) by EX19MTAUWB002.ant.amazon.com (10.250.64.231) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA) id 15.2.2562.37; Mon, 25 May 2026 19:37:18 +0000 Received: from dev-dsk-sieberf-metal-1a-7543e84d.eu-west-1.amazon.com (172.19.116.227) by EX19D001UWA001.ant.amazon.com (10.13.138.214) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA) id 15.2.2562.37; Mon, 25 May 2026 19:37:15 +0000 From: Fernand Sieber To: Ingo Molnar , Peter Zijlstra , Juri Lelli , Vincent Guittot CC: Tejun Heo , David Vernet , Andrea Righi , Changwoo Min , Dietmar Eggemann , Ben Segall , Mel Gorman , , , Fahad Mubeen , "Hendrik Borghorst" , David Woodhouse , Fernand Sieber Subject: [PATCH 1/2] sched/fair: expose cpu.max.runtime to set bandwidth runtime directly Date: Mon, 25 May 2026 21:36:21 +0200 Message-ID: <20260525193622.70282-2-sieberf@amazon.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260525193622.70282-1-sieberf@amazon.com> References: <20260525193622.70282-1-sieberf@amazon.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: EX19D038UWC002.ant.amazon.com (10.13.139.238) To EX19D001UWA001.ant.amazon.com (10.13.138.214) Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Add a cpu.max.runtime cgroup v2 interface that allows userspace to set the CFS bandwidth controller's runtime directly. This enables CPU credit injection: an orchestrator writes a runtime budget which the cgroup consumes naturally through the existing bandwidth enforcement mechanism. The write sets cfs_b->runtime directly. Each period, the task consumes runtime and the refill restores only quota (capped at quota + burst), so the injected credits drain until runtime falls below the cap, after which the cgroup returns to its steady-state quota allocation. Writes are rejected if the value exceeds quota + burst (the per-period runtime cap) or exceeds the maximum bandwidth limit. Also relax the burst validation: remove the burst <=3D quota constraint, requiring only that burst + quota does not overflow. This allows configuring burst > quota so that the runtime cap (quota + burst) can reach up to one full period, enabling 100% utilization while credits last. The interface uses microseconds, consistent with cpu.max quota/period. Signed-off-by: Fernand Sieber --- kernel/sched/core.c | 44 +++++++++++++++- tools/testing/selftests/cgroup/test_cpu.c | 62 +++++++++++++++++++++++ 2 files changed, 104 insertions(+), 2 deletions(-) diff --git a/kernel/sched/core.c b/kernel/sched/core.c index b8871449d..d92e5840b 100644 --- a/kernel/sched/core.c +++ b/kernel/sched/core.c @@ -10085,8 +10085,7 @@ static int tg_set_bandwidth(struct task_group *tg, if (quota_us !=3D RUNTIME_INF && quota_us > max_bw_runtime_us) return -EINVAL; =20 - if (quota_us !=3D RUNTIME_INF && (burst_us > quota_us || - burst_us + quota_us > max_bw_runtime_us)) + if (quota_us !=3D RUNTIME_INF && (burst_us + quota_us > max_bw_runtime_us= )) return -EINVAL; =20 #ifdef CONFIG_CFS_BANDWIDTH @@ -10147,6 +10146,41 @@ static int cpu_burst_write_u64(struct cgroup_subsy= s_state *css, tg_bandwidth(tg, &period_us, "a_us, NULL); return tg_set_bandwidth(tg, period_us, quota_us, burst_us); } + +static int cpu_runtime_write_u64(struct cgroup_subsys_state *css, + struct cftype *cftype, u64 runtime_us) +{ + struct task_group *tg =3D css_tg(css); + struct cfs_bandwidth *cfs_b =3D &tg->cfs_bandwidth; + + if (runtime_us > max_bw_runtime_us) + return -EINVAL; + + raw_spin_lock_irq(&cfs_b->lock); + if (cfs_b->quota !=3D RUNTIME_INF && + (u64)runtime_us * NSEC_PER_USEC > cfs_b->quota + cfs_b->burst) { + raw_spin_unlock_irq(&cfs_b->lock); + return -EINVAL; + } + cfs_b->runtime =3D (u64)runtime_us * NSEC_PER_USEC; + raw_spin_unlock_irq(&cfs_b->lock); + + return 0; +} + +static u64 cpu_runtime_read_u64(struct cgroup_subsys_state *css, + struct cftype *cftype) +{ + struct task_group *tg =3D css_tg(css); + struct cfs_bandwidth *cfs_b =3D &tg->cfs_bandwidth; + u64 runtime_ns; + + raw_spin_lock_irq(&cfs_b->lock); + runtime_ns =3D cfs_b->runtime; + raw_spin_unlock_irq(&cfs_b->lock); + + return runtime_ns / NSEC_PER_USEC; +} #endif /* CONFIG_GROUP_SCHED_BANDWIDTH */ =20 #ifdef CONFIG_RT_GROUP_SCHED @@ -10498,6 +10532,12 @@ static struct cftype cpu_files[] =3D { .read_u64 =3D cpu_burst_read_u64, .write_u64 =3D cpu_burst_write_u64, }, + { + .name =3D "max.runtime", + .flags =3D CFTYPE_NOT_ON_ROOT, + .read_u64 =3D cpu_runtime_read_u64, + .write_u64 =3D cpu_runtime_write_u64, + }, #endif /* CONFIG_CFS_BANDWIDTH */ #ifdef CONFIG_UCLAMP_TASK_GROUP { diff --git a/tools/testing/selftests/cgroup/test_cpu.c b/tools/testing/self= tests/cgroup/test_cpu.c index c83f05438..df151702b 100644 --- a/tools/testing/selftests/cgroup/test_cpu.c +++ b/tools/testing/selftests/cgroup/test_cpu.c @@ -776,6 +776,67 @@ static int test_cpucg_max_nested(const char *root) return ret; } =20 +static int test_cpucg_max_runtime(const char *root) +{ + int ret =3D KSFT_FAIL; + long quota_usec =3D 1000; /* 1ms (minimum) */ + long period_usec =3D 100000; /* 100ms */ + long burst_usec =3D 5000000; /* 5s, so cap =3D 5001ms */ + long runtime_usec =3D 2500000; /* 2500ms =3D half of 5s run */ + long duration_sec =3D 5; + long expected_usec =3D duration_sec * USEC_PER_SEC / 2; /* 50% */ + long usage_usec; + char *cpucg; + char buf[64]; + int pid; + + cpucg =3D cg_name(root, "cpucg_runtime_test"); + if (!cpucg) + goto cleanup; + + if (cg_create(cpucg)) + goto cleanup; + + snprintf(buf, sizeof(buf), "%ld %ld", quota_usec, period_usec); + if (cg_write(cpucg, "cpu.max", buf)) + goto cleanup; + if (cg_write_numeric(cpucg, "cpu.max.burst", burst_usec)) + goto cleanup; + + /* Start burner, let it settle, then inject credits */ + struct cpu_hog_func_param param =3D { + .nprocs =3D 1, + .ts =3D { .tv_sec =3D duration_sec, .tv_nsec =3D 0 }, + .clock_type =3D CPU_HOG_CLOCK_WALL, + }; + pid =3D cg_run_nowait(cpucg, hog_cpus_timed, (void *)¶m); + if (pid < 0) + goto cleanup; + + usleep(100000); + if (cg_write_numeric(cpucg, "cpu.max.runtime", runtime_usec)) { + kill(pid, SIGKILL); + waitpid(pid, NULL, 0); + goto cleanup; + } + + waitpid(pid, NULL, 0); + + usage_usec =3D cg_read_key_long(cpucg, "cpu.stat", "usage_usec"); + if (usage_usec <=3D 0) + goto cleanup; + + if (!values_close_report(usage_usec, expected_usec, 10)) + goto cleanup; + + ret =3D KSFT_PASS; + +cleanup: + cg_destroy(cpucg); + free(cpucg); + return ret; +} + #define T(x) { x, #x } struct cpucg_test { int (*fn)(const char *root); @@ -790,6 +851,7 @@ struct cpucg_test { T(test_cpucg_nested_weight_underprovisioned), T(test_cpucg_max), T(test_cpucg_max_nested), + T(test_cpucg_max_runtime), }; #undef T =20 --=20 2.47.3 Amazon Development Centre (South Africa) (Proprietary) Limited 29 Gogosoa Street, Observatory, Cape Town, Western Cape, 7925, South Africa Registration Number: 2004 / 034463 / 07 From nobody Mon Jun 8 22:51:09 2026 Received: from pdx-out-006.esa.us-west-2.outbound.mail-perimeter.amazon.com (pdx-out-006.esa.us-west-2.outbound.mail-perimeter.amazon.com [52.26.1.71]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8FBC518050 for ; Mon, 25 May 2026 19:38:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=52.26.1.71 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779737887; cv=none; b=it12Jnrw8AGjWP1naoZIewmstEVAy6FZt225JFBUMpeMn6FmvDLbIgcxrWZWKtFqfMTNxEqfd1CO1K0wuhgISqyYbxm9nzUZsxF7MpwZOOlCLGxaYFKdDdcDba0wv8Ae6idrBqCdDZl5Cs3HSk1WgU2mlWhcWPTjRQEC5h77Fxo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779737887; c=relaxed/simple; bh=zQnR4d1OfZWRyJnIRTdgkb6PfoscKdbvplNZSUDkn7A=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=pPhxINs2pmxf8Enavt/6h3RYzuZsNvIRwKrqFdDIGdR4Q9kIxLl+/ksf9VcmcFufqRHYo20nErgeFtPPqbHmpcTrjOGAGP5Ab2n9OWoS7voWl44WllUBaxws+A4rj/0lbauQYmXMa6pa9F5J3c4TzMcqxAHaNduvxVxKQziHXsU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amazon.com; spf=pass smtp.mailfrom=amazon.com; dkim=pass (2048-bit key) header.d=amazon.com header.i=@amazon.com header.b=Gxfr1Ecj; arc=none smtp.client-ip=52.26.1.71 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amazon.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=amazon.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=amazon.com header.i=@amazon.com header.b="Gxfr1Ecj" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amazon.com; i=@amazon.com; q=dns/txt; s=amazoncorp2; t=1779737886; x=1811273886; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=SpN58XxSxDF0xIMmexI2qCxTUynLmnpOjfUUjkT5MWY=; b=Gxfr1EcjHqN2oJXh56mSFrkI0ouuuThQQKv2zopgayZnycspweQqpeds ybqmJA+NYuC7MA5uG1TU6tCaqMqFioQsTFyWf2oo+gPUbXL+FX2H3KOAu +6PB3aKlHlbwrz8xOgR0yliaVyxkkK5pIE5vcMCGob96d/aap4iUGC2k3 FkA4D7HkQYrhMfwa5xsT/lHPQ/zdkTCrCDnxUns7hZLaJyQEW/YrfeGjq 8d2uSyp3/JGdUj77xj1r8hb/k5yVGWY2cFqVZNL1fQ0cefwDoKrwyE/R3 PDQKu4HMwcy/ZQtZMA8KBhFgoYPFf7qsGZ69ItYx51UuUd3pgVdGp95RG Q==; X-CSE-ConnectionGUID: OF6JMzloQ5+pPPxxhEVsRQ== X-CSE-MsgGUID: kjNuLJjhStOXBdwAdS4vtw== X-IronPort-AV: E=Sophos;i="6.24,168,1774310400"; d="scan'208";a="20456287" Received: from ip-10-5-6-203.us-west-2.compute.internal (HELO smtpout.naws.us-west-2.prod.farcaster.email.amazon.dev) ([10.5.6.203]) by internal-pdx-out-006.esa.us-west-2.outbound.mail-perimeter.amazon.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 May 2026 19:38:03 +0000 Received: from EX19MTAUWA002.ant.amazon.com [205.251.233.234:16077] by smtpin.naws.us-west-2.prod.farcaster.email.amazon.dev [10.0.48.135:2525] with esmtp (Farcaster) id 70dc5d05-f2b8-40ce-b62f-f2db3ded8282; Mon, 25 May 2026 19:38:03 +0000 (UTC) X-Farcaster-Flow-ID: 70dc5d05-f2b8-40ce-b62f-f2db3ded8282 Received: from EX19D001UWA001.ant.amazon.com (10.13.138.214) by EX19MTAUWA002.ant.amazon.com (10.250.64.202) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA) id 15.2.2562.37; Mon, 25 May 2026 19:38:02 +0000 Received: from dev-dsk-sieberf-metal-1a-7543e84d.eu-west-1.amazon.com (172.19.116.227) by EX19D001UWA001.ant.amazon.com (10.13.138.214) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA) id 15.2.2562.37; Mon, 25 May 2026 19:37:59 +0000 From: Fernand Sieber To: Ingo Molnar , Peter Zijlstra , Juri Lelli , Vincent Guittot CC: Tejun Heo , David Vernet , Andrea Righi , Changwoo Min , Dietmar Eggemann , Ben Segall , Mel Gorman , , , Fahad Mubeen , "Hendrik Borghorst" , David Woodhouse , Fernand Sieber Subject: [PATCH 2/2] sched/ext: add cgroup_set_runtime ops callback Date: Mon, 25 May 2026 21:36:22 +0200 Message-ID: <20260525193622.70282-3-sieberf@amazon.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260525193622.70282-1-sieberf@amazon.com> References: <20260525193622.70282-1-sieberf@amazon.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: EX19D045UWC003.ant.amazon.com (10.13.139.198) To EX19D001UWA001.ant.amazon.com (10.13.138.214) Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Add a sched_ext_ops callback that is invoked when userspace writes to cpu.max.runtime. This allows BPF schedulers to be notified when runtime credits are injected into a cgroup, enabling SCX-side credit tracking. The callback includes change detection (only fires when the value changes) and caches the value in tg->scx.bw_runtime_us. Signed-off-by: Fernand Sieber --- include/linux/sched/ext.h | 1 + kernel/sched/core.c | 2 ++ kernel/sched/ext.c | 17 +++++++++++++++++ kernel/sched/ext.h | 2 ++ kernel/sched/ext_internal.h | 12 ++++++++++++ 5 files changed, 34 insertions(+) diff --git a/include/linux/sched/ext.h b/include/linux/sched/ext.h index 2129e18ad..591801a50 100644 --- a/include/linux/sched/ext.h +++ b/include/linux/sched/ext.h @@ -273,6 +273,7 @@ struct scx_task_group { u64 bw_period_us; u64 bw_quota_us; u64 bw_burst_us; + u64 bw_runtime_us; bool idle; #endif }; diff --git a/kernel/sched/core.c b/kernel/sched/core.c index d92e5840b..369dd03d3 100644 --- a/kernel/sched/core.c +++ b/kernel/sched/core.c @@ -10165,6 +10165,8 @@ static int cpu_runtime_write_u64(struct cgroup_subs= ys_state *css, cfs_b->runtime =3D (u64)runtime_us * NSEC_PER_USEC; raw_spin_unlock_irq(&cfs_b->lock); =20 + + scx_group_set_runtime(tg, runtime_us); return 0; } =20 diff --git a/kernel/sched/ext.c b/kernel/sched/ext.c index 827a96e39..2ce505ad8 100644 --- a/kernel/sched/ext.c +++ b/kernel/sched/ext.c @@ -4488,6 +4488,23 @@ void scx_group_set_bandwidth(struct task_group *tg, =20 percpu_up_read(&scx_cgroup_ops_rwsem); } + +void scx_group_set_runtime(struct task_group *tg, u64 runtime_us) +{ + struct scx_sched *sch; + + percpu_down_read(&scx_cgroup_ops_rwsem); + sch =3D scx_root; + + if (scx_cgroup_enabled && SCX_HAS_OP(sch, cgroup_set_runtime) && + tg->scx.bw_runtime_us !=3D runtime_us) + SCX_CALL_OP(sch, cgroup_set_runtime, NULL, + tg_cgrp(tg), runtime_us); + + tg->scx.bw_runtime_us =3D runtime_us; + + percpu_up_read(&scx_cgroup_ops_rwsem); +} #endif /* CONFIG_EXT_GROUP_SCHED */ =20 #if defined(CONFIG_EXT_GROUP_SCHED) || defined(CONFIG_EXT_SUB_SCHED) diff --git a/kernel/sched/ext.h b/kernel/sched/ext.h index 0b7fc46ae..00103ec3d 100644 --- a/kernel/sched/ext.h +++ b/kernel/sched/ext.h @@ -81,6 +81,7 @@ void scx_cgroup_cancel_attach(struct cgroup_taskset *tset= ); void scx_group_set_weight(struct task_group *tg, unsigned long cgrp_weight= ); void scx_group_set_idle(struct task_group *tg, bool idle); void scx_group_set_bandwidth(struct task_group *tg, u64 period_us, u64 quo= ta_us, u64 burst_us); +void scx_group_set_runtime(struct task_group *tg, u64 runtime_us); #else /* CONFIG_EXT_GROUP_SCHED */ static inline void scx_tg_init(struct task_group *tg) {} static inline int scx_tg_online(struct task_group *tg) { return 0; } @@ -91,5 +92,6 @@ static inline void scx_cgroup_cancel_attach(struct cgroup= _taskset *tset) {} static inline void scx_group_set_weight(struct task_group *tg, unsigned lo= ng cgrp_weight) {} static inline void scx_group_set_idle(struct task_group *tg, bool idle) {} static inline void scx_group_set_bandwidth(struct task_group *tg, u64 peri= od_us, u64 quota_us, u64 burst_us) {} +static inline void scx_group_set_runtime(struct task_group *tg, u64 runtim= e_us) {} #endif /* CONFIG_EXT_GROUP_SCHED */ #endif /* CONFIG_CGROUP_SCHED */ diff --git a/kernel/sched/ext_internal.h b/kernel/sched/ext_internal.h index a075732d4..21e6ab7af 100644 --- a/kernel/sched/ext_internal.h +++ b/kernel/sched/ext_internal.h @@ -739,6 +739,18 @@ struct sched_ext_ops { */ void (*cgroup_set_idle)(struct cgroup *cgrp, bool idle); =20 + /** + * @cgroup_set_runtime: A cgroup's runtime is being set directly + * @cgrp: cgroup whose runtime is being set + * @runtime_us: runtime in microseconds + * + * Update @cgrp's available runtime. This is from the cpu.max.runtime + * cgroup interface. @runtime_us is the total runtime budget that the + * cgroup may consume. The BPF scheduler should track this value and + * throttle tasks in @cgrp once the budget is exhausted. + */ + void (*cgroup_set_runtime)(struct cgroup *cgrp, u64 runtime_us); + #endif /* CONFIG_EXT_GROUP_SCHED */ =20 /** --=20 2.47.3 Amazon Development Centre (South Africa) (Proprietary) Limited 29 Gogosoa Street, Observatory, Cape Town, Western Cape, 7925, South Africa Registration Number: 2004 / 034463 / 07