From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from pdx-out-004.esa.us-west-2.outbound.mail-perimeter.amazon.com (pdx-out-004.esa.us-west-2.outbound.mail-perimeter.amazon.com [44.246.77.92]) (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 2FA1F3603E1 for ; Mon, 25 May 2026 19:36:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=44.246.77.92 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779737801; cv=none; b=rPA1+mn+ScrkS2lnQ+xq/mExr7leBKp1KfRtyubP1LhGpUkFMeARqzaWZt6BEBUeoLrBGYhsqJBsEd57CbbU5h+w9i/wWU7kj8fFidbzLHCv+k3Zdj+zkX4a3ipKa6j1NUv6AC+vGRI6JOzZyL8OEHuGTSyAKlOEQlFjEen6x74= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779737801; c=relaxed/simple; bh=rdhtncieOCfnE7bMkAMgLL872hsPe7qTwdHJzgCMmOQ=; h=From:To:CC:Subject:Date:Message-ID:MIME-Version:Content-Type; b=MtJi9f+Lo2TyqFL8EEjplQe+cDbvIw3o9OdIhNczryoVviuSINBrcK2YTeQwA2zRKfOFHUzvu9w5qKENMVJT/62KrL0nc3Jjk4sJ+xYtcPyPA7D4aK8aMbKzLnE2Smm8fGL5w9SHUvJZ9T8UJjemx7TqUkVU9E7dCGk0w6+CK4w= 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=Vf7HCuSy; arc=none smtp.client-ip=44.246.77.92 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="Vf7HCuSy" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amazon.com; i=@amazon.com; q=dns/txt; s=amazoncorp2; t=1779737800; x=1811273800; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=B16wRfroh1nua5BoFidTEQJVH+mTew1yBuaW1PHUHWk=; b=Vf7HCuSyLwvIVuJzOcrm3b2y8GbJOI46Sg+/Ff++qt7ESwvJfqCFI54p 5messedMrkLaxePo6ivaPibVqhOcSWZ2e8XaxgI5FAYM/c1Zrl1A20ofa GVJu8AwOxJw85+aoA9WMPbJwCx840gFEDTXYfUFl6791e/1f3YGaFyfXl h1/+JoufDcT/rPO51JXHb6NENHEf9vzJmymgZEjyvUibG11lKAHi/Bfu1 4ZQR923Iy42PH0VW5MCKU4dwkyAuin50/ksKTAmEDBKsMhmpUg2yKmYFE UK/qos7J7nu2YEMbIzXzyJ+27XxZC+9lHohoY7r0u0Amh9wZWlCZAc0j8 g==; X-CSE-ConnectionGUID: tOEphXn6So+Z4mJfnADu0A== X-CSE-MsgGUID: l0jQjtKCSzOFG0h5SeV/fg== X-IronPort-AV: E=Sophos;i="6.24,168,1774310400"; d="scan'208";a="20427996" Received: from ip-10-5-0-115.us-west-2.compute.internal (HELO smtpout.naws.us-west-2.prod.farcaster.email.amazon.dev) ([10.5.0.115]) by internal-pdx-out-004.esa.us-west-2.outbound.mail-perimeter.amazon.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 May 2026 19:36:32 +0000 Received: from EX19MTAUWC001.ant.amazon.com [205.251.233.53:25592] by smtpin.naws.us-west-2.prod.farcaster.email.amazon.dev [10.0.43.130:2525] with esmtp (Farcaster) id b0c3f6b1-8dfa-4213-95b7-80759839ed5f; Mon, 25 May 2026 19:36:32 +0000 (UTC) X-Farcaster-Flow-ID: b0c3f6b1-8dfa-4213-95b7-80759839ed5f Received: from EX19D001UWA001.ant.amazon.com (10.13.138.214) by EX19MTAUWC001.ant.amazon.com (10.250.64.174) 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:36:32 +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:36:29 +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 0/2] sched/fair: expose cpu.max.runtime for credit injection Date: Mon, 25 May 2026 21:36:20 +0200 Message-ID: <20260525193622.70282-1-sieberf@amazon.com> X-Mailer: git-send-email 2.47.3 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: EX19D042UWA004.ant.amazon.com (10.13.139.16) To EX19D001UWA001.ant.amazon.com (10.13.138.214) Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit This series adds a cpu.max.runtime cgroup v2 interface that allows userspace to set the CFS bandwidth controller's runtime directly, enabling CPU credit injection. An orchestrator writes a runtime budget which the cgroup consumes naturally through the existing bandwidth enforcement mechanism. 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. The series also relaxes the burst validation: burst is no longer required to be <= quota, only that burst + quota does not overflow. This allows configuring burst > quota so that the runtime cap can reach up to one full period, enabling 100% utilization while credits last. A selftest (test_cpucg_max_runtime) validates the credit injection mechanism by configuring a cgroup with minimal quota but large burst, injecting credits via cpu.max.runtime, and verifying that the resulting CPU usage matches the injected budget. Patch 1 adds the core interface and selftest. Patch 2 adds sched_ext integration: an ops callback for BPF scheduler notification when runtime credits are injected. Fernand Sieber (2): sched/fair: expose cpu.max.runtime to set bandwidth runtime directly sched/ext: add cgroup_set_runtime ops callback include/linux/sched/ext.h | 1 + kernel/sched/core.c | 46 ++++++++++++++++- kernel/sched/ext.c | 17 +++++++ kernel/sched/ext.h | 2 + kernel/sched/ext_internal.h | 12 +++++ tools/testing/selftests/cgroup/test_cpu.c | 62 +++++++++++++++++++++++ 6 files changed, 138 insertions(+), 2 deletions(-) -- 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