Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp927107pxv; Fri, 25 Jun 2021 01:16:52 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzcoaltGT+4UI9bxqDxcru1J17j7teXBtaNRCwFbwiYh4TE3fpcwdbF/1naR7t1svMFNDbY X-Received: by 2002:a17:906:e03:: with SMTP id l3mr9358669eji.6.1624609011934; Fri, 25 Jun 2021 01:16:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624609011; cv=none; d=google.com; s=arc-20160816; b=L+kRUQOXvP3GBVxyt6lYi3Cn4qmzIjd3oKfu1tOcjijfnOWfp3o1w2LDwhvUlR6ynA ArnesYUXxW0L54PIeA/wuKdo29Nvf7O4r2YL8WcytoW0pU9zsGZ1B/M0ceDtpgMg3FTr 8M7c6Yx9pBvmswhm8Havl4l3Q2f6msI07hZs5sgOOzP/xEVazUQcodKVqxjcP5DtU0lj 9eZC5ZQYeVK4b1vGE4HKu7rkshDRRDfPDUa8ifsCAnjQnxwxxvxrIS8TcVqoFwY5alfX yeW4n1N1842jJsc0LO5NTI1a5GVu/VClYsfAKTUzOk7TXpoR6m+lqU0AW95b2N3IJ0Oc LGiw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=rm+JBREWSoPp+eGQlwLQzs0H9esWidtlooHK2hgns4w=; b=ThpMhWC0c+Ngy2ZrRWp+hVbkBQbCEkW3fq6vZ/+IyLmV8VaCvGlF7Nnj1Ydm8rgVFv ub7aE4kDMT5SlF0HOSyE6eTLYkE/uEubF/lICvTfP2MjfK2ay5jrGQcZHXdWTsR602CZ qhPiJ2z/1O1ybDYu28AKUZdsbqz99bqT6ZjnSg4ylXmGok+VG42ji2cRfdgCRbomBFpd 7YuqHWrOqMT7Nir+xXM9Na5KQmGj+tYBNDWowJQKu6czkB67DLghzahtSIdM5GA6Kfj3 /DpEgOmtRc/Rk2X77G/FPXCHmS8wBB/O7iWyma7IZ6+HdK6IDw4P+F/KWcXRy3LGhQg7 p4Vg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=XldmmK2D; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id v1si6309154ejd.643.2021.06.25.01.16.28; Fri, 25 Jun 2021 01:16:51 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=XldmmK2D; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229938AbhFYISA (ORCPT + 99 others); Fri, 25 Jun 2021 04:18:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57370 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229764AbhFYISA (ORCPT ); Fri, 25 Jun 2021 04:18:00 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D2D15C061574 for ; Fri, 25 Jun 2021 01:15:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=rm+JBREWSoPp+eGQlwLQzs0H9esWidtlooHK2hgns4w=; b=XldmmK2DLpgAF4FpYtgEttHm7+ YRsBDRNgJe4edQWG2iUNJh30O0fy019MerrqhWk7VWSMl7DpV4mG2VbStMkjbW6dvl+sDr0BpqVT3 D8Mpkjuh24vGupzRwG/sAahuJ9x3IYBvBX4V6gVbmypY/7zPK/1CA6v9aiu0Kv7J/FCdfrABkOiK0 EdqY8P82TLKTiEV9iHmz0mSR1MYHJglAzwMmMK8v7DWxs8Ab7rKqpavtm6cWV6uy39/OIP7vufCs7 vHe/sCjOcXpCBgmPlE+TOdSfjWxnbQZtGh7mPlc5j1AwymXm5eARnH6me+TS0zG1QDMRqzUFglug8 3557h4QA==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=noisy.programming.kicks-ass.net) by casper.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1lwgzG-00HS0n-3c; Fri, 25 Jun 2021 08:14:55 +0000 Received: from hirez.programming.kicks-ass.net (hirez.programming.kicks-ass.net [192.168.1.225]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id A2682300252; Fri, 25 Jun 2021 10:14:53 +0200 (CEST) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 5EC2020171CE8; Fri, 25 Jun 2021 10:14:53 +0200 (CEST) Date: Fri, 25 Jun 2021 10:14:53 +0200 From: Peter Zijlstra To: Josh Don Cc: Ingo Molnar , Juri Lelli , Vincent Guittot , Dietmar Eggemann , Steven Rostedt , Ben Segall , Mel Gorman , Daniel Bristot de Oliveira , Paul Turner , David Rientjes , Oleg Rombakh , Viresh Kumar , Steve Sistare , Tejun Heo , linux-kernel@vger.kernel.org Subject: Re: [PATCH] sched: cgroup SCHED_IDLE support Message-ID: References: <20210608231132.32012-1-joshdon@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210608231132.32012-1-joshdon@google.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jun 08, 2021 at 04:11:32PM -0700, Josh Don wrote: > diff --git a/kernel/sched/core.c b/kernel/sched/core.c > index 8ab69d01dab4..a82f5d3b85d3 100644 > --- a/kernel/sched/core.c > +++ b/kernel/sched/core.c > @@ -10234,6 +10234,18 @@ static int cpu_weight_nice_write_s64(struct cgroup_subsys_state *css, > > return sched_group_set_shares(css_tg(css), scale_load(weight)); > } > + > +static s64 cpu_idle_read_s64(struct cgroup_subsys_state *css, > + struct cftype *cft) > +{ > + return css_tg(css)->idle; > +} > + > +static int cpu_idle_write_s64(struct cgroup_subsys_state *css, > + struct cftype *cft, s64 idle) > +{ > + return sched_group_set_idle(css_tg(css), idle); > +} > #endif > > static void __maybe_unused cpu_period_quota_print(struct seq_file *sf, > @@ -10306,6 +10318,12 @@ static struct cftype cpu_files[] = { > .read_s64 = cpu_weight_nice_read_s64, > .write_s64 = cpu_weight_nice_write_s64, > }, > + { > + .name = "idle", > + .flags = CFTYPE_NOT_ON_ROOT, > + .read_s64 = cpu_idle_read_s64, > + .write_s64 = cpu_idle_write_s64, > + }, > #endif > #ifdef CONFIG_CFS_BANDWIDTH > { You should probably also make cpu_weight_*write_?64() return -EINVAL when IDLE. Similar to how SCHED_IDLE doesn't do nice.