From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.3 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_PASS, USER_AGENT_MUTT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 96793C46464 for ; Wed, 7 Nov 2018 12:10:00 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 5BCF820892 for ; Wed, 7 Nov 2018 12:10:00 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="amLPf6Js" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 5BCF820892 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730996AbeKGVkE (ORCPT ); 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?