Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3225596imu; Wed, 7 Nov 2018 07:05:34 -0800 (PST) X-Google-Smtp-Source: AJdET5ejMnTPZ1H8wnfePXhceFt7Yd8ItrsnuOsjlObaS3pXDb35cUMQ6Pt7+nRqitDtj7axmwvY X-Received: by 2002:aa7:87d0:: with SMTP id i16-v6mr580866pfo.20.1541603134156; Wed, 07 Nov 2018 07:05:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541603134; cv=none; d=google.com; s=arc-20160816; b=BzjxioHG9iftBlI2YoLXWWAd97OVoeSIVs0ThKQdXh5jYa72cRbKeCetdc+unnIjle W0PPsa3yozVqhc2vqTgJJSkZnOEwLLnneqWrA7Qo92AEFJqZwhd8PIfGVbz1JFEIReMm lDhKwzx29LhGUowuDHOAERZWTygndiMb33IORQMYKUmF0naVQmJwurKBbP4rowUQrAl/ DeuE5T0U3W89Sjzgxqbw7h/TRqvymrZjlUHi6AAAKmoj4y2hSSR9YWFbGqWJ1MS9VUJ3 5NDQzKLh4RHOQk4tFMrqm2Nq7q+P+kIWnsfplDh3GLuJZIOvTtM/oOGz3l6ErgtQCRF7 CxwA== 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=Rx79w2EJDrsf2AkeODfWKfx1Bag2Wx+YcpdZu7yHJSk=; b=hWMiNMIejPD2H4RqZPmsMZ3iAEZ4Ttw50+O0E5pvQTkdK6hnM3L41Xv2AofBj1alot sLOMLVOsdmVhclLoCGLJe3rz3vuGRMnLH/N+c2iwglfyEwV+O2LCsLbLf3XZUkveYmme 7/MneKLRnpNhqLoxv/o+2GbrskRbc8r+WoUen9lr0qbL1qfEGQa1kRmbq14HiPFvyViV 6KbqWjKkuGbw53ejFOyJEFtAlkqRYjh4NuErxkx8Ti4t8IgMWPFaUFFMkE1tDnhR9HQa WsgmAK3TIgyMkloIFGQvY45Xm/3zyW6iB0WtvoN5icTaD1SMJSusKHfVBF/cZcGASgpN wnHw== ARC-Authentication-Results: i=1; mx.google.com; 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 a23-v6si830078pls.322.2018.11.07.07.05.18; Wed, 07 Nov 2018 07:05:34 -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; 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 S1731067AbeKHAfU (ORCPT + 99 others); Wed, 7 Nov 2018 19:35:20 -0500 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:52614 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726635AbeKHAfT (ORCPT ); Wed, 7 Nov 2018 19:35:19 -0500 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id A49C880D; Wed, 7 Nov 2018 07:04:35 -0800 (PST) Received: from e110439-lin (e110439-lin.cambridge.arm.com [10.1.194.43]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id D5D0C3F5BD; Wed, 7 Nov 2018 07:04:32 -0800 (PST) Date: Wed, 7 Nov 2018 15:04:30 +0000 From: Patrick Bellasi To: Peter Zijlstra 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 Subject: Re: [PATCH v5 03/15] sched/core: uclamp: map TASK's clamp values into CPU's clamp groups Message-ID: <20181107150430.GL14309@e110439-lin> References: <20181029183311.29175-1-patrick.bellasi@arm.com> <20181029183311.29175-4-patrick.bellasi@arm.com> <20181107133504.GQ9781@hirez.programming.kicks-ass.net> <20181107144809.GH14309@e110439-lin> <20181107145527.GI9761@hirez.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20181107145527.GI9761@hirez.programming.kicks-ass.net> User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 07-Nov 15:55, Peter Zijlstra wrote: > On Wed, Nov 07, 2018 at 02:48:09PM +0000, Patrick Bellasi wrote: > > On 07-Nov 14:35, Peter Zijlstra wrote: > > You mean se_count overflow ? > > Yah.. > > > > And I'm not really a fan of hiding that error in a define like you keep > > > doing. > > > > The #define is not there to mask an overflow, it's there to catch the > > +#define UCLAMP_MAPERR "clamp value [%u] mapping to clamp group failed\n" > > Is what I was talking about. > > > > What's wrong with something like: > > > > > > if (SCHED_WARN(free_group_id == UCLAMP_GROUPS)) > > > return; > > > > Right, the flow should be: > > > > 1. try to find a valid clamp group > > 2. if you don't find one, the data structures are corrupted > > warn once for data corruption > > do not map this scheduling entity and return > > 3. map the scheduling entity > > > > Is that ok ? > > That's what the proposed does. > > > > and > > > > > > > + uc_map_new.se_count = uc_map_old.se_count + 1; > > > > > > if (SCHED_WARN(!new.se_count)) > > > new.se_count = -1; > > > > Mmm... not sure we can recover from a corrupted refcount or an > > overflow. > > > > What should we do on these cases, disable uclamp completely ? > > You can teach put to never decrement -1 (aka. all 1s). Still we don't know when re-enable -1 again... But, with bucketization, this will eventually turns into a small performance penalty at run-time when a CPU clamp group is going to be empty (since we will end up scanning an array with some holes to find out the new max)... maybe still acceptable... Will look into that for v6! Thanks > But its all SCHED_DEBUG stuff anyway, so who really cares. -- #include Patrick Bellasi