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=-10.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=unavailable 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 EA443C5517A for ; Wed, 11 Nov 2020 12:34:37 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 52FA821D91 for ; Wed, 11 Nov 2020 12:34:37 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=kernel.org header.i=@kernel.org header.b="tssUExkL" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 52FA821D91 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 747F56B0070; Wed, 11 Nov 2020 07:34:36 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 6F9606B0072; Wed, 11 Nov 2020 07:34:36 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 60EA46B0073; Wed, 11 Nov 2020 07:34:36 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0239.hostedemail.com [216.40.44.239]) by kanga.kvack.org (Postfix) with ESMTP id 3142D6B0070 for ; Wed, 11 Nov 2020 07:34:36 -0500 (EST) Received: from smtpin21.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id BBC67181AC9CC for ; Wed, 11 Nov 2020 12:34:35 +0000 (UTC) X-FDA: 77472080910.21.eye68_411107f272fd Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin21.hostedemail.com (Postfix) with ESMTP id A7DD4180442C4 for ; Wed, 11 Nov 2020 12:34:35 +0000 (UTC) X-HE-Tag: eye68_411107f272fd X-Filterd-Recvd-Size: 4724 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by imf27.hostedemail.com (Postfix) with ESMTP for ; Wed, 11 Nov 2020 12:34:34 +0000 (UTC) Received: from kernel.org (unknown [77.125.7.142]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 8BEF720709; Wed, 11 Nov 2020 12:34:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1605098073; bh=o/M6WEXmt76OOE/tPa/1Xpwg/Wl8F6ojt2WcLj6oOgE=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=tssUExkLB573eVE8MO+LIdpkpox8Aqlx2b7J8HVVD//eX5KIbT7Kaoj/jved2acFC RHg5IeWRW/kgff1qYiAy+zLp1IItpqveZeG2CUZVhxKGajRlQBPKio+86nkX1ZxyGA U+0t5RtcJW/yii8xeZcUT9LUcFt4ydi8f1YqbZ4Q= Date: Wed, 11 Nov 2020 14:34:28 +0200 From: Mike Rapoport To: Faiyaz Mohammed Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, vinmenon@codeaurora.org Subject: Re: [PATCH] mm: memblock: always inline memblock_alloc Message-ID: <20201111123428.GI4758@kernel.org> References: <1605010817-21065-1-git-send-email-faiyazm@codeaurora.org> <20201110184157.GD4758@kernel.org> <97ca3445-c405-cdc1-b9e6-6ed2386c9c57@codeaurora.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <97ca3445-c405-cdc1-b9e6-6ed2386c9c57@codeaurora.org> 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 Wed, Nov 11, 2020 at 03:15:11PM +0530, Faiyaz Mohammed wrote: > > On 11/11/2020 12:11 AM, Mike Rapoport wrote: > > Hi, > > > > On Tue, Nov 10, 2020 at 05:50:17PM +0530, Faiyaz Mohammed wrote: > > > Since memblock_alloc is not getting inlined, memblock_reserve owner info > > > is lost. Below information is not enough for memory accounting. > > > for example: > > > [ 0.000000] memblock_alloc_try_nid: 1490 bytes align=0x40 nid=-1 from=0x0000000000000000 max_addr=0x0000000000000000 memblock_alloc+0x20/0x2c > > > [ 0.000000] memblock_reserve: [0x000000023f09a3c0-0x000000023f09a991] memblock_alloc_range_nid+0xc0/0x188 > > > > > > Add "__always_inline" to make sure it get inlined and to get the exact > > > owner of the memblock_reserve. > > > After adding __always_inline: > > > [ 0.000000] memblock_alloc_try_nid: 1490 bytes align=0x40 nid=-1 from=0x0000000000000000 max_addr=0x0000000000000000 start_kernel+0xa4/0x568 > > > [ 0.000000] memblock_reserve: [0x000000023f09a3c0-0x000000023f09a991] memblock_alloc_range_nid+0xc0/0x188 > > I agree that making memblock_alloc() inline as well as other similar > > wrappers would improve the debugability. > > Still, it has nothing to do with memory accounting and owner tracking. > > Please update the patch description to better explain what it actually > > improves. > > As describe in other thread, do memblock reserved accounting to track owners > > to know size of memory allocated by different drivers/owners through > > memblock_reserve, which help in comparing different kernel version and in > > optimizations. > > > > > Signed-off-by: Faiyaz Mohammed > > > --- > > > include/linux/memblock.h | 2 +- > > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > > > diff --git a/include/linux/memblock.h b/include/linux/memblock.h > > > index ef13125..54f9544 100644 > > > --- a/include/linux/memblock.h > > > +++ b/include/linux/memblock.h > > > @@ -404,7 +404,7 @@ void *memblock_alloc_try_nid(phys_addr_t size, phys_addr_t align, > > > phys_addr_t min_addr, phys_addr_t max_addr, > > > int nid); > > > -static inline void * __init memblock_alloc(phys_addr_t size, phys_addr_t align) > > > +static __always_inline void * __init memblock_alloc(phys_addr_t size, phys_addr_t align) > > I think simply dropping __init here will make memblock_alloc() inline. > > There are also several more convenience wrappers marked __init, do you > > mind removing the __init annotation for them as well? > > Yes, if we drop __init, memblock_alloc will get inline but would it not > increase > kernel footprint as the function will no more be released after kernel init? If memblock_alloc(), or any other function for that matter, is inlined, it does not have an entry in the object file, but it is rather inserted at the call sites. The functions that use memblock_alloc() may change, but they all should be __init anyway so I won't expect increase in the kernel post-init memory footprint. > > > { > > > return memblock_alloc_try_nid(size, align, MEMBLOCK_LOW_LIMIT, > > > MEMBLOCK_ALLOC_ACCESSIBLE, NUMA_NO_NODE); -- Sincerely yours, Mike.