Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp2564594pxb; Fri, 29 Oct 2021 04:08:13 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwjBxgwgYpdXRvj4MMecV65owIAiBUS7MiHmVvjc/+QHgu6lfbVD6bwdkAdJLaPVtoCPn2n X-Received: by 2002:a63:2c15:: with SMTP id s21mr7796756pgs.189.1635505693564; Fri, 29 Oct 2021 04:08:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1635505693; cv=none; d=google.com; s=arc-20160816; b=xWs9W8/gmgQthLhJaZsV+WUb/TZDltMzE0b53m4xe5LwYZadg4aDaEcUog3hRVHstd IufPu8zcM38V9hk3EMC76AOeYAnqrsDPG9JEgGyq8QOqoeKqBFthJzCMtQpVL4EbpL0n i8vjG6hbh0WfjcYCeZYFu074Sgv72J5UmYoJlrvieJeXE759FGYQsmZbHnDfkq3y03Hz dISCve2PcOr87BBHKBEEZqch3HyFRCwWBok3LajliMEIWezCirOUCTE0iXCQYwG24/MD KdmknC5o8b15GrEO+V1bPF7xa97uaiA9nS+bpb2K5cmTE1zWNnmsYnSx1weURx1iIpwY avnw== 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; bh=6BcBuEzgciX7bkhzWGAOxEGnT04zQUgfoqDKzTnnLAw=; b=Ts7In7yxVF9YToXrw7i6c79q7wK52div55Oz6MIrosjqjHT5+G022x0DsSar6qELs4 aViBY8Cbpn3N4d2s84Ac4owemhJf0e3UmKNnNaVD1oD3O1zVhCB3318oFHDmTyDAChhS EL8Tac4nCTetAKfbe9m50wutzM8sbUwL2tXx5VVAn6ifRdfTvPSDYX3R1T0d5UnTcavc mHZNcptpRQDNa/JB8gQC16m7+z6yDUKlQLH7LUiU2ZUphm7tq/sHrHiHcdUsHBS+JKnI 1HWV8B3ImMsPF1GWK/+J8UTnTEJpc4l6bKcvD9YtyCRlxMB0uNpU0XO4v2vuqG5VBhpH sNvg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id x18si910264plg.340.2021.10.29.04.07.35; Fri, 29 Oct 2021 04:08:13 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231869AbhJ2LJG (ORCPT + 99 others); Fri, 29 Oct 2021 07:09:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55266 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231826AbhJ2LJF (ORCPT ); Fri, 29 Oct 2021 07:09:05 -0400 Received: from metis.ext.pengutronix.de (metis.ext.pengutronix.de [IPv6:2001:67c:670:201:290:27ff:fe1d:cc33]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0CE70C061714 for ; Fri, 29 Oct 2021 04:06:37 -0700 (PDT) Received: from drehscheibe.grey.stw.pengutronix.de ([2a0a:edc0:0:c01:1d::a2]) by metis.ext.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mgPiK-0001mx-Nh; Fri, 29 Oct 2021 13:06:24 +0200 Received: from [2a0a:edc0:0:900:1d::77] (helo=ptz.office.stw.pengutronix.de) by drehscheibe.grey.stw.pengutronix.de with esmtp (Exim 4.92) (envelope-from ) id 1mgPiH-0005QG-KK; Fri, 29 Oct 2021 13:06:21 +0200 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.92) (envelope-from ) id 1mgPiH-0002TX-J4; Fri, 29 Oct 2021 13:06:21 +0200 Date: Fri, 29 Oct 2021 13:06:02 +0200 From: Uwe =?utf-8?Q?Kleine-K=C3=B6nig?= To: Sean Young Cc: =?utf-8?B?TWHDrXJh?= Canal , lkp@intel.com, mchehab@kernel.org, thierry.reding@gmail.com, lee.jones@linaro.org, llvm@lists.linux.dev, kbuild-all@lists.01.org, linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, linux-pwm@vger.kernel.org Subject: Re: [PATCH v4] media: rc: pwm-ir-tx: Switch to atomic PWM API Message-ID: <20211029110602.uugnbm5vtfpghiwh@pengutronix.de> References: <20211028064513.guziv6uaivzlk6ki@pengutronix.de> <20211028091442.GA16514@gofer.mess.org> <20211028111535.x7xgz7domx2lpyfh@pengutronix.de> <20211028122610.GA18767@gofer.mess.org> <20211028180516.t2tpfbzztm7s6cqm@pengutronix.de> <20211029071608.GA28997@gofer.mess.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="azgvopiwgpdhztkw" Content-Disposition: inline In-Reply-To: <20211029071608.GA28997@gofer.mess.org> X-SA-Exim-Connect-IP: 2a0a:edc0:0:c01:1d::a2 X-SA-Exim-Mail-From: ukl@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-kernel@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --azgvopiwgpdhztkw Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Oct 29, 2021 at 08:16:08AM +0100, Sean Young wrote: > On Thu, Oct 28, 2021 at 08:05:16PM +0200, Uwe Kleine-K=F6nig wrote: > > On Thu, Oct 28, 2021 at 01:26:10PM +0100, Sean Young wrote: > > > > bloat-o-meter reports (for an arm allmodconfig build) > > > >=20 > > > > add/remove: 0/0 grow/shrink: 3/1 up/down: 644/-396 (248) > > > > Function old new delta > > > > pwm_ir_probe 372 676 +304 > > > > pwm_ir_set_carrier 108 292 +184 > > > > pwm_ir_set_duty_cycle 68 224 +156 > > > > pwm_ir_tx 908 512 -396 > > > > Total: Before=3D2302, After=3D2550, chg +10.77% > > >=20 > > > So 248 bytes more after your changes. > >=20 > > ack. This is because the compiler inlines the division which accounts > > for > 100 bytes. >=20 > I'm surprised it's that large. This is on 32 bit? Yes, it's a 64 bit division on 32 bit ARM. > > > > struct pwm_ir increases from 12 bytes to 40 bytes. > > > >=20 > > > > The stack space required by pwm_ir_tx decreases from 60 to 36 > > > >=20 > > > > I don't know exactly how kmalloc works internally. Maybe allocating= a > > > > structure of size 40 bytes doesn't need more memory than a structur= e of > > > > size 12? > > > >=20 > > > > I didn't check how runtimes change, but the size decrease of pwm_ir= _tx() > > > > is nice and might save a bit of runtime. > > >=20 > > > I'm not following, how is this decreasing runtime?=20 > >=20 > > With my changes pwm_ir_tx got smaller and { pwm_ir_probe, > > pwm_ir_set_carrier, pwm_ir_set_duty_cycle } got bigger. Now if for a > > typical runtime pattern pwm_ir_probe and pwm_ir_set_carrier run once and > > pwm_ir_set_duty_cycle 100 times and pwm_ir_tx 1000 times (no idea if > > that is realistic) it might be a net win in sum. >=20 > The two most common programs for sending IR are >=20 > ir-ctl: https://git.linuxtv.org/v4l-utils.git/tree/utils/ir-ctl/ir-ctl.c#= n1041 > lircd: https://sourceforge.net/p/lirc/git/ci/master/tree/lib/transmit.c >=20 > For each transmission, the carrier is set. If the duty cyle is specified, > then that is set too. Then the transmit itself is done. Both of them > set the carrier and duty cycle (if required) for every transmission: sett= ing > the carrier and duty cycle is a cheap operation, and it is device property > which can be overriden by another process.=20 >=20 > This means with your changes, if the carrier and duty cycle are both set > for each transmission, then we're doing more work. If only the carrier > is set for each transmission, then there is no net gain/loss (I think), > but the code size has increased. OK, then I discard my patch. While reading that I wondered if it makes sense to have a callback that sets both carrier and duty cycle and then remove the other two. Best regards Uwe --=20 Pengutronix e.K. | Uwe Kleine-K=F6nig | Industrial Linux Solutions | https://www.pengutronix.de/ | --azgvopiwgpdhztkw Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAABCgAdFiEEfnIqFpAYrP8+dKQLwfwUeK3K7AkFAmF71ZIACgkQwfwUeK3K 7Am79wf/SqQB9cLC/swxCjRZ+kXJ+3z7js+zIjZQHScbxNaycBfosNwROYJ/U5IJ ArOIy5R7/y6PzPwE+iPEIYXA/o7tz/wamOogZWcT8ZxJVC/UlSkcx5Sh7z0xAkbC ISbuy4VtDhOp0+BL8g4VasCYf1yYs8SFdzcKw76FgYM4/Qmr8VRuukYL21SbHfWV O+W3G/MZE5NLV79x33fsPNkfvYiJav2xF1IYKde4dyJGG3HKd5uS3OGo8xU6rhpR WUfLjldheUvP4ZVO0HcGPJTHia1K8bFB1qfwkYDuetBhpICHk+mbpWP92OfBvtJo 2/en1tqciILjZz/+eRRRa9kTnehVWg== =3f91 -----END PGP SIGNATURE----- --azgvopiwgpdhztkw--