Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp584510imm; Wed, 23 May 2018 02:02:43 -0700 (PDT) X-Google-Smtp-Source: AB8JxZrtBqlbfreRHz5Tv9Kp7Q+qfRj4CFHw0NSMSDcl+BjUyRJ6pJHAbYl/P4yzIDO5ogsbsHyq X-Received: by 2002:a17:902:778a:: with SMTP id o10-v6mr2119119pll.214.1527066163553; Wed, 23 May 2018 02:02:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527066163; cv=none; d=google.com; s=arc-20160816; b=pCJgn4RB58ipsOhAlJpKlwjNJVy4aRblNCicOgNCGIa8x0DGNWBD/zBBt0EWv8B3r4 eROLzMvCa6yfs90ZCpQyut5I1m34ylCKrYU+YTQMy5HC7Sdzkp2loUDjnCQaugyP6ERI 2UKtB3eoCoGhXl+8LbHDsrsoxnLg5Y8en2DZwn1AOiR/ccNuKSaTlyXXbzRAh22Hyuqy tXiaXlfid81BMSBHSzvlk91+9CmAfOWpVqRJQMXMvIb9ay7LVb1mwrMrtyL3NZBlrRAL FtXa4D08QJVuUht6VjLX9ljxww9tRad+V2FiDAFIhBLduIX84tJA271P4r/hn2XRomSP pLFA== 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:dkim-signature:arc-authentication-results; bh=gdU1zM6hIowsHQ0bQrkHQN1+yKuiyTwnmfrqB01Djjg=; b=k63blyGDyoNoiMriMcVj6CqceaYYoYM+AAiHfeLUW3S0ukoV2+7tWWW61osyaZ9H6r 7i43F4y6dhPX/lB1HYMY9seI4dPf/zjRif5D0x3jk8rXLA+Ye3QnX7D7WQqHABccN4fm M+LzQEou6J96VikgetwE7oRbUG5/+CX+aDg8KtJRhqllaKynE7xkXcaVOSPE7GhCwFxy F3rD4WEjk0gtMcu90wF1I+DAH8zcw1sDqf0L2Zl/9Yxe1PKGNYXS/rfrLp1he2X1UDZc qULv2IFJwGwHt6ISMEfbiRvnp2U5aJFVqArZgclq9COvbe2H2lhdrOYsahLpVR9ffQyR ICwA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=J73jhZA2; 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=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p13-v6si13834850pgv.182.2018.05.23.02.02.28; Wed, 23 May 2018 02:02:43 -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=@linaro.org header.s=google header.b=J73jhZA2; 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=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932132AbeEWJBJ (ORCPT + 99 others); Wed, 23 May 2018 05:01:09 -0400 Received: from mail-pg0-f65.google.com ([74.125.83.65]:34929 "EHLO mail-pg0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754378AbeEWJBG (ORCPT ); Wed, 23 May 2018 05:01:06 -0400 Received: by mail-pg0-f65.google.com with SMTP id 11-v6so7492233pge.2 for ; Wed, 23 May 2018 02:01:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=gdU1zM6hIowsHQ0bQrkHQN1+yKuiyTwnmfrqB01Djjg=; b=J73jhZA2gLK6IUNjIyhVHCSsM3OrcFZ/K7GwlWW90RiIichiyUSdJREUT8Vo4xMawC CEWeSzrYCqWRQh1cYo/o+f1EqiEaNKhIV6SIcs9kngcnE2NYFFxAp9Huq1K9BpcV8qE6 MFZvxZUMfWxtUJGSZtY5eZdW6lcdK/I8LfRko= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=gdU1zM6hIowsHQ0bQrkHQN1+yKuiyTwnmfrqB01Djjg=; b=lsIlwg4hAfJSfHBJA8U1uP4LjptjZ67myZQ30KNNciFeuwxtu6+biUO8efdceZEsR3 aqYUss+OGpcH/TnL5YLI+eiz/+xFnUEweVwg2SloRooHsMXiGUe2c80six+FMI8d3NZd p97sLfDpPZejBdfZsNCfsIBhxW9XBcSFu+Y1McyWXObIsowOM4Qq+ZmXQQ4C9V2ix6a8 E+9u9c48RCbXdxVjSfjECikdE5nlM/7Q2QnPOvGRXVZkhNXpkLbfjIqtba1i27odShIl qTxHtk75Ch8PMz7nTN5njaiVnarERq0zx6HTn97vBU933OypCSduz3MdKgaZwxMlUy6V QtGg== X-Gm-Message-State: ALKqPwdA8oAFbqZn9O7qo2Amh10eLpmldp9Bf1ShoDCuuOewfxiiCald 2BdR8di2UQfQtYSuSwL1bJOYYw== X-Received: by 2002:a63:7f11:: with SMTP id a17-v6mr1635966pgd.453.1527066064676; Wed, 23 May 2018 02:01:04 -0700 (PDT) Received: from localhost ([122.167.129.138]) by smtp.gmail.com with ESMTPSA id v142-v6sm27799548pgb.61.2018.05.23.02.01.03 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 23 May 2018 02:01:03 -0700 (PDT) Date: Wed, 23 May 2018 14:31:01 +0530 From: Viresh Kumar To: Joel Fernandes 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 Subject: Re: [PATCH v2] schedutil: Allow cpufreq requests to be made even when kthread kicked Message-ID: <20180523090101.6xifikvjpirqafox@vireshk-i7> References: <20180518185501.173552-1-joel@joelfernandes.org> <20180522103415.cuutobi5kbhj4gcw@vireshk-i7> <20180522220953.GB40506@joelaf.mtv.corp.google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180522220953.GB40506@joelaf.mtv.corp.google.com> User-Agent: NeoMutt/20180323-120-3dd1ac Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 22-05-18, 15:09, Joel Fernandes wrote: > I agree with the race you describe for single policy slow-switch. Good find :) > > The mainline sugov_work could also do such reordering in sugov_work, I think. 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. AIUI, > mutex_unlock is expected to be only a release-barrier. > > Although to be safe, I could just put an smp_mb() there. I believe with that, > no locking would be needed for such case. > > 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. 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. -- viresh