Received: by 2002:a05:7412:2a8c:b0:e2:908c:2ebd with SMTP id u12csp2688888rdh; Wed, 27 Sep 2023 09:41:33 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHAhM1TFW/NO5kfHgsHYKRXBwaWjNWWDkOV+jvGUeatby37tMP6fl9yEpNjW76nhC2vJlGZ X-Received: by 2002:a17:903:22c9:b0:1c3:7628:fcb3 with SMTP id y9-20020a17090322c900b001c37628fcb3mr2291878plg.47.1695832893276; Wed, 27 Sep 2023 09:41:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695832893; cv=none; d=google.com; s=arc-20160816; b=Pz6eebpWgaOpnq7EARh2+Vbv7V5LRD1n9hdC+S6iGHLTzRRmStsXo30XHM4Tb7oNxz HFh3D9o0vbcCw3u8xt9SapYKHYr5NuA+8O1nH2dHwrKExabhyMiVDaUD05j6UMPzOoNR KrgOpo4cFfAkfQBFiXnYt4CJWkUSHgqbAOY4pIBdoNna8NqeCwf6dj2/hwyuP4fGt7y0 lACkU+yb10pfKoNdxejE9y8pVeY8Rxr96X1qB1jQKJ50TvWyNGPhpe6rr+T0zn/Ce/Wb dC0FdXr+ZXis5hoD+wOF9qKHRyvZCLVtJekfw/I23LSE26R14WQ3SZN9rhnRahYS4LOi WD0A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version; bh=n+/WRWic8+xuG9WD7ymeai9h6OO2Vg4lqlTkjmPEAwQ=; fh=+2JxztEu7bN4hj58I/W/Di3Tmm589BaaoQWR/Ob+TLo=; b=K5pwUJVlx5vss1tawaI6HtOHP8XBLLYKQPgxB1voCngQFdneE+2WVkK0HbOsyeRkXK qFgmYfhYywNmq04z1CNe6QoIURrE8zlViKK5wm0ErsfdCZ28HMgd3NUbHqgEnfXqVSk+ ruu0HYxHG7TdpTiqo0eeitVtdL18l/0LASM9+Zo03VvbeyOZ3KTA0g2luK8KMPkBrtwF bFTyEwGhPRQDbEaqg98Jg7W834KDlXrP5jvYdmQVvHqp+AwiK0mMtM9+h0tOrTB4WdaR e3oAspVbtJxMjEuhqJe4wJtqY7Zjr+SsZlYwrPF78O1dXgOpFSJ1j94HhH3IHvKDUeOn EqTw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from lipwig.vger.email (lipwig.vger.email. [2620:137:e000::3:3]) by mx.google.com with ESMTPS id j10-20020a170902da8a00b001b9be39eaa8si17165492plx.348.2023.09.27.09.41.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Sep 2023 09:41:33 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) client-ip=2620:137:e000::3:3; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id EA2DE821579A; Wed, 27 Sep 2023 08:28:16 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232467AbjI0P2G convert rfc822-to-8bit (ORCPT + 99 others); Wed, 27 Sep 2023 11:28:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42902 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232429AbjI0P2F (ORCPT ); Wed, 27 Sep 2023 11:28:05 -0400 Received: from mail-oo1-f51.google.com (mail-oo1-f51.google.com [209.85.161.51]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7E505180; Wed, 27 Sep 2023 08:28:04 -0700 (PDT) Received: by mail-oo1-f51.google.com with SMTP id 006d021491bc7-57b68555467so864268eaf.0; Wed, 27 Sep 2023 08:28:04 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695828484; x=1696433284; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=GrJ+LVorbFBvQ25l422kAsahBWNHUUbzw/OsuBiPPcI=; b=DpnztN081es8uFyzNAZxFKc4eslq+E2tgRNYc546DehO93GSqGMH98Ml6vmVPNmow/ InGv7s6gwNI360JcfBs+kZKZD6qNuGgGocK3veFQLhzNTizv5JLQnSJVZuk2D4MQQ5vy C6z/M4tBf7lCW5K/d6AwuTiyP9QneTXFWisKKhrTY0sC3OdyxpVn3O+fkZfEwqbqT7Ka y+CiEBUh71Z+DSrtp/JpsKLedq5tUxcPabEHdzBjyVwd6CwRdbr6w5ai+6vtkcFoVvjw it4WGvkbeRFpxEt8gFUnDlwwa5Wwm2UY+e6ziaZxL0I39Sw6tGfUvTXEU0KD6rwUif7Y jMYA== X-Gm-Message-State: AOJu0YySl6GenFN4twSO6h8xjRc/woBphgvuiqS+Ca9BbNT31t6mUSR9 WfL5ZTEPulg6HEU3LpXjw3OAgvl5trxSrLlB4RI= X-Received: by 2002:a4a:e687:0:b0:57b:3b64:7ea5 with SMTP id u7-20020a4ae687000000b0057b3b647ea5mr2619493oot.1.1695828483804; Wed, 27 Sep 2023 08:28:03 -0700 (PDT) MIME-Version: 1.0 References: <1957441.PYKUYFuaPT@kreacher> <2590280.Lt9SDvczpP@kreacher> <9f1374db-f866-ff52-e86c-99fecee24d1b@linaro.org> In-Reply-To: <9f1374db-f866-ff52-e86c-99fecee24d1b@linaro.org> From: "Rafael J. Wysocki" Date: Wed, 27 Sep 2023 17:27:52 +0200 Message-ID: Subject: Re: [PATCH v1 07/13] thermal: gov_power_allocator: Use trip pointers instead of trip indices To: Daniel Lezcano Cc: "Rafael J. Wysocki" , Linux PM , LKML , Linux ACPI , Srinivas Pandruvada , Zhang Rui , Lukasz Luba , "Rafael J. Wysocki" Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8BIT X-Spam-Status: No, score=-1.0 required=5.0 tests=MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (lipwig.vger.email [0.0.0.0]); Wed, 27 Sep 2023 08:28:17 -0700 (PDT) On Wed, Sep 27, 2023 at 5:10 PM Daniel Lezcano wrote: > > On 21/09/2023 19:55, Rafael J. Wysocki wrote: > > From: Rafael J. Wysocki > > > > Eliminate the __thermal_zone_get_trip() usage that adds unnecessary > > overhead (due to pointless bounds checking and copying of trip point > > data) from the power allocator thermal governor and generally make it > > use trip pointers instead of trip indices where applicable. > > Actually the __thermal_zone_get_trip() change was done on purpose to > replace the 'throttle' callback index parameter by the trip pointer and > removing those call to __thermal_zone_get_trip() while the code was > using the trip pointer. > > IMO, the changes should focus on changing the trip_index parameter by > the trip pointer directly in the throttle ops. So you would like .throttle() to take a trip pointer argument instead of an index? The difficulty here is that the user space governor needs to expose the index to user space anyway, so it would need to find it if it gets a trip pointer instead. Not a big deal I suppose, but a bit of extra overhead. Also it is easier to switch the governors over to using trip pointers internally and then change the .throttle() argument on top of that. > The pointer can be > retrieved in the handle_thermal_trip() function and passed around for > the rest of the actions on this trip point Right, except for the user space governor which needs a trip index. And the indices are used for tracing too.