Received: by 2002:a05:7412:a9a2:b0:e2:908c:2ebd with SMTP id o34csp2598302rdh; Mon, 30 Oct 2023 01:59:42 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEhvEWWsh+NjnSpYd1EDH8vHLbw3kfZis8NGDsEzgDvDgUoyY8XqCdcqTBDetc6EuGHsvUr X-Received: by 2002:a17:90b:38ca:b0:280:1de0:8a86 with SMTP id nn10-20020a17090b38ca00b002801de08a86mr3835404pjb.20.1698656382294; Mon, 30 Oct 2023 01:59:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698656382; cv=none; d=google.com; s=arc-20160816; b=jbFUMRgtfrYW9QJmMgQVFcCbky7DNT3OesNTtgRoJyVNDwbYMVssLWUpoS/UbHRs+x RUKa5ZL9HBgja8K8lZXbEh0NmY4ez3oZK95erG1YWqrVfjaKAFzDED/D/OIWrSUIBhMV e4QylNxBb5xak30w4gBkms4+ll1VBbMHBTKWdQiQJrx64AUT02hvwkVobV4u6yV/lX5D EOT5SM9IeSqKpwaMOJultBJZLsW2rwE7eLLElBcMqXildARKsjfGZZ06hBgRj5O+S7dq uDhTz8fSM+l65MUN2EKLzQBUxnS8caoWDQT7EQcgsy/DtFY62c9MMNLBpf4Xm2pExjlf 8I+A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:organization:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=qR4kon3WLSOTZUjw+MzojC/IJM4Z9neu712TEjohDtc=; fh=qbsM95Do3tvvhraZ8hKXllC7xCDRKsylObx2gerM2Iw=; b=NtAILxJePdaIuvEOi3hsIG/uZqRSHerq7irdqx0P0Y7xWf1zP4pUvMZHKM0UjrA95C 3RaKle3fnQQggAJyGOgmSqSe5cbDpin3OXS3uaqMbdL4RUgcyBDTm1q+Ft+Q/NiP25Xq FYk23C+ntBx7fuAygWEXrdIIyuFqKhVVsDDXRSn4zA9FJkSnU7BuWwUsNfulYGL9tcx9 Vp6o2CPoKvjD9gmxVvS5eX4P6JkdBqesJey58jCjI+iabmQhgALjVkuP9iSvz92Vbg3i 9qZ5hIY8W6ifzJwy377DTbdrvEbA2kojPL75eYnImXfoyjpr5JGdnYRAPjGTYjaekazH QmwA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b="Wubh3Y/t"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from groat.vger.email (groat.vger.email. [23.128.96.35]) by mx.google.com with ESMTPS id gw3-20020a17090b0a4300b0026f4d1e6940si5906683pjb.160.2023.10.30.01.59.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Oct 2023 01:59:42 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) client-ip=23.128.96.35; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b="Wubh3Y/t"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id 084008087273; Mon, 30 Oct 2023 01:59:40 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232319AbjJ3I7c (ORCPT + 99 others); Mon, 30 Oct 2023 04:59:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51004 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231467AbjJ3I7b (ORCPT ); Mon, 30 Oct 2023 04:59:31 -0400 Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.43]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 656E594 for ; Mon, 30 Oct 2023 01:59:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1698656369; x=1730192369; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=R89fHrH0vTzIahQagBTYg9QO944K4Vt7HCsfbwzD2Tg=; b=Wubh3Y/tmjB5VWQh4CFiz+bpm0rL5xyjE6/sRkD+ApvkzP6n1jgXA64K BqrN36xm3CHKzWhmwvCvzDe8YB40iRJMX+w8GlQNyV3fZIBK1O+S1i3Ty BRskIgVhtzCmJ2xt+KjHcB9VMPTE98QuiqR/NQN68oaShEqGy7DIDkCke s6/aDruTxOlkeB1gui2yEi5zcibW9j6QZBmvcqOuUW/Xosoqi4MzGPini 0SdsDknd85u0TE6a5Mho35xbab564IxRbeJ+s0PLijMxBANqxhmxhqg0E Uas/wfYroHV/5ZhdjcnjtBvVpiiibkub64il0PVHBvMCsbdSGAeUvLxt5 Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10878"; a="474271553" X-IronPort-AV: E=Sophos;i="6.03,263,1694761200"; d="scan'208";a="474271553" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Oct 2023 01:59:28 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10878"; a="903925373" X-IronPort-AV: E=Sophos;i="6.03,263,1694761200"; d="scan'208";a="903925373" Received: from smile.fi.intel.com ([10.237.72.54]) by fmsmga001.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Oct 2023 01:59:27 -0700 Received: from andy by smile.fi.intel.com with local (Exim 4.97-RC3) (envelope-from ) id 1qxO7I-00000009mf1-1ZTG; Mon, 30 Oct 2023 10:59:24 +0200 Date: Mon, 30 Oct 2023 10:59:24 +0200 From: Andy Shevchenko To: Alexey Dobriyan Cc: Petr Mladek , Steven Rostedt , Rasmus Villemoes , Sergey Senozhatsky , linux-kernel@vger.kernel.org Subject: Re: [PATCH] vsprintf: uninline simple_strntoull(), reorder arguments Message-ID: References: <82a2af6e-9b6c-4a09-89d7-ca90cc1cdad1@p183> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <82a2af6e-9b6c-4a09-89d7-ca90cc1cdad1@p183> Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo X-Spam-Status: No, score=-1.2 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,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 groat.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 (groat.vger.email [0.0.0.0]); Mon, 30 Oct 2023 01:59:40 -0700 (PDT) On Fri, Oct 27, 2023 at 05:13:58PM +0300, Alexey Dobriyan wrote: > * uninline simple_strntoull(), > gcc overinlines and this function is not performance critical > > * reorder arguments, so that appending INT_MAX as 4th argument > generates very efficient tail call > > Space savings: > > add/remove: 1/0 grow/shrink: 0/3 up/down: 27/-179 (-152) > Function old new delta > simple_strntoll - 27 +27 > simple_strtoull 15 10 -5 > simple_strtoll 41 7 -34 > vsscanf 1930 1790 -140 Makes sense to me Reviewed-by: Andy Shevchenko ... > if (is_sign) > - val.s = simple_strntoll(str, > - field_width >= 0 ? field_width : INT_MAX, > - &next, base); > + val.s = simple_strntoll(str, &next, base, > + field_width >= 0 ? field_width : INT_MAX); > else > - val.u = simple_strntoull(str, > - field_width >= 0 ? field_width : INT_MAX, > - &next, base); > + val.u = simple_strntoull(str, &next, base, > + field_width >= 0 ? field_width : INT_MAX); Looking at these, why do we even care about signedness? field_witdh IIRC is 16-bit or less and if size_t is to big it's still fine. No? -- With Best Regards, Andy Shevchenko