Received: by 10.192.165.148 with SMTP id m20csp5245024imm; Wed, 9 May 2018 01:42:38 -0700 (PDT) X-Google-Smtp-Source: AB8JxZpNxh+6mB79GJJXen3msMp1QWBNba322MUKMp/UewV0ou8FrtIi4EcoI96YPAW3uRrV/PwK X-Received: by 10.98.156.147 with SMTP id u19mr42603956pfk.74.1525855358605; Wed, 09 May 2018 01:42:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525855358; cv=none; d=google.com; s=arc-20160816; b=Rgv82n+WG0FzCry8Qf/YCJDTED0Sjh+dTiuRuKxU4ei+3dg90zUnGR+2QS17U7ZW8y 4Ugg2aualoszrhzSRo3hJ2BcR5/4CS+z9WqaHX1g6TVm6wUuTOCSdUWJXbiEMSyPvUGb IGmupOZazIn0LhZMh3YFfnd+4U2RoddaYF+lWbkS3iZO7LfQ3QAhqJPwZPXafYICGqIj e39ioePaWPy3HOW1srvQwRUxUBOYpu9Kfw41fsS6hpxcxUikY/2hG1Vk5qHVZljSREzG kOkoljHvuL2a+WKW3E/LFa10SsrXM4vUfQZ3g9hrK9T4VRyjjedHZs/3kxO463dOhbmk 7mrA== 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=neUlJaAGtSQl4omAPqnUmaHRpK2Y7SiqpjzaYmEHgWs=; b=BYrXmKU3o3e0Ac4IdleEh1QfmSfXdLxme2eTLsSEykJ5U73G+kMMLjjXjVCg/TC0jk zhR7BaNdWlp2rCaNHEdYau53Z/O6Cq+Kh5G4pYUrt9XpXARiV2wo4HNXfo1iRBwanucI xQ0M34E13jKR9eugGqYmZwvfJpy0LNEFMPdxi7r08vNq8uHOqWxNHLy+XaFae3L+xudt f+hrg7RREb3d58nb72dv44D7wbH77Cb//9X7Z6mOta3AK7Tgl6qY7q2miz+rZqJwp3Lo +sRwNId0+f0VTz8VQo1tp3FLb31ovsb8Us6buFCBvmdK0D+fsL3T5CEi6TlLc7cf3SIM c0Qw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=gvAFQNYJ; 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=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f89-v6si26932278plf.488.2018.05.09.01.42.24; Wed, 09 May 2018 01:42: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=fail header.i=@gmail.com header.s=20161025 header.b=gvAFQNYJ; 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=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934406AbeEIIlx (ORCPT + 99 others); Wed, 9 May 2018 04:41:53 -0400 Received: from mail-ot0-f179.google.com ([74.125.82.179]:44632 "EHLO mail-ot0-f179.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934274AbeEIIlt (ORCPT ); Wed, 9 May 2018 04:41:49 -0400 Received: by mail-ot0-f179.google.com with SMTP id g7-v6so39257351otj.11; Wed, 09 May 2018 01:41:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=neUlJaAGtSQl4omAPqnUmaHRpK2Y7SiqpjzaYmEHgWs=; b=gvAFQNYJb4RiZ1c9PdcGNiysBp0WpEulFazbqC7sl3+gmclQlaaIfxjVUtvVw6a9Tv bT6V2CSvPrBEBYOxA2Ft+Onqq5D7Bo6/3NjuhXY/hVM6zSx7rPv5KpecRQsai/Ubtcto fdsmAK1xsyLHju8xzd0rfiHJO1i0kU5YEn4fDkJhNz4s6ChW7vyccpqxzu2tfjiUIkZf yiZ4s87dpFZP3fqdjFrh4DEr7d2jIyGeFT9vDdr2BVDqLazu4I0/5vqXJoZ00iXfZuIC c2JjNEw2YWAvGtiMIRJcQ5jeGq0k+d2uA9Fa8X31MICzrAOe7gpei8+OXPBeGRQPcmow HvZw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=neUlJaAGtSQl4omAPqnUmaHRpK2Y7SiqpjzaYmEHgWs=; b=AH50vypbvL4Yfp8K0YkzGtmHgxJ8GQk1W90ik2SH9lYgO2akCgIvYR8uyEqjdCHHlB LxfW43wCmQAFGOsuelzPQhPLDOJlVmulE66EriXqR6BcHLUhqKxWYe4Ncr6RGH9BZk5Q DUsavNMamxzPZaq5s6IZVzJn7pMqW+U6J19/UOiMgtMm1HejBo5WZPSaOCc+/6m5e9hH 4YfNhSriTiIDo1s+dQMoC8sx1kMWBrDg89QIvoTbxYQHmJjReOJfT88emMAWNtqWOo2u oO6jCy0y8GrcQKeHZ9pHsVQgzGAH8AiNdQnbSJcR9GD0d+cqxPPLWmXpldHI1w5WY2kn qrvg== X-Gm-Message-State: ALKqPweMnlyomyx3eYbDHQFJjO1ZRL1eWk1D/ZPFRv4ULzhgKVTQsv/s aSfx9f1cpRQMUI2g9wJRp5gleuoQ98Y2UCmg0Ic= X-Received: by 2002:a9d:5990:: with SMTP id u16-v6mr4906969oth.370.1525855308854; Wed, 09 May 2018 01:41:48 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a9d:1468:0:0:0:0:0 with HTTP; Wed, 9 May 2018 01:41:48 -0700 (PDT) In-Reply-To: <20180509082259.GB76874@joelaf.mtv.corp.google.com> References: <1525704215-8683-1-git-send-email-claudio@evidence.eu.com> <20180508065435.bcht6dyb3rpp6gk5@vireshk-i7> <20180509045425.GA158882@joelaf.mtv.corp.google.com> <20180509064530.GA1681@localhost.localdomain> <20180509065449.c5zotxqmuyatjgfd@vireshk-i7> <20180509070113.GB52784@joelaf.mtv.corp.google.com> <20180509082259.GB76874@joelaf.mtv.corp.google.com> From: "Rafael J. Wysocki" Date: Wed, 9 May 2018 10:41:48 +0200 X-Google-Sender-Auth: -H8pasjSlXDWgh5QXa_HqsjKfjA Message-ID: Subject: Re: [RFC PATCH] sched/cpufreq/schedutil: handling urgent frequency requests To: Joel Fernandes Cc: "Rafael J. Wysocki" , Juri Lelli , Viresh Kumar , Claudio Scordino , Linux Kernel Mailing List , "Rafael J . Wysocki" , Peter Zijlstra , Ingo Molnar , Patrick Bellasi , Luca Abeni , Joel Fernandes , Linux PM 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 Wed, May 9, 2018 at 10:22 AM, Joel Fernandes wrote: > On Wed, May 09, 2018 at 10:05:09AM +0200, Rafael J. Wysocki wrote: >> On Wed, May 9, 2018 at 9:01 AM, Joel Fernandes wrote: >> > On Wed, May 09, 2018 at 12:24:49PM +0530, Viresh Kumar wrote: >> >> On 09-05-18, 08:45, Juri Lelli wrote: >> >> > On 08/05/18 21:54, Joel Fernandes wrote: >> >> > Isn't this potentially introducing unneeded irq pressure (and doing the >> >> > whole wakeup the kthread thing), while the already active kthread could >> >> > simply handle multiple back-to-back requests before going to sleep? >> >> >> >> And then we may need more instances of the work item and need to store >> >> a different value of next_freq with each work item, as we can't use >> >> the common one anymore as there would be races around accessing it ? >> > >> > Exactly. I think it also doesn't make sense to over write an already >> > committed request either so better to store them separate (?). After the >> > "commit", that previous request is done.. >> >> Why is it? >> >> In the non-fast-switch case the "commit" only means queuing up an >> irq_work. Which BTW is one of the reasons for having work_in_progress >> even if your kthread can handle multiple work items in one go. > > Ok I agree. I just thought there was something funky with the meaning of > commit from a cpufreq perspective. > > In the last diff I just sent out, I actually keep work_in_progress and > consider its meaning to be what you're saying (has the kthread been kicked) > and lets such "overwriting" of the next frequency to be made possible. Also > with that we would be servicing just the latest request even if there were > multiple ones made. My understanding of this is that when the kthread actually starts changing the frequency, it can't really roll back (at least not in general), but there may be multiple following requests while the frequency is being changed. In that case the most recent of the new requests is the only one that matters. So IMO the kthread should make a local copy of the most recent request to start with, process it and let the irq_work update the most recent request data as new requests come in. When done with the previous frequency change, the kthread can make a local copy of the most recent request again and so on. This should work, because there is only one irq_work updating the most recent request data.