Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp37339399rwd; Tue, 11 Jul 2023 12:51:42 -0700 (PDT) X-Google-Smtp-Source: APBJJlGIqlawcWTst2MmaNP/mVA2InvVLUZk9DM+p9ZLEppfKKf6s+psBGG+ECs12RFoHA8dCt3j X-Received: by 2002:a05:6512:15a3:b0:4fb:89f2:594c with SMTP id bp35-20020a05651215a300b004fb89f2594cmr16135208lfb.56.1689105102450; Tue, 11 Jul 2023 12:51:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689105102; cv=none; d=google.com; s=arc-20160816; b=knnucy2KP0/1GmpaUyEd7XnJBMXaeCkoRV1C8mSTzntD4Ny4Uu/Na+9A8L4hMhZuwe w5iuky8zwglzZKPTui60twGoQTNg3waSI+YXXKTJi057v32HFtWuWiHVJFOMToU3og+B DRz/8/5jpmfaVDNIR2NO3AEXSxaju0zfkcRvZZW+l7ksTrDla2q7Ld4AnUwPnQVlxQtR QYiI39A89VNOYxAypYRBquYEcxAc+XRmFkX8CKBKCZxB3mmnqymxnCaqwCrwiIALzhBW IQuTs0WvLVTBXFljxF7q87FdsQoyJy4SNYkqZTIWeM/ML0wK5ZAOAKkRyjN7o/rPcf7v vnOg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=gu03/SCtVVcBDsZ2+gj/YtwCxilJE8tJksxSSr0pLio=; fh=zqjk5lTytP1Chrjys+i5te7q1XedfGdkkTcfh0giSKY=; b=dpaKaJL4hI3Bm8eFDo5u87/Blh7VCwrYwDELEZH0TTbSpr+2xZUc62ftV/9sHy//6G 0anLz8AA8/XWHV9jCwrfQJY2H7MzfVN6AT4IKXEJD8m2wkhK8/ThFoDraOAHKosWJrJ3 8SKz7ithT2q+46GCoQiq3xJcw7FbLE7Ahm7pefUTYjXfndF/nM2t+1W7CCn6F4F50gSV CdUMV+BND6oXIHOR2PFsrU/mPcESskHj4VA+DXd0AKou90xi4eM2VMkLPtuCWIE4SZpT L1gneLrtjAYTCL3SmPDf9pTVcLmAuX9m2jDcm0eluEI3m/v7BTP6ohuER+V5HkTW/b7c YkXQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=NWpaJocU; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id n25-20020aa7db59000000b0051da5fd4a05si2745844edt.607.2023.07.11.12.51.18; Tue, 11 Jul 2023 12:51:42 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=NWpaJocU; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230213AbjGKSsb (ORCPT + 99 others); Tue, 11 Jul 2023 14:48:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43566 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229509AbjGKSsa (ORCPT ); Tue, 11 Jul 2023 14:48:30 -0400 Received: from mail-ot1-x330.google.com (mail-ot1-x330.google.com [IPv6:2607:f8b0:4864:20::330]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4A1591BB; Tue, 11 Jul 2023 11:48:29 -0700 (PDT) Received: by mail-ot1-x330.google.com with SMTP id 46e09a7af769-6b5d57d7db9so5044344a34.3; Tue, 11 Jul 2023 11:48:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1689101308; x=1691693308; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=gu03/SCtVVcBDsZ2+gj/YtwCxilJE8tJksxSSr0pLio=; b=NWpaJocUhmsi0NHcxdC+xRoeqhWS61QuWM7DapD7Tfi7ZDS6ZuhkIMvrW1x/Xopa55 rNkvuKfd7qQS01YnHgf4aWCgSefp5oZcMLnmlXiISonBProKGxgzQitPQYdkJpz/XYWi eahI5jb0+VY7/pMwLJNoGp41rX1rzwKjbDfVCyTM7HJ0mBHha3G5uTcVRE5QhRm54UKb hOH4tbXhP6PvOEYLjUdKYkC4fUfsUj/KdjJ8m+eyOLrjbAn766IGD7Sztn38atZ/jiF/ rCCGougGYodzqMYhRSuCVQozWM8vAN+voXpmNlGItaqgwPdPcjE0Jj15SnvzdG0KEmjp mAxQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689101308; x=1691693308; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=gu03/SCtVVcBDsZ2+gj/YtwCxilJE8tJksxSSr0pLio=; b=L8sXGjw387R0PVrKjdMQNUAPRvq3R5MFjkz7I/6JhF8SpJi3SaT8ruzITNW8sD7bDV 4+BcBEWw0J9jca7mTHLVISRrdaTVW8RfEcKHwAmik5tE0NxAtxjh10ibzZIhd9TX/4Yv 4HzYocBPDCCOSx2CzlRbtiL6wnbDVxteK0iOtCMRBnfV1Wfvbpw5TAHiccYeNHfxfJR+ hNc0lG3RRgFw3nEHBB0R6dxsx+6159KjFoRGs26237xxh9PJGndSbXjcGS2c9N+CcfXT pxiDJkAeT0keCavXr5iZTqivlWErLwawHMeQP1cI6UtHc9c82YMuh2kN+ccn9qSli7sU 8urg== X-Gm-Message-State: ABy/qLa3PNpB50tPaAKY3zCCFvYVptu0I73g4Ncdq/yYp5zq7RtHFTAV S0chGIg4Mt3N8On/o5hegzU= X-Received: by 2002:a05:6358:7f05:b0:135:57d0:d170 with SMTP id p5-20020a0563587f0500b0013557d0d170mr6811803rwn.11.1689101307873; Tue, 11 Jul 2023 11:48:27 -0700 (PDT) Received: from j293.lan ([2400:4051:ea3:5910:5676:1078:8b85:c18f]) by smtp.gmail.com with ESMTPSA id l6-20020a637006000000b0055b07fcb6ddsm1937688pgc.72.2023.07.11.11.48.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 11 Jul 2023 11:48:27 -0700 (PDT) Date: Wed, 12 Jul 2023 03:48:22 +0900 From: Kazuki Hashimoto To: Peter Zijlstra Cc: Daniel Lezcano , Ingo Molnar , Len Brown , Pavel Machek , Hector Martin , Kazuki Hashimoto , "Rafael J. Wysocki" , "Rafael J. Wysocki" , linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 1/2] cpuidle: Don't pass any values to cpuidle_not_available Message-ID: References: <20230711-cpuidle-v1-0-f391224b3140@gmail.com> <20230711-cpuidle-v1-1-f391224b3140@gmail.com> <20230711074231.GD3062772@hirez.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230711074231.GD3062772@hirez.programming.kicks-ass.net> X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org on oue, Jul 11, 2023 at 09:42:31AM +0200, Peter Zijlstra wrote: > On Tue, Jul 11, 2023 at 02:54:21PM +0900, Kazuki Hashimoto wrote: > > There's no reason to pass any values to cpuidle_not_available() as the > > function works standalone. Since we're planning to use the function in > > other places, make it so to avoid code duplication. > > > > Signed-off-by: Kazuki Hashimoto > > --- > > drivers/cpuidle/cpuidle.c | 6 ++++-- > > include/linux/cpuidle.h | 6 ++---- > > kernel/sched/idle.c | 2 +- > > 3 files changed, 7 insertions(+), 7 deletions(-) > > > > diff --git a/drivers/cpuidle/cpuidle.c b/drivers/cpuidle/cpuidle.c > > index 737a026ef58a..c9ba51e0fa38 100644 > > --- a/drivers/cpuidle/cpuidle.c > > +++ b/drivers/cpuidle/cpuidle.c > > @@ -49,9 +49,11 @@ void disable_cpuidle(void) > > off = 1; > > } > > > > -bool cpuidle_not_available(struct cpuidle_driver *drv, > > - struct cpuidle_device *dev) > > +bool cpuidle_not_available(void) > > { > > + struct cpuidle_device *dev = cpuidle_get_device(); > > + struct cpuidle_driver *drv = cpuidle_get_cpu_driver(dev); > > + > > return off || !initialized || !drv || !dev || !dev->enabled; > > } > > It appears to me these are a lot of conditions to check *every* time we > go idle -- especially since they hardly, if ever, change. > > Can't cpuidle track all this in a single global variable, preferably as > a static_key ? I don't think so? I'll drop this one though since it adds unnecesary overhead. Thanks, Kazuki