From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.6 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C1A1DC433DB for ; Fri, 5 Feb 2021 13:04:01 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 3B16864FC2 for ; Fri, 5 Feb 2021 13:04:01 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3B16864FC2 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=suse.cz Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 7E7F76B0005; Fri, 5 Feb 2021 08:04:00 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 799246B006C; Fri, 5 Feb 2021 08:04:00 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 6AE716B006E; Fri, 5 Feb 2021 08:04:00 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0204.hostedemail.com [216.40.44.204]) by kanga.kvack.org (Postfix) with ESMTP id 5538A6B0005 for ; Fri, 5 Feb 2021 08:04:00 -0500 (EST) Received: from smtpin03.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 1C5133629 for ; Fri, 5 Feb 2021 13:04:00 +0000 (UTC) X-FDA: 77784231840.03.fish72_1310d9a275e5 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin03.hostedemail.com (Postfix) with ESMTP id EB5CE28A4E9 for ; Fri, 5 Feb 2021 13:03:59 +0000 (UTC) X-HE-Tag: fish72_1310d9a275e5 X-Filterd-Recvd-Size: 3049 Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) by imf03.hostedemail.com (Postfix) with ESMTP for ; Fri, 5 Feb 2021 13:03:59 +0000 (UTC) X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 0FCAEACD4; Fri, 5 Feb 2021 13:03:58 +0000 (UTC) Subject: Re: [PATCH] mm/slub: embed __slab_alloc to its caller To: Abel Wu , Christoph Lameter Cc: Pekka Enberg , David Rientjes , Joonsoo Kim , Andrew Morton , hewenliang4@huawei.com, wuyun.wu@huawei.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org References: <20210202080515.2689-1-abel.w@icloud.com> <9A811B32-6E3D-4FE1-98A5-A7922C32CDB4@icloud.com> From: Vlastimil Babka Message-ID: <30743bfa-fbbb-c091-3b6e-dc24975fc6c3@suse.cz> Date: Fri, 5 Feb 2021 14:03:57 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.7.0 MIME-Version: 1.0 In-Reply-To: <9A811B32-6E3D-4FE1-98A5-A7922C32CDB4@icloud.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On 2/3/21 2:41 AM, Abel Wu wrote: >> On Feb 2, 2021, at 6:11 PM, Christoph Lameter wrote: >> >> On Tue, 2 Feb 2021, Abel Wu wrote: >> >>> Since slab_alloc_node() is the only caller of __slab_alloc(), embed >>> __slab_alloc() to its caller to save function call overhead. This >>> will also expand the caller's code block size a bit, but hackbench >>> tests on both host and guest didn't show a difference w/ or w/o >>> this patch. >> >> slab_alloc_node is an always_inline function. It is intentional that only >> the fast path was inlined and not the slow path. > > Oh I got it. Thanks for your excellent explanation. BTW, there's a script in the Linux source to nicely see the effect of such changes: ./scripts/bloat-o-meter slub.o.before mm/slub.o add/remove: 0/1 grow/shrink: 9/0 up/down: 1660/-1130 (530) Function old new delta __slab_alloc 127 1130 +1003 __kmalloc_track_caller 877 965 +88 __kmalloc 878 966 +88 kmem_cache_alloc 778 862 +84 __kmalloc_node_track_caller 996 1080 +84 kmem_cache_alloc_node_trace 813 896 +83 kmem_cache_alloc_node 800 881 +81 kmem_cache_alloc_trace 786 862 +76 __kmalloc_node 998 1071 +73 ___slab_alloc 1130 - -1130 Total: Before=57782, After=58312, chg +0.92% And yeah, bloating all the entry points wouldn't be nice. Thanks, Vlastimil