Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp2407206pxb; Fri, 29 Oct 2021 00:18:15 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwa73rJGSYA5p9Ygs0WFakQyU8wkWXKe/gJNKt9xxg9tkcLufsehIxJy4OIYB1ESP9N5tSy X-Received: by 2002:a17:90b:4a92:: with SMTP id lp18mr9726962pjb.47.1635491895658; Fri, 29 Oct 2021 00:18:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1635491895; cv=none; d=google.com; s=arc-20160816; b=ylNTutSlytV7BSfcdrIUJ8NeWCp0Gjwv/pJq5H6podxKQpwpImASJGZjBecp9acvXZ nHPQUyIKXSNMIOOUlpGW0YAfOPlvnqezcGqE1iESZqJkIiHrA2NEUtxYxIsG++UXmB9v 47YsRD0nF5eKzpa2LAMua95TzV2PFLZYQNZndJxwsvEQqboYn75RqaSdUUwauDWTw/fo b04OPRd2slYfbPqJeyS0Qe7mYD5ngEnxVPc3QvU1Qju/nU1I39IdlMXGBuWbAIqsgvw/ yVgqocoAyLzeA1Sf1G1pAGlw3Paom6MNQlcOv7B7DjhV0jhc4tuim1RE7UxiLl6ywISW Kz0A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=ltK/AaXgedWdm6xOTGrQEX54FLBnUW89SZ4pMEIx1n0=; b=mvB/5nUC7MiY20NQ6+7JZm48qBIAYfecLExE45xFAVdCiagHTGLEdfkLFzS+pYcymY 1BAoTPNHFFYUfxCEIlwJLVnfX4HkNkPkdkwNBhttla/dnEsYoNaZ5lhtL/5VqSNWSyhA 2zxafUWR9kNb+uzjitY7qgn3Atx6pTJS31KoGeiT4xhynxmbqSMJaMFzNI1hrKglcCvl fc8MW1dBBRsFnXvrqcPXiGGWdAK1JYBz+3QNf7sGcvcfMMGTtEN3cJ7tBcea543cjd5V i67VZsHeqgv972+iMqAQ6BbCQchsWUrv9yJmGtHC4DURSc0kBiffIuqOQN4bg3WrzwV7 GMPQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@mess.org header.s=2020 header.b=hhFS2Yll; 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 ha2si5945838pjb.67.2021.10.29.00.17.20; Fri, 29 Oct 2021 00:18:15 -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; dkim=fail header.i=@mess.org header.s=2020 header.b=hhFS2Yll; 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 S232169AbhJ2HSl (ORCPT + 99 others); Fri, 29 Oct 2021 03:18:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59844 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229464AbhJ2HSk (ORCPT ); Fri, 29 Oct 2021 03:18:40 -0400 Received: from gofer.mess.org (gofer.mess.org [IPv6:2a02:8011:d000:212::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 491BBC061570; Fri, 29 Oct 2021 00:16:12 -0700 (PDT) Received: by gofer.mess.org (Postfix, from userid 1000) id 22D1FC638B; Fri, 29 Oct 2021 08:16:09 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=mess.org; s=2020; t=1635491769; bh=0hcZKmtu7PJUxwvXsC29IbArA/3wXyA66Belfuc1NNg=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=hhFS2YllEGHiULTrWdVSZs/+edGr3zfikpVgZA78QOionCLvVbbyUH9SZ+NuUpxct OHDkCIbhSuHpwPCTxNdQ62fPd7hkihjKEwNw0T24QhGvent4mQeV4H+EkYxdlP62z6 vuTi+h8tRa7d0Qt7kePoi1XewypPznPdBXw044YY8DiHa5rZY8cfOZcfI4HQ4lQQN5 RGC+S6XHEJMptEo8ae/Sl6dJAP47kP6z90+LRYluWojvtgJ4t6WqNR6nLq8mI/tGU8 mirHat8Iuo6rcZY8WfSPLpn1cpw388ArGpRexMBqSsdDKl9nUZ1zdXSfD8A31lETkB f8ygS7HEPoIFA== Date: Fri, 29 Oct 2021 08:16:08 +0100 From: Sean Young To: Uwe =?iso-8859-1?Q?Kleine-K=F6nig?= Cc: =?iso-8859-1?Q?Ma=EDra?= 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: <20211029071608.GA28997@gofer.mess.org> References: <20211028064513.guziv6uaivzlk6ki@pengutronix.de> <20211028091442.GA16514@gofer.mess.org> <20211028111535.x7xgz7domx2lpyfh@pengutronix.de> <20211028122610.GA18767@gofer.mess.org> <20211028180516.t2tpfbzztm7s6cqm@pengutronix.de> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20211028180516.t2tpfbzztm7s6cqm@pengutronix.de> User-Agent: Mutt/1.10.1 (2018-07-13) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Oct 28, 2021 at 08:05:16PM +0200, Uwe Kleine-K?nig wrote: > On Thu, Oct 28, 2021 at 01:26:10PM +0100, Sean Young wrote: > > > bloat-o-meter reports (for an arm allmodconfig build) > > > > > > 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=2302, After=2550, chg +10.77% > > > > So 248 bytes more after your changes. > > ack. This is because the compiler inlines the division which accounts > for > 100 bytes. I'm surprised it's that large. This is on 32 bit? > > > struct pwm_ir increases from 12 bytes to 40 bytes. > > > > > > The stack space required by pwm_ir_tx decreases from 60 to 36 > > > > > > I don't know exactly how kmalloc works internally. Maybe allocating a > > > structure of size 40 bytes doesn't need more memory than a structure of > > > size 12? > > > > > > I didn't check how runtimes change, but the size decrease of pwm_ir_tx() > > > is nice and might save a bit of runtime. > > > > I'm not following, how is this decreasing runtime? > > 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. The two most common programs for sending IR are 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 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: setting the carrier and duty cycle is a cheap operation, and it is device property which can be overriden by another process. 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. Thanks for prototyping this. Sean