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 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 37A83C433F5 for ; Wed, 13 Oct 2021 08:45:27 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id C18B661027 for ; Wed, 13 Oct 2021 08:45:26 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org C18B661027 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvack.org Received: by kanga.kvack.org (Postfix) id 4C01094000B; Wed, 13 Oct 2021 04:45:26 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 4705D940007; Wed, 13 Oct 2021 04:45:26 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 3383C94000B; Wed, 13 Oct 2021 04:45:26 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0027.hostedemail.com [216.40.44.27]) by kanga.kvack.org (Postfix) with ESMTP id 21E96940007 for ; Wed, 13 Oct 2021 04:45:26 -0400 (EDT) Received: from smtpin09.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id C25178249980 for ; Wed, 13 Oct 2021 08:45:25 +0000 (UTC) X-FDA: 78690780210.09.ACDE536 Received: from so254-9.mailgun.net (so254-9.mailgun.net [198.61.254.9]) by imf09.hostedemail.com (Postfix) with ESMTP id 9197A3000108 for ; Wed, 13 Oct 2021 08:45:22 +0000 (UTC) DKIM-Signature: a=rsa-sha256; v=1; c=relaxed/relaxed; d=mg.codeaurora.org; q=dns/txt; s=smtp; t=1634114725; h=Content-Transfer-Encoding: Content-Type: In-Reply-To: MIME-Version: Date: Message-ID: From: References: Cc: To: Subject: Sender; bh=l6omNya1/EkI04DuKbuDKH4HzjeEIZgIwC7p3ibuEy4=; b=MYvOwmAnk6B0HpVd+CPcZmdojm3Q1m+XViZX7exKXjTXF4CBkOXi0/hD1gll5IEsLNjoO3io iYpghQqicM/kWRzxHLkCtFnM1u72Lc+wPc5bwpv2tAfIqt2RK06kf+fKqKnRTNkDh8r7YY1H pgbfupAqVUbCBStQLrXpKpR8hbo= X-Mailgun-Sending-Ip: 198.61.254.9 X-Mailgun-Sid: WyIwY2Q3OCIsICJsaW51eC1tbUBrdmFjay5vcmciLCAiYmU5ZTRhIl0= Received: from smtp.codeaurora.org (ec2-35-166-182-171.us-west-2.compute.amazonaws.com [35.166.182.171]) by smtp-out-n04.prod.us-east-1.postgun.com with SMTP id 61669c9bab9da96e6430b8d4 (version=TLS1.2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256); Wed, 13 Oct 2021 08:45:15 GMT Received: by smtp.codeaurora.org (Postfix, from userid 1001) id 1D227C43460; Wed, 13 Oct 2021 08:45:15 +0000 (UTC) Received: from [192.168.0.109] (unknown [49.204.183.203]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: faiyazm) by smtp.codeaurora.org (Postfix) with ESMTPSA id 68031C4338F; Wed, 13 Oct 2021 08:45:12 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 smtp.codeaurora.org 68031C4338F Subject: Re: [PATCH v2] mm: page_alloc: Add debug log in free_reserved_area for static memory To: David Hildenbrand , Faiyaz Mohammed , akpm@linux-foundation.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org Cc: guptap@codeaurora.org References: <1633936279-26856-1-git-send-email-quic_faiyazm@codeaurora.org> <7027fa91-296f-01cb-6c5d-d25c81c835d5@redhat.com> From: Faiyaz Mohammed Message-ID: <0504c1eb-7c46-7def-5d08-8f7aa027784a@codeaurora.org> Date: Wed, 13 Oct 2021 14:15:09 +0530 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.13.0 MIME-Version: 1.0 In-Reply-To: <7027fa91-296f-01cb-6c5d-d25c81c835d5@redhat.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US X-Rspamd-Server: rspam02 X-Rspamd-Queue-Id: 9197A3000108 X-Stat-Signature: uqf3smbqsznwohy7r49e3sy1ji5xxuaf Authentication-Results: imf09.hostedemail.com; dkim=pass header.d=mg.codeaurora.org header.s=smtp header.b=MYvOwmAn; spf=pass (imf09.hostedemail.com: domain of "bounce+d06763.be9e4a-linux-mm=kvack.org@mg.codeaurora.org" designates 198.61.254.9 as permitted sender) smtp.mailfrom="bounce+d06763.be9e4a-linux-mm=kvack.org@mg.codeaurora.org"; dmarc=none X-HE-Tag: 1634114722-50300 Content-Transfer-Encoding: quoted-printable 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 10/11/2021 2:04 PM, David Hildenbrand wrote: > On 11.10.21 09:11, Faiyaz Mohammed wrote: >> From: Faiyaz Mohammed >> >> For INITRD and initmem memory is reserved through "memblock_reserve" >> during boot up but it is free via "free_reserved_area" instead >> of "memblock_free". >> For example: >> [=C2=A0=C2=A0=C2=A0 0.294848] Freeing initrd memory: 12K. >> [=C2=A0=C2=A0=C2=A0 0.696688] Freeing unused kernel memory: 4096K. >> >> To get the start and end address of the above freed memory and to acco= unt >> proper memblock added pr_debug log in "free_reserved_area". >> After adding log: >> [=C2=A0=C2=A0=C2=A0 0.294837] 0x00000083600000-0x00000083603000 >> free_initrd_mem+0x20/0x28 >> [=C2=A0=C2=A0=C2=A0 0.294848] Freeing initrd memory: 12K. >> [=C2=A0=C2=A0=C2=A0 0.695246] 0x00000081600000-0x00000081a00000 free_i= nitmem+0x70/0xc8 >> [=C2=A0=C2=A0=C2=A0 0.696688] Freeing unused kernel memory: 4096K. >> >> Signed-off-by: Faiyaz Mohammed >> --- >> changes in v2: >> =C2=A0=C2=A0=C2=A0=C2=A0- To avoid confusion, remove the memblock_dbg = print and drop the >> =C2=A0=C2=A0=C2=A0=C2=A0memblock_free string, now using pr_debug to pr= int the address ranges. >> >> =C2=A0 mm/page_alloc.c | 5 +++++ >> =C2=A0 1 file changed, 5 insertions(+) >> >> diff --git a/mm/page_alloc.c b/mm/page_alloc.c >> index 668edb1..395df3f 100644 >> --- a/mm/page_alloc.c >> +++ b/mm/page_alloc.c >> @@ -8153,6 +8153,11 @@ unsigned long free_reserved_area(void *start, >> void *end, int poison, const char >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 if (pages && s) >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 pr_info("Freein= g %s memory: %ldK\n", s, K(pages)); >> =C2=A0 +#ifdef CONFIG_HAVE_MEMBLOCK >> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 pr_debug("%#016llx-%#016ll= x %pS\n", >> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 __= pa(start), __pa(end), (void *)_RET_IP_); >> +#endif >> + >=20 > Are we missing parentheses that the code indentation implies? > Further, I think we want to use "%pa" instead of "%llx" and > eventually drop the CONFIG_HAVE_MEMBLOCK dependency. Maybe >=20 > diff --git a/mm/page_alloc.c b/mm/page_alloc.c > index b37435c274cf..e7946e5ca094 100644 > --- a/mm/page_alloc.c > +++ b/mm/page_alloc.c > @@ -8097,6 +8097,8 @@ EXPORT_SYMBOL(adjust_managed_page_count); > =C2=A0 > =C2=A0unsigned long free_reserved_area(void *start, void *end, int pois= on, > const char *s) > =C2=A0{ > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 const phys_addr_t pstart =3D __pa= (start); > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 const phys_addr_t pend =3D __pa(e= nd); > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 void *pos; > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 unsigned long pages =3D 0; > =C2=A0 > @@ -8125,9 +8127,11 @@ unsigned long free_reserved_area(void *start, > void *end, int poison, const char > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0 free_reserved_page(page); > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 } > =C2=A0 > -=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 if (pages && s) > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 if (pages && s) { > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0 pr_info("Freeing %s memory: %ldK\n", > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 s, pag= es << (PAGE_SHIFT - 10)); > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0 pr_debug("[%pa-%pa] %pS\n", &pstart, &pend, (void > *)_RET_IP_); > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 } > =C2=A0 > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 return pages; > =C2=A0} > Sure, I will update it and push again. Thanks and regards, Mohammed Faiyaz