Received: by 2002:ac0:950c:0:0:0:0:0 with SMTP id f12csp3268416imc; Wed, 13 Mar 2019 13:15:12 -0700 (PDT) X-Google-Smtp-Source: APXvYqw9dxjEYA7eeC4IkDuLSGzYMP8eWQa1s3Gb1v+8mAK+G1nQ0MmpQCl1xUDh9KUxAbZ9ssuk X-Received: by 2002:a17:902:8303:: with SMTP id bd3mr48083791plb.10.1552508111927; Wed, 13 Mar 2019 13:15:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1552508111; cv=none; d=google.com; s=arc-20160816; b=zUlQrFV3vbz8zngAx27nl4UVF4pHBFWmQ+8OhmLx88/IlGyxTOWFRue+Q+fZQkTYUS V41W7REj8hH10Gj5lYMN29napdPpg73FVa/FmUpWmQpHyjjGQ2EGJUVMFzZqaELzbMA6 ybmugJfELsXRm0wjcV/QkYTNSZsczdMWCH5gxv5AWm7G4ayRKWnpWmrn38lSt8Oyg1Dz S01KRsFeeRhqkS/Dy5Fqjx2/2GYJNABvTbCmYOI7EvpSJz8fQiDHezZ+/Yx73139ZpXc E7UvKR7NL88gN3Wx2NpgZFwLVRrcxd9hrZg1Jq7gpzXuNEsi2aPFulgbj6mOp80b8oYO /KaQ== 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=A6srmjvvJh+hUj2FSayXw3F3/P3B8oZnrD94Im0VWvI=; b=flVsGSMp7Lutml6T7juyh3VpyQAOvzZGe5xj53KO74wwBRTCnXAXaXSmb2/mPOsg3C KGizuIULtH3tBW18CZvEqlJajEUAjGbGcwqAcbYI4d/QAHoHxQCuY5stN6IEpztRJJdR aRVnKAee7Ihur1IxWDYjz1EzUU5fzv+OZ4BFb9yj2TAw8Icy8082a2l5J0C8EwFlZxEr IOJFVy8v6KDRqy1bw6bnnmpakHOIlARgFRkuLA4xshLW9ZH6jJDdfDqfwI2FdlL7Eabk bGwYAlYIPzS+rflV8NieG8peGAn5KjBhOj+g3/iCCjEoBPUU0njLXTKyEL1RdvRBkefJ CNXg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=epxItowi; 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 w8si6030650pll.164.2019.03.13.13.14.55; Wed, 13 Mar 2019 13:15:11 -0700 (PDT) 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=bombadil.20170209 header.b=epxItowi; 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 S1727227AbfCMUNw (ORCPT + 99 others); Wed, 13 Mar 2019 16:13:52 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:48560 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726892AbfCMUNw (ORCPT ); Wed, 13 Mar 2019 16:13:52 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.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=A6srmjvvJh+hUj2FSayXw3F3/P3B8oZnrD94Im0VWvI=; b=epxItowi9rrP35jg53C5FfLMI 3YvCzWzLkDQNGTdTBnW6UVbfc70ze5rn11oinJGXnojuU28kP1QOIR1WepEDtW2tuGK+5QHgeIhYn MnDqRBzPusHuw2ypnbT/pFCnxKxYRs/QAgt4TkvcHLQZm59DizoDJov71juGEnw1sFAZlNUjp8X5m +Bud7R/vDjKw3aHSViEuhp3UZ47chMaJkr2t588FvUmQufiOJLg5vAdlSpRbMIOCrlRr1nZNuAmwp cctX5r2FDS56vKBRbYY6A6mGWJ9tDwpFhG2Ch9cpEZaU0cHjLU05K0a97LUzbGV9I7oSTXcQ1+R0h v8nuS9UXg==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=worktop.programming.kicks-ass.net) by bombadil.infradead.org with esmtpsa (Exim 4.90_1 #2 (Red Hat Linux)) id 1h4AG1-0002nf-4Q; Wed, 13 Mar 2019 20:13:45 +0000 Received: by worktop.programming.kicks-ass.net (Postfix, from userid 1000) id C3AEF9826C0; Wed, 13 Mar 2019 21:13:42 +0100 (CET) Date: Wed, 13 Mar 2019 21:13:42 +0100 From: Peter Zijlstra To: Patrick Bellasi Cc: linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, linux-api@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 Subject: Re: [PATCH v7 03/15] sched/core: uclamp: Add system default clamps Message-ID: <20190313201342.GV2482@worktop.programming.kicks-ass.net> References: <20190208100554.32196-1-patrick.bellasi@arm.com> <20190208100554.32196-4-patrick.bellasi@arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190208100554.32196-4-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 Fri, Feb 08, 2019 at 10:05:42AM +0000, Patrick Bellasi wrote: > +int sysctl_sched_uclamp_handler(struct ctl_table *table, int write, > + void __user *buffer, size_t *lenp, > + loff_t *ppos) > +{ > + int old_min, old_max; > + int result = 0; Should this not have an internal mutex to serialize concurrent usage? See for example sched_rt_handler(). > + > + old_min = sysctl_sched_uclamp_util_min; > + old_max = sysctl_sched_uclamp_util_max; > + > + result = proc_dointvec(table, write, buffer, lenp, ppos); > + if (result) > + goto undo; > + if (!write) > + goto done; > + > + if (sysctl_sched_uclamp_util_min > sysctl_sched_uclamp_util_max || > + sysctl_sched_uclamp_util_max > SCHED_CAPACITY_SCALE) { > + result = -EINVAL; > + goto undo; > + } > + > + if (old_min != sysctl_sched_uclamp_util_min) { > + uclamp_default[UCLAMP_MIN].value = > + sysctl_sched_uclamp_util_min; > + uclamp_default[UCLAMP_MIN].bucket_id = > + uclamp_bucket_id(sysctl_sched_uclamp_util_min); > + } > + if (old_max != sysctl_sched_uclamp_util_max) { > + uclamp_default[UCLAMP_MAX].value = > + sysctl_sched_uclamp_util_max; > + uclamp_default[UCLAMP_MAX].bucket_id = > + uclamp_bucket_id(sysctl_sched_uclamp_util_max); > + } > + > + /* > + * Updating all the RUNNABLE task is expensive, keep it simple and do > + * just a lazy update at each next enqueue time. > + */ > + goto done; > + > +undo: > + sysctl_sched_uclamp_util_min = old_min; > + sysctl_sched_uclamp_util_max = old_max; > +done: > + > + return result; > +}