Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp617874imm; Wed, 23 May 2018 02:44:03 -0700 (PDT) X-Google-Smtp-Source: AB8JxZpIyRXSQRYkMKpuruHkqPTXikZoAHZkAQawA27NkrHfg/9MAnFvOPq8tiYFE8W9PDhQe9ur X-Received: by 2002:a63:6742:: with SMTP id b63-v6mr1775440pgc.54.1527068643395; Wed, 23 May 2018 02:44:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527068643; cv=none; d=google.com; s=arc-20160816; b=FwQYJs3TyyNcKsQERWPf/mj65XW+sWfmbwFOYCT5Bm33xVaKVpoWHox+iBjfBds0Lv BS9g6wCa4xzy7U20k5xFErL7i8baYP1BgC1Osxpg41536xwjDkWlb/F5k/B514s8cIH7 5cdBhP8M9kLKo84imjVLbNTD72PV1sFzUQ4dKIRhxEV7T7o4UT5ccyWXyTWH80Qzb6LE ZbOU1M2/4mjBeMblgoog9hCmL7/+cR/4I71wKPtkx7GQr5lwz4whJ7yZdXGqoT2SeQ+C uF6WpP51pCfGoPpOCVix0ywAwz+AkN7Js1tGECFYbowet+vHisL+MhRDof1yEkSg1pqN LSyQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:from:cc:to:subject :content-transfer-encoding:mime-version:references:in-reply-to :user-agent:date:dkim-signature:arc-authentication-results; bh=AvQikUAo6jvAotNEi16jLYEH8/oeeojQtDmduk/0s2A=; b=B1DK2rfs67VByJ1E3RXRim4IiKV4Y2W5I6yDEJqoXzSgvumYmDvobIQ1qVrk/TN7IX E+kiJcU97B+TZGGuOURcXMBk5UO1l+A2ojzae0lJtavtznV13QV58qx6ds3zVsVFnPUI Yd34H1LL5TRPQ3B9UtNGMr6IfDFT0nXy0WPcfmmgNl6MciHXF/53yy3GFjcmt2HUBBuz A8RdgODAK5H3h8B5AkdUcQdOlw6iMMlLncGOmO3CTA2KSD4JH5Z0ZnCWZEsP3ziapTtV 5l5VOGc1RbypJYDcWv1qqgm5zZKbfEH/SCcgpMlNvcSZGRXumjKUPxYNZPLYjKXQ0j/s +F5A== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@joelfernandes.org header.s=google header.b=NvLQgMuX; 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 m37-v6si18593406pla.148.2018.05.23.02.43.49; Wed, 23 May 2018 02:44:03 -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=@joelfernandes.org header.s=google header.b=NvLQgMuX; 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 S932277AbeEWJmi (ORCPT + 99 others); Wed, 23 May 2018 05:42:38 -0400 Received: from mail-pf0-f196.google.com ([209.85.192.196]:38151 "EHLO mail-pf0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932186AbeEWJmg (ORCPT ); Wed, 23 May 2018 05:42:36 -0400 Received: by mail-pf0-f196.google.com with SMTP id o76-v6so10222333pfi.5 for ; Wed, 23 May 2018 02:42:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=joelfernandes.org; s=google; h=date:user-agent:in-reply-to:references:mime-version :content-transfer-encoding:subject:to:cc:from:message-id; bh=AvQikUAo6jvAotNEi16jLYEH8/oeeojQtDmduk/0s2A=; b=NvLQgMuXqQ82+dPYjKbPYUgB1sMW9KHcknHvdgSPV6i1kLVeq75IXvUH/xOm9lxSx4 jXZS6MFBh8Oqvj9dn3hAzt0IksKu/UJ9OJFXOQTra67WpCu+jTx2OKj60GL4eSmQeT4P J7l+uEv9afzIfRBiM14m6mteaNwR80s+kqPLI= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:user-agent:in-reply-to:references :mime-version:content-transfer-encoding:subject:to:cc:from :message-id; bh=AvQikUAo6jvAotNEi16jLYEH8/oeeojQtDmduk/0s2A=; b=smHQr30wH/7Uc/MT2BRa+lF6FY6JuTyzCBrsqB82uJPWaGeU/ViF6woFpWT/xZkgPI ibnoRqijipajErFaD9NYAUlYct3YBV00884k3hnlA2p6d4FgMsUZv95xik9R1KCQl06B OIaRVO73jdEiCrDA8LrypUFh0ysZezYJ/334Vu0qsWM5jSwZxqOYQIMMJneD2Eo18W4E HviMTgLu3O817eWllbhckq2ZAwuNwgz6ZqDlQduCBcihODmn2qPzIO3PZbduNbtMaHNL cww7ATSRxtugbjeMp3VHHQE0psvcJ4qWFxfrkNe1CfFFGQU97+83gdMw6cfH47Bmi5x/ 8tVg== X-Gm-Message-State: ALKqPwdPtbIr8r24NWK8mK60qYD3ngVmzY6rsFPVljvVfBYIXrINbHgd m+NDB0y1ghIkSeUVpy9fy9ZbHQ== X-Received: by 2002:a65:5386:: with SMTP id x6-v6mr1739035pgq.188.1527068556386; Wed, 23 May 2018 02:42:36 -0700 (PDT) Received: from [192.168.0.114] ([24.6.205.35]) by smtp.gmail.com with ESMTPSA id t28-v6sm37704812pfk.161.2018.05.23.02.42.35 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 23 May 2018 02:42:35 -0700 (PDT) Date: Wed, 23 May 2018 02:42:32 -0700 User-Agent: K-9 Mail for Android In-Reply-To: <20180523090101.6xifikvjpirqafox@vireshk-i7> References: <20180518185501.173552-1-joel@joelfernandes.org> <20180522103415.cuutobi5kbhj4gcw@vireshk-i7> <20180522220953.GB40506@joelaf.mtv.corp.google.com> <20180523090101.6xifikvjpirqafox@vireshk-i7> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [PATCH v2] schedutil: Allow cpufreq requests to be made even when kthread kicked To: Viresh Kumar CC: "Joel Fernandes (Google.)" , linux-kernel@vger.kernel.org, "Rafael J . Wysocki" , Peter Zijlstra , Ingo Molnar , Patrick Bellasi , Juri Lelli , Luca Abeni , Todd Kjos , claudio@evidence.eu.com, kernel-team@android.com, linux-pm@vger.kernel.org From: Joel Fernandes Message-ID: <6A76301E-E383-439D-AD1E-6DC2B2CAC3CE@joelfernandes.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On May 23, 2018 2:01:01 AM PDT, Viresh Kumar = wrote: >On 22-05-18, 15:09, Joel Fernandes wrote: >> I agree with the race you describe for single policy slow-switch=2E >Good find :) >>=20 >> The mainline sugov_work could also do such reordering in sugov_work, >I think=2E Even >> with the mutex_unlock in mainline's sugov_work, that work_in_progress >write could >> be reordered by the CPU to happen before the read of next_freq=2E AIUI, >> mutex_unlock is expected to be only a release-barrier=2E >>=20 >> Although to be safe, I could just put an smp_mb() there=2E I believe >with that, >> no locking would be needed for such case=2E >>=20 >> I'll send out a v3 with Acks for the original patch, and the send out >the >> smp_mb() as a separate patch if that's Ok=2E > >Maybe it would be better to get the fix (with smp_mb) first and then >this optimization patch on the top? That would mean that the fix can >get applied to stable kernels easily=2E Probably=2E But then Rafael is changing single policy to use the lock so t= hen barrier wouldn't be needed at all=2E In that case, both mine and Rafael= new patch can go into stable which handles your race ( optimization =3D=3D= fix in this case :P ) thanks, - Joel --=20 Sent from my Android device with K-9 Mail=2E Please excuse my brevity=2E