Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3044522imu; Wed, 7 Nov 2018 04:12:03 -0800 (PST) X-Google-Smtp-Source: AJdET5dNPoCGolHFMPAQuu0+I8zciAE5Lr58O9SuhpJVYhXBxfv/SMTeGK/5QvjEfLmbgSqOgQej X-Received: by 2002:a63:f0c:: with SMTP id e12mr1328012pgl.274.1541592723752; Wed, 07 Nov 2018 04:12:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541592723; cv=none; d=google.com; s=arc-20160816; b=NjkrzI1jbbQZAY3PEQan18pjE9uk35VtueBLEgpoi3jH3spvQ3GHnQ55goe0XOWqNt f6HOfLhDPuc6I6fCSSQC34iWV019zTTovC7TxV9Jq7fCVRqK73sfHlQ/qEngGVcl9v0U 4ZrfDw50w3VT0C+8emAj8vaJUspIHs/XmaVaMB+D03M3CbE4U4CKIpqaA1kOJE4RsA8x AB71qzWYL5CJNgrYfbBZd3wAeouTJmg4iP2qYVS43FxeFS4VxfYkntl5tmVpl1MactUf K0RAXlQ5TVAzqvcjEUqdJ4L7XNqv9MAf3IdqFh3T1sOVFBfONmUew3qsgs9myvCfXJz1 KyYg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=MBM4IhaMAH+Go2Pfdu7c4ojjL2kIGoItGR9QxJ5RsD4=; b=plIWERU52BnYHSxKaxvJq4PEt990nIsvtn5YvfsUuwyhTq2c0ZEk7OvQ3oy3Hz82/6 XVMpVafV1FvPhPqxfs93AB/xmpvWb4uFK7sjqnPx4ju8Ju68qMhF/OnIMSQ/Au3R1RpF PAulMl85juGG8WuYv/5AjeLC4rm9MyDwC7s5zhTvehPXd/G85ksk55dmm7F+Gkj4ICa6 KMg7iFPwvMHTPGujL8OCZmG/aTE4FPdiTCTsxp+z+Mxm5lDFMhhb5dwSAhiaz/xlChPo 50en9M3/gsX9vcuYF6uwPMWa5D6GwiXlcTKr664xr10TuBBO5jCaPoQ48h1GgCfVVW4D I9BA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=merlin.20170209 header.b=amLPf6Js; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 3-v6si498008plz.12.2018.11.07.04.11.48; Wed, 07 Nov 2018 04:12:03 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@infradead.org header.s=merlin.20170209 header.b=amLPf6Js; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730990AbeKGVkE (ORCPT + 99 others); Wed, 7 Nov 2018 16:40:04 -0500 Received: from merlin.infradead.org ([205.233.59.134]:58864 "EHLO merlin.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726560AbeKGVkD (ORCPT ); Wed, 7 Nov 2018 16:40:03 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.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:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=MBM4IhaMAH+Go2Pfdu7c4ojjL2kIGoItGR9QxJ5RsD4=; b=amLPf6JscJIGeGunJEZ9dvBCX sNwWIGn1in7foToi8Otw6+Oxwdih3uCsSAMUE+3e8BQDNbhKjMYX4HlsbAAUvuCrIH6Jz3rzO3JBv qHOcwLMNEJ4y4MVp5FgJKDc9o57HXdXcJ7IbObLMiOxNpUbtq9iD7U87wFl35IP33t42epJsrz1oB QMLRoGKA/CXcviXCom89LN7anyzRCKGbXZlpnITV8DLPvYlaZn1xSN/soDXpKFow0xP66qaXj/3d5 m6IX2YNnA2oaHkOacPvWDJkryUDTEQANoY9SXdb5PU6N2JmGxuszMyD7wwG0DYKCI1yHuTeaNkA6F PfbLXpTQw==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=hirez.programming.kicks-ass.net) by merlin.infradead.org with esmtpsa (Exim 4.90_1 #2 (Red Hat Linux)) id 1gKMeX-0005SD-DV; Wed, 07 Nov 2018 12:09:45 +0000 Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id AA3CF20284F94; Wed, 7 Nov 2018 13:09:42 +0100 (CET) Date: Wed, 7 Nov 2018 13:09:42 +0100 From: Peter Zijlstra To: Patrick Bellasi Cc: linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, Ingo Molnar , Tejun Heo , "Rafael J . Wysocki" , Vincent Guittot , Viresh Kumar , Paul Turner , Quentin Perret , Dietmar Eggemann , Morten Rasmussen , Juri Lelli , Todd Kjos , Joel Fernandes , Steve Muckle , Suren Baghdasaryan , Randy Dunlap , linux-api@vger.kernel.org Subject: Re: [PATCH v5 01/15] sched/core: uclamp: extend sched_setattr to support utilization clamping Message-ID: <20181107120942.GM9781@hirez.programming.kicks-ass.net> References: <20181029183311.29175-1-patrick.bellasi@arm.com> <20181029183311.29175-2-patrick.bellasi@arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20181029183311.29175-2-patrick.bellasi@arm.com> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Oct 29, 2018 at 06:32:55PM +0000, Patrick Bellasi wrote: > diff --git a/include/uapi/linux/sched.h b/include/uapi/linux/sched.h > index 22627f80063e..c27d6e81517b 100644 > --- a/include/uapi/linux/sched.h > +++ b/include/uapi/linux/sched.h > @@ -50,9 +50,11 @@ > #define SCHED_FLAG_RESET_ON_FORK 0x01 > #define SCHED_FLAG_RECLAIM 0x02 > #define SCHED_FLAG_DL_OVERRUN 0x04 > +#define SCHED_FLAG_UTIL_CLAMP 0x08 > > #define SCHED_FLAG_ALL (SCHED_FLAG_RESET_ON_FORK | \ > SCHED_FLAG_RECLAIM | \ > - SCHED_FLAG_DL_OVERRUN) > + SCHED_FLAG_DL_OVERRUN | \ > + SCHED_FLAG_UTIL_CLAMP) > > #endif /* _UAPI_LINUX_SCHED_H */ > diff --git a/include/uapi/linux/sched/types.h b/include/uapi/linux/sched/types.h > index 10fbb8031930..fde7301ed28c 100644 > --- a/include/uapi/linux/sched/types.h > +++ b/include/uapi/linux/sched/types.h > @@ -9,6 +9,7 @@ struct sched_param { > }; > > #define SCHED_ATTR_SIZE_VER0 48 /* sizeof first published struct */ > +#define SCHED_ATTR_SIZE_VER1 56 /* add: util_{min,max} */ > > /* > * Extended scheduling parameters data structure. --- a/kernel/sched/core.c +++ b/kernel/sched/core.c @@ -4533,6 +4533,10 @@ static int sched_copy_attr(struct sched_ if (ret) return -EFAULT; + if ((attr->sched_flags & SCHED_FLAG_UTIL_CLAMP) && + size < SCHED_ATTR_SIZE_VER1) + return -EINVAL; + /* * XXX: Do we want to be lenient like existing syscalls; or do we want * to be strict and return an error on out-of-bounds values?