From patchwork Tue Feb 28 15:34:38 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexey Dobriyan X-Patchwork-Id: 62539 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp3091465wrd; Tue, 28 Feb 2023 07:48:06 -0800 (PST) X-Google-Smtp-Source: AK7set+/Vp6RVxQSaG7YdLhSjfiOnGSTdVepLM0GOGxXjZbqfAl127cbqQ8Axce+YAGSFikJDpK3 X-Received: by 2002:aa7:d290:0:b0:4ac:b32e:b6f with SMTP id w16-20020aa7d290000000b004acb32e0b6fmr3566985edq.23.1677599286039; Tue, 28 Feb 2023 07:48:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1677599286; cv=none; d=google.com; s=arc-20160816; b=AM4DJ00QNfB5p344BKmZBDBfUrS7H78G1BMVbaGN6i6uCaL3OTaCwTNQB5sbfwXrKS e7bvrYnpM8Rf0VMOy+/eI04eD6QULF7ljHBmXpF8F7mZG6ZrB2uv997FUiuI36ygj4P4 pQwSN1QJL9u0OEZTlhlTfYSbt3gaTc+RqIwiJr4gLRoziP/XI7jRLpNqMu6x2P4iqT+c SordISo7ywGdGTSzNWS4oeYOtxtyxWjD+CIAGlQkLfSEF2/RN156x32co1np2FUfPbKd MYNdOr6TgtTmYcnthyqE2azfTvughNaG71dY8cjayyDrHUE4FcnTQtgFxZYBJh0PvIf9 30iA== 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=VovafcFJLMznSEhxqQIdAu3aaQwbT+Bc2OZyFm12W78=; b=maGq0Vu8//JKqfdDbnIeaQBcIP2/LCrYOGIPc/9csGZk1tyBn2Cp0pRMALfIXaW8ge 6H6RlTXao5JQohsF4TnUoCR06Cy77Th6k3pmtE1u7lO0qhHWkXQQWSbIc1bHke5OAxdO sFZ/JueV8uUlk2AvBsSefzJDljeysZPjkhAIF6oSDFYF+zywtku2bVGQ4+h/WWPkR9bT MzVXWDT/X9XTtTvXZDWbRBBJKkuKkprFJAQ3/wtZF1bLPvyPI6LR7edJ8wMAhNQ9EGiT oAkaLhy99Lq2WpGBj9VJmWKG8H+vUAgjhc/1/N5nvaqVt2Xp2t28z/u9TcrRpr9Z2bYi S/DA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=WZ+G9Fgv; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y2-20020aa7ccc2000000b004acc76c1cf4si711296edt.563.2023.02.28.07.47.43; Tue, 28 Feb 2023 07:48:06 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=WZ+G9Fgv; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S229965AbjB1PfL (ORCPT + 99 others); Tue, 28 Feb 2023 10:35:11 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56754 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230156AbjB1PfE (ORCPT ); Tue, 28 Feb 2023 10:35:04 -0500 Received: from mail-wm1-x333.google.com (mail-wm1-x333.google.com [IPv6:2a00:1450:4864:20::333]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 40849B1 for ; Tue, 28 Feb 2023 07:34:42 -0800 (PST) Received: by mail-wm1-x333.google.com with SMTP id m25-20020a7bcb99000000b003e7842b75f2so6123738wmi.3 for ; Tue, 28 Feb 2023 07:34:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-disposition:mime-version:message-id:subject:cc:to:from:date :from:to:cc:subject:date:message-id:reply-to; bh=VovafcFJLMznSEhxqQIdAu3aaQwbT+Bc2OZyFm12W78=; b=WZ+G9FgvRzOs0BBt44O6rLhuByH3MhNVRxr4YKxR/8amo0bAYoqG0ykytWpccXhw60 e+9StVOtX7C25Y1g66RS3VdT+xYkJUBnayPR2wie5UIbSih6EYUr+3o1mdjVtD1erb4H saXAvuAk+ophZ4vU76/KAMEEftnGncUPTJyrP5zLOH7/x9N5VLybGCxLnKRhpXdNV5JF YONBsBp0uu9fT7nB/muYvkMOljnTo0krwIHdH8LEnRwAsDA+hOgxVlg/+gPKYj7VcwEN RchaU14LiIRsx81ttLTf01674djXvLvqo/4JYKDsotYsgV2YXDLmHUxpNzenDJjqeSct yQ5g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-disposition:mime-version:message-id:subject:cc:to:from:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=VovafcFJLMznSEhxqQIdAu3aaQwbT+Bc2OZyFm12W78=; b=HpXzMP7gVq+157uXIcwVhsSZIeVDrwHHVaUof+KXEnOWd4yR/7efrRcxPYfZjVHuXP NOxGaoraJ/wtlYvb6eHpdWCgYmmBl8Na1QT/77zHsWt+qY8tTfXgxbOa78TRb8RIjHKG ofJlefhvw++UQOEpU0qs6j9gXjgbN01Ev1TdhRb+wPGjKUvFSAruSGncEIUKDp0l3KUy 6xUMZcdyqPlbZIbQoQGbwqnYpjuOWImoK6V2LcYyBgKtjLxhnkBm74822wM+iXdrnrOj 3HmWMBoifJdO8QLwMmZSeYW/lKBWeTODM5EMpZ+PG2nSxTwzm3IhiM/vbQdZb7E1KWa0 7yyQ== X-Gm-Message-State: AO0yUKUlc56t+JF/7DWwHc6rnD1KgyjQNxUnafk5qUU1x1YxHa7w9i1X 7WHMXlWvQ6sfJOuHjMmc6FttYy46dw== X-Received: by 2002:a05:600c:cc5:b0:3eb:2de9:8af1 with SMTP id fk5-20020a05600c0cc500b003eb2de98af1mr2576923wmb.32.1677598480689; Tue, 28 Feb 2023 07:34:40 -0800 (PST) Received: from p183 ([46.53.249.64]) by smtp.gmail.com with ESMTPSA id iv16-20020a05600c549000b003e0238d9101sm14586218wmb.31.2023.02.28.07.34.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 Feb 2023 07:34:40 -0800 (PST) Date: Tue, 28 Feb 2023 18:34:38 +0300 From: Alexey Dobriyan To: akpm@linux-foundation.org Cc: linux-kernel@vger.kernel.org Subject: [PATCH] mm: uninline kstrdup() Message-ID: MIME-Version: 1.0 Content-Disposition: inline X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1759090349179656866?= X-GMAIL-MSGID: =?utf-8?q?1759090349179656866?= gcc inlines kstrdup into kstrdup_const() but it can very efficiently tail call into it instead: $ ./scripts/bloat-o-meter ../vmlinux-000 ../obj/vmlinux add/remove: 0/0 grow/shrink: 0/1 up/down: 0/-84 (-84) Function old new delta kstrdup_const 119 35 -84 Signed-off-by: Alexey Dobriyan --- mm/util.c | 1 + 1 file changed, 1 insertion(+) --- a/mm/util.c +++ b/mm/util.c @@ -49,6 +49,7 @@ EXPORT_SYMBOL(kfree_const); * * Return: newly allocated copy of @s or %NULL in case of error */ +noinline char *kstrdup(const char *s, gfp_t gfp) { size_t len;