Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp6003437imm; Mon, 23 Jul 2018 09:41:38 -0700 (PDT) X-Google-Smtp-Source: AAOMgpe0Dsy5xP6yfNN1V2muuKL1uwer3TjZ+IcunqmsLrCMvh4d9bgNDtZ0jqYjJ8j6grJcgC21 X-Received: by 2002:a62:9d14:: with SMTP id i20-v6mr13956532pfd.3.1532364098427; Mon, 23 Jul 2018 09:41:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532364098; cv=none; d=google.com; s=arc-20160816; b=fW5ciG9X30N0kYxqoHcs2Rb/Po3MmgABtqVB8rkKBV0IvX/+i5aFDYKUNODnykqShJ ZETApsJbPtNFfMYzOyZH1D8oKbt0Cmqgoysr0QzRCpNk0vn2jQP3Z13izVcZIodmsZTn zw9I7EyEnbxlbT6lbSau9/mtvqrrfskpGWwhKmyaAn/VZ+Pn5n1DpO7KVHGaNxUB3EtS /ooJUGmh7UQBK31cCfERcA5BYXAmwcJBEPGrYrFQUW71EwBARw3I7jOeO9iwCdzB9R0R pN9qqW2oHCX0DbY8RKS3znk1eUhUNrRQ1CRCWIxd0CU3h/Jquq4qJgQcjNH8B6zKvUTg gFeQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dkim-signature :arc-authentication-results; bh=sdbfCyumuNwhTC4R0PdOaII7r9U+SGWFspa0HltxNwE=; b=aUOBSB7WbZais+2qwK+o9iCPqHV9wCN1QCIkagUbhYKNb0w4PvTB0EPLMBpk/Umab2 LyJc5BeG2N8T0Zx9ktGOW6qvSPmdIo8A7c05s/qJl/3FQLKySHll7puvML5HhFKmClF5 ZyO2dghBi7eQguH6ziUglaZPPAt/oPUQV2MuIPtV+C17daUHghL8dNPmgMT3xNfFVcWe bVU/6MEQNnizz6t9JTEcOrbUo6H0F00wA7WLxSUOCQzF//TjJL6CHm1pSQdA2ZJmLU/D oL5268vANEKdkgRsCA+LGezUNHQn5HOJWfrWUs9huY8wgcGHoBArWSyxpoOwxZBW2nfn XiNw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=tagNIWif; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j8-v6si9027734pgi.575.2018.07.23.09.41.23; Mon, 23 Jul 2018 09:41:38 -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=pass header.i=@google.com header.s=20161025 header.b=tagNIWif; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388860AbeGWRmM (ORCPT + 99 others); Mon, 23 Jul 2018 13:42:12 -0400 Received: from mail-it0-f66.google.com ([209.85.214.66]:36662 "EHLO mail-it0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388561AbeGWRmM (ORCPT ); Mon, 23 Jul 2018 13:42:12 -0400 Received: by mail-it0-f66.google.com with SMTP id p81-v6so2142431itp.1 for ; Mon, 23 Jul 2018 09:40:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=sdbfCyumuNwhTC4R0PdOaII7r9U+SGWFspa0HltxNwE=; b=tagNIWifk/AOkrifmcKC7Y9sVITfcrWY/nR9A7vPGmdSnUMG1VUQrwL8iyD0uR9g4S 14qJJlz/upnWsJ172WJ4pwoKLBiyYwGGxOCrduD2+C3hL5SXghvPbWpnk3DGuxQGWKvo xFffpdGAMQB58hW6ouerwE4np3u+90CF07BOx63SG90HcIIOmTsmGiBcZdlGjPdWo6CH 23ZgyJt/hJ43rBpJnCAGqbmzf3gln8Q7cqmPLTRcBxag1VrN6swKLqSlTiKDx5eUOMBy TCtlF1beUCrDRF0W9m7Qn8Qm6APAZ6m0qZq83oVVIOGTR9mcGb3GkDCMmWHzQePxdJkn v4FQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=sdbfCyumuNwhTC4R0PdOaII7r9U+SGWFspa0HltxNwE=; b=DkD59jppM413SdOELiJQY9RoL9nS8bTDUgZ0ia/3RZtl9qdAHUqZGR+h9lURvnWzNc vU2pDeSeSQvs9PByHyd7PuTsYcrUY7usTUNGv+7D0UQAredciQXz8XGaxrnA4ipE1YU4 XYKuyItqXrlLJ/HA4NMpOKQEWSCz1dk45Kxl845nd02E5rP04mUd/u+K6QU7nFlvKSnC DARsvDt+6dW46Ft6XobUk6bHNuBEVIQ8JjIv9zcL6KLwk6dlgoKW/kawl1FrC2QBYGz+ 9FUVBxoQI2mg9FXeOaLEPdsUAYQmcfmpbY8fQji2h0xiubO5qOdwD1S6LkMe1s/1Laro k7Gg== X-Gm-Message-State: AOUpUlF1qLSOW8l23s+kmLi0cXnovBtUuAmRdPs6jwubj931LWIQoCh3 cohXOuAMLHKSxi3aCejdWE6qoI26tTWau+AzQM4vDg== X-Received: by 2002:a02:5952:: with SMTP id p79-v6mr11817860jab.129.1532364008981; Mon, 23 Jul 2018 09:40:08 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:ac0:e445:0:0:0:0:0 with HTTP; Mon, 23 Jul 2018 09:40:08 -0700 (PDT) In-Reply-To: <20180723150249.GD2683@e110439-lin> References: <20180716082906.6061-1-patrick.bellasi@arm.com> <20180716082906.6061-8-patrick.bellasi@arm.com> <20180723150249.GD2683@e110439-lin> From: Suren Baghdasaryan Date: Mon, 23 Jul 2018 09:40:08 -0700 Message-ID: Subject: Re: [PATCH v2 07/12] sched/core: uclamp: enforce last task UCLAMP_MAX To: Patrick Bellasi Cc: linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, Ingo Molnar , Peter Zijlstra , Tejun Heo , "Rafael J . Wysocki" , Viresh Kumar , Vincent Guittot , Paul Turner , Dietmar Eggemann , Morten Rasmussen , Juri Lelli , Todd Kjos , Joel Fernandes , Steve Muckle Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Jul 23, 2018 at 8:02 AM, Patrick Bellasi wrote: > On 20-Jul 18:23, Suren Baghdasaryan wrote: >> Hi Patrick, > > Hi Sure, > thank! > >> On Mon, Jul 16, 2018 at 1:29 AM, Patrick Bellasi >> wrote: > > [...] > >> > @@ -977,13 +991,21 @@ static inline void uclamp_cpu_get_id(struct task_struct *p, >> > uc_grp = &rq->uclamp.group[clamp_id][0]; >> > uc_grp[group_id].tasks += 1; >> > >> > + /* Force clamp update on idle exit */ >> > + uc_cpu = &rq->uclamp; >> > + clamp_value = p->uclamp[clamp_id].value; >> > + if (unlikely(uc_cpu->flags & UCLAMP_FLAG_IDLE)) { >> >> The condition below is not needed because UCLAMP_FLAG_IDLE is set only >> for UCLAMP_MAX clamp_id, therefore the above condition already covers >> the one below. > > Not really, this function is called two times, the first time to > update UCLAMP_MIN and a second time to update UCLAMP_MAX. > > For both clamp_id we want to force update uc_cpu->value[clamp_id], > thus the UCLAMP_FLAG_IDLE flag has to be cleared only the second time. > > Maybe I can had the following comment to better explain the reason of > the check: > > /* > * This function is called for both UCLAMP_MIN (before) and > * UCLAMP_MAX (after). Let's reset the flag only the when > * we know that UCLAMP_MIN has been already updated. > */ > Ah, my bad. I missed the fact that uc_cpu->flags is shared for both UCLAMP_MIN and UCLAMP_MAX. It's fine the way it originally was. Thanks for explanation! >> > + if (clamp_id == UCLAMP_MAX) >> > + uc_cpu->flags &= ~UCLAMP_FLAG_IDLE; >> > + uc_cpu->value[clamp_id] = clamp_value; >> > + return; >> > + } > > [...] > > -- > #include > > Patrick Bellasi