Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp1370424ybt; Thu, 25 Jun 2020 04:34:47 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz8K5tYpD2Jr8bx0bRn2XyiE6UWrLZlmfObuX4oBxXVGrBtoaEWBSbPqQbSNqdT7YNEKh7H X-Received: by 2002:aa7:d353:: with SMTP id m19mr17584784edr.75.1593084887733; Thu, 25 Jun 2020 04:34:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1593084887; cv=none; d=google.com; s=arc-20160816; b=zrlzaWyXm3c50wDmpdsOXfppXNCgol7jqY12zg9Qo87CPqglObT5uLAfiozvOYhhkM /srYM6ygA8jajYrn4750PQC0+QyomOrzivhdC1I/jASjcT1LgO/B5ixBLcVpJ2HaFI3P 8iou4tW+K2WZ0Tu5CoWX8Sm6XacKVaW0d6iy0N4qCE3u996QV21748udbTXk0hzw9dXY 6kRgbbuzJ3yDTLARvqX9URyqZiYBujxL8B+FCP2Zz6Mipp82Lzf+B1dPdf5sAF56xAjs crcdZNeUpS8pwRMimU1Vb1iNlnc55pFivi7vMKy599ssYYcPTvK5/os8NtNNDipGEP7T 4urw== 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; bh=moh9dRF6BjqMmm304tqT8yiz+V81jVL8AMIWb01LcYc=; b=OXyJm1IVw41fRPuasBn0KL/GzY7KrJ3MM2+mRHxZv9ztdJtdgpD5A4obtAm1nZBEsU pOFZwqajtgga0kiV2bMzwqY87u3DR2LYeprXX7xdBMxnCY5oiJwO97N5aMbHxggM3YRk 9LdqFnL1pA5/hVRGoU5OXDW4YwQ4hzAGmwwyOesbSZZA3UWcSY8TTFMPJ1ifk6hp8K7l G1adIed41K8tvLH3cJ5ts5H0LgR3+3x2UdKkyItQYgfcYFFG9pIlk4znvv9h4PswdaR2 Pst/qjPd1r5gmKWZNNyn6eCYXz3Ec2X+cjNALjqloGZGENl12Bw9y1I/DmElL+0oYaC0 9XuA== ARC-Authentication-Results: i=1; mx.google.com; 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 l2si6442224edk.332.2020.06.25.04.34.24; Thu, 25 Jun 2020 04:34:47 -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; 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 S2404253AbgFYLeM (ORCPT + 99 others); Thu, 25 Jun 2020 07:34:12 -0400 Received: from foss.arm.com ([217.140.110.172]:35978 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2404239AbgFYLeM (ORCPT ); Thu, 25 Jun 2020 07:34:12 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id E11791042; Thu, 25 Jun 2020 04:34:11 -0700 (PDT) Received: from e107158-lin.cambridge.arm.com (e107158-lin.cambridge.arm.com [10.1.195.21]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 3E30D3F73C; Thu, 25 Jun 2020 04:34:10 -0700 (PDT) Date: Thu, 25 Jun 2020 12:34:07 +0100 From: Qais Yousef To: Valentin Schneider Cc: Ingo Molnar , Peter Zijlstra , Juri Lelli , Vincent Guittot , Dietmar Eggemann , Steven Rostedt , Ben Segall , Mel Gorman , Patrick Bellasi , Chris Redpath , Lukasz Luba , linux-kernel@vger.kernel.org Subject: Re: [PATCH v3 2/2] sched/uclamp: Protect uclamp fast path code with static key Message-ID: <20200625113407.awok7pd64fgt7cii@e107158-lin.cambridge.arm.com> References: <20200624172605.26715-1-qais.yousef@arm.com> <20200624172605.26715-3-qais.yousef@arm.com> <20200625110006.q3iepcrh2uh4oizv@e107158-lin.cambridge.arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: User-Agent: NeoMutt/20171215 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 06/25/20 12:26, Valentin Schneider wrote: > > On 25/06/20 12:00, Qais Yousef wrote: > > Hi Valentin > > > > On 06/25/20 01:16, Valentin Schneider wrote: > >> In schedutil_cpu_util(), when uclamp isn't compiled it, we have an explicit > >> 'goto max'. When uclamp *is* compiled in, that's taken care of by the > >> "natural" RT uclamp aggregation... Which doesn't happen until we flip the > >> static key. > >> > >> It's yucky, but if you declare the key in the internal sched header, you > >> could reuse it in the existing 'goto max' (or sysctl value, when we make > >> that tweakable) path. > > > > Not sure if this is the best way forward. I need to think about it. > > While I am not keen on enabling in kernel users of util clamp, but there was > > already an attempt to do so. This approach will not allow us to implement > > something in the future for that. Which maybe is what we want.. > > > > Just to be clear, I'm not suggesting to add any in-kernel toggling of > uclamp outside of the scheduler: by keeping that to the internal sched > header & schedutil, we're keeping it contained to internal scheduler land. > > Since a diff is worth a thousand words, here's what I was thinking of (not > even compiled): Yeah I understood and already thought about this. But this approach could prevent potential in kernel-users. Whether we care or not about this now, I don't know. But it seems the simplest thing to do. > > >> > - if (update_root_tg) > >> > + if (update_root_tg) { > >> > uclamp_update_root_tg(); > >> > + static_branch_enable(&sched_uclamp_used); > >> > >> I don't think it matters ATM, but shouldn't we flip that *before* updating > >> the TG's to avoid any future surprises? > > > > What sort of surprises are you thinking of? > > > > Say if we end up adding static key checks in some other uclamp functions > (which are called in the TG update) and don't change this here, someone > will have to scratch their heads to figure out the key enablement needs to > be moved one line higher. It's harmless future-proofing, I think. Hehe okay, I'll change that. Thanks -- Qais Yousef