Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp817928pxj; Fri, 11 Jun 2021 12:18:57 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx2aWf2R58sYCRg4Udi5ic4wDyvTfKTr2kO/vT/ETDQS00FyrKyUDVIr3dfMR0o/x66gRp1 X-Received: by 2002:aa7:cb19:: with SMTP id s25mr5342042edt.194.1623439136860; Fri, 11 Jun 2021 12:18:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623439136; cv=none; d=google.com; s=arc-20160816; b=pkVdmE/RU6QbVVoTpKpgkZHLImPpiOEvepM/wsIMYaVdnGCIOZIOJEmszr+IQPrahR 43fjsJKWJDprVjIbAJs1K/bSQ4OnC5i43YpCUUDStRJWfho/zrcIszPj2vnqYMdTbbmO WICgvc/Dv9pY9hs5H6CmVJ9rW03ODjRT68YX8JKdQ+iUlj+7xyCGppI8K46clXJhy41D k0pf7po/OTteWE8eiXpzokWoTkMEU7kvR0nZK+EH2eruAAZE1aueZ7dh31NwYjHd+V2q MAK2ApOA2VTEe+V2AiNNfVjmmPPg/HEL4gaFzrQlP2Cw+texzxZD9zx+A3a1nDfIP7Cw O1BQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-disposition:mime-version:message-id :subject:cc:to:from:date:dkim-signature; bh=ZtDjxi16fCK+vtg0oWwTQHBYR+QgijKvH/kCVk+EgJg=; b=xaHTX7IBbmGJgm6p3iNoRlSeKjpvfVRYWKVMjaJAscb1aLWE1liiazgblXzFELzxEH RICbRyZqe+NOvfjZkzz8tlZmiqskfWLhj6evORuiyF32tn5hW3ykik4wibFPGssi7s1K GuAPaWfdqJ1GEoo+sNe9tIkb+aqAU0IGu1Q2s+3fdl9ElZAlvKxwfusyV1unQ1xy4bqD rnLmFRCTWQk2HVXrWCTLdfQv49qzYeaLhdon/v0lJzWa1J4Q9LYN9MKmSS/uwozma5/O GNUD6DsR58jMX36kF1HuYu51aEXQbzlR438Gt3S5FYBcYRUrwSUsfDmxUiq7WfVHG03z 0GNA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=C3+wvn1Z; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id cn25si5171938edb.530.2021.06.11.12.18.34; Fri, 11 Jun 2021 12:18:56 -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=pass header.i=@gmail.com header.s=20161025 header.b=C3+wvn1Z; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231222AbhFKTTk (ORCPT + 99 others); Fri, 11 Jun 2021 15:19:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33884 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229824AbhFKTTg (ORCPT ); Fri, 11 Jun 2021 15:19:36 -0400 Received: from mail-wr1-x431.google.com (mail-wr1-x431.google.com [IPv6:2a00:1450:4864:20::431]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3CA0DC061574 for ; Fri, 11 Jun 2021 12:17:38 -0700 (PDT) Received: by mail-wr1-x431.google.com with SMTP id c5so7129124wrq.9 for ; Fri, 11 Jun 2021 12:17:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:mime-version:content-disposition; bh=ZtDjxi16fCK+vtg0oWwTQHBYR+QgijKvH/kCVk+EgJg=; b=C3+wvn1ZvKh/y0tljlQAWqIhsCZzbsNwnKk3z0zofPUSrWFJZ975bfG0RvX+xs0lOA Oa5287YpTsJC+m/4Ys4dWlu+iEZL0bJ8zXI2fRHys15+5XHEvY2MO4hmXRFuJqlEncn5 9fCMohpLgwSwa7+2c0cjlngC3VbFIu2n1qmXVtTzfBh+Nr/RYLO9KxxSBJI2FYVfztTk VeK/ybFApjrW0RZVE6DQ2C+zMMViMAY7qazwoMdc1Wm9zsIJrZpOUe0/gvvMWnj4oaCC TyVbSL2eJ5wihC2uaKwr6mwY3R75qW75hWxGvb+Y780BzWkpZ/VRGzPOVqepCiUjcQMm eNvA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:mime-version :content-disposition; bh=ZtDjxi16fCK+vtg0oWwTQHBYR+QgijKvH/kCVk+EgJg=; b=QyDqfghf/oP/czCaTduxZ3JzLZ1Z2RJBLQgcxSPGNGXth7WbihVujOHb01dcaj4w5z SDj+Ymas9Bne3YQ5JGXd7Og0eBEgTxCD4YRGGlJ3W/oISuQRjsjXz23S1lL4Uu6eunC+ NQ+6KckgSLajoj8dArHfdMUD9bVyhGIDI8h4uXi0Mj1j/UtlXOpf57BGB0OHl+TJa2aV oMbsb3moBasH7XdkIVWylTYlgkqlPYo7aH1VUR+1qCMqcHRPvc0GEe2TeKW+XAnuDFHZ s8Vtj3mWC0wwKfxy4rqN6TST+4WhPKXNxSoIF0WGk0LMXPj2NF26jZTR/OUdNQq7eS2D 6/Gw== X-Gm-Message-State: AOAM5309ZP0g/9KElxGKdujCWxE/hwgcVPP6BktpeopqDP0npWYir8pW H3vlNAJ3VbBcy/510clARw== X-Received: by 2002:a05:6000:1b8f:: with SMTP id r15mr5589927wru.119.1623439056889; Fri, 11 Jun 2021 12:17:36 -0700 (PDT) Received: from localhost.localdomain ([46.53.253.180]) by smtp.gmail.com with ESMTPSA id u7sm9505232wrt.18.2021.06.11.12.17.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 11 Jun 2021 12:17:36 -0700 (PDT) Date: Fri, 11 Jun 2021 22:17:34 +0300 From: Alexey Dobriyan To: akpm@linux-foundation.org Cc: linux-kernel@vger.kernel.org Subject: [PATCH] lib: uninline simple_strtoull() Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Gcc inlines simple_strtoull() too agressively. Given that all 4 signatures match, everything very efficiently calls or tailcalls into simple_strtoull(): ffffffff81da0240 : ffffffff81da0240: 80 3f 2d cmp BYTE PTR [rdi],0x2d ffffffff81da0243: 74 05 je ffffffff81da024a ffffffff81da0245: e9 76 ff ff ff jmp simple_strtoull ffffffff81da024a: 48 83 c7 01 add rdi,0x1 ffffffff81da024e: e8 6d ff ff ff call simple_strtoull ffffffff81da0253: 48 f7 d8 neg rax ffffffff81da0256: c3 ret Space savings (on F34-ish .config) add/remove: 0/0 grow/shrink: 1/3 up/down: 52/-313 (-261) Function old new delta vsscanf 2167 2219 +52 simple_strtoul 72 2 -70 simple_strtoll 143 23 -120 simple_strtol 143 20 -123 Signed-off-by: Alexey Dobriyan --- lib/vsprintf.c | 1 + 1 file changed, 1 insertion(+) --- a/lib/vsprintf.c +++ b/lib/vsprintf.c @@ -61,6 +61,7 @@ * * This function has caveats. Please use kstrtoull instead. */ +noinline unsigned long long simple_strtoull(const char *cp, char **endp, unsigned int base) { unsigned long long result;