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 26B17C433F5 for ; Tue, 28 Sep 2021 11:16:44 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id C29E160ED7 for ; Tue, 28 Sep 2021 11:16:43 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org C29E160ED7 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvack.org Received: by kanga.kvack.org (Postfix) id 551B0900003; Tue, 28 Sep 2021 07:16:43 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 501BA900002; Tue, 28 Sep 2021 07:16:43 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 3C961900003; Tue, 28 Sep 2021 07:16:43 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0082.hostedemail.com [216.40.44.82]) by kanga.kvack.org (Postfix) with ESMTP id 2DC75900002 for ; Tue, 28 Sep 2021 07:16:43 -0400 (EDT) Received: from smtpin20.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id DEAFA181CC400 for ; Tue, 28 Sep 2021 11:16:42 +0000 (UTC) X-FDA: 78636729444.20.128E261 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by imf14.hostedemail.com (Postfix) with ESMTP id 93904600198D for ; Tue, 28 Sep 2021 11:16:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1632827802; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=g9Fw/+zsA3lSTpQmibIL0kcuxCZFnG650L+/dDhTSd0=; b=ZchqFIc+bpoVITiukVf7YizxlGt+PY4l7wuUguSQrN72OGMw7W3hglhvwqKua9Wh3rjmRH n5IisvnUjevzM7c5ysBB+R57WefaMcU3DLu1FiORqe2P+UWGchicTwCK1eyyhuW9Q7bh4K +OIrGFC64+D+k9B/F9SkhrwljNlQSB8= Received: from mail-wm1-f69.google.com (mail-wm1-f69.google.com [209.85.128.69]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-209-RI6NZFcXNxGwmE2k0WkIrg-1; Tue, 28 Sep 2021 07:16:41 -0400 X-MC-Unique: RI6NZFcXNxGwmE2k0WkIrg-1 Received: by mail-wm1-f69.google.com with SMTP id 200-20020a1c00d1000000b0030b3dce20e1so997189wma.0 for ; Tue, 28 Sep 2021 04:16:40 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:subject:to:cc:references:from:organization :message-id:date:user-agent:mime-version:in-reply-to :content-language:content-transfer-encoding; bh=g9Fw/+zsA3lSTpQmibIL0kcuxCZFnG650L+/dDhTSd0=; b=DS2z/JcEG0Nmn2exVuDoHlkTcdU38AQabA0v2BlIdWYoR9HCR4u+u2G3RVioZpofZC ftWY6gG3vXeKAX7icalHyNhTy+CN8hG6r7n+3xI9BjEZg5hMskrOhawCzgQ6iwS/hGWj cievYrzErd5cQjQlIVG6bs3xcsDoMMWgPJ64T+f2au033Ya4cSebb0dVsRscIH+esEb3 7f05Y7SwIRjx/Yne2lGDimSBugs3tLo+kmPMOIZESliOKzLGWgwW0VvKFscvAnd305++ 4qHIzsCwAl+N4H8SJR6+Z49PNinmHU2P1LMFYtRqPwJZfGpJXul45o+HztbWpObrjvLb DRXA== X-Gm-Message-State: AOAM533VxAk/i0AzSac3MrXxSTgBBYoyCQbzDTBDvJqjFCjIyS59Sc8I Bpv947VrFaesY+hqJGe77poOUUKrB6PfNXiSdeUDlCGs9G2I0scEkW29+ixzvV0L/yMdHIUaG0h ZkskXwBqTXaQ= X-Received: by 2002:a1c:7e10:: with SMTP id z16mr4045385wmc.141.1632827800006; Tue, 28 Sep 2021 04:16:40 -0700 (PDT) X-Google-Smtp-Source: ABdhPJypdRCaBXjp3Oo8Frl+bwCBde3/2kGEgoQygCIPajaTje2x49VvX1uag/OSEf1dohFvvrJGgA== X-Received: by 2002:a1c:7e10:: with SMTP id z16mr4045364wmc.141.1632827799748; Tue, 28 Sep 2021 04:16:39 -0700 (PDT) Received: from [192.168.3.132] (p4ff23aaf.dip0.t-ipconnect.de. [79.242.58.175]) by smtp.gmail.com with ESMTPSA id x5sm2991943wmk.32.2021.09.28.04.16.39 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 28 Sep 2021 04:16:39 -0700 (PDT) Subject: Re: [PATCH v1] mm: page_alloc: Add debug log in free_reserved_area for static memory To: Faiyaz Mohammed , akpm@linux-foundation.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org Cc: guptap@codeaurora.org References: <1632819849-511-1-git-send-email-faiyazm@codeaurora.org> <248ec931-7c16-3e2d-cc8f-8ce0dd4e923b@redhat.com> <0149edd5-fe7f-2786-413c-6de2eab3e30c@codeaurora.org> From: David Hildenbrand Organization: Red Hat Message-ID: Date: Tue, 28 Sep 2021 13:16:38 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0 MIME-Version: 1.0 In-Reply-To: <0149edd5-fe7f-2786-413c-6de2eab3e30c@codeaurora.org> X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US X-Rspamd-Server: rspam03 X-Rspamd-Queue-Id: 93904600198D X-Stat-Signature: 79edzgbgysk3sz7r4ix8xmbu5jyx87ji Authentication-Results: imf14.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=ZchqFIc+; dmarc=pass (policy=none) header.from=redhat.com; spf=none (imf14.hostedemail.com: domain of david@redhat.com has no SPF policy when checking 216.205.24.124) smtp.mailfrom=david@redhat.com X-HE-Tag: 1632827802-7348 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 28.09.21 12:53, Faiyaz Mohammed wrote: >=20 >=20 > On 9/28/2021 4:09 PM, David Hildenbrand wrote: >> On 28.09.21 11:04, Faiyaz Mohammed wrote: >>> 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 acc= ount >>> proper memblock added memblock_dbg log in "free_reserved_area". >>> After adding log: >>> [=C2=A0=C2=A0=C2=A0 0.294837] memblock_free: [0x00000083600000-0x0000= 0083603000] >>> 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] memblock_free: [0x00000081600000-0x0000= 0081a00000] >>> free_initmem+0x70/0xc8 >>> [=C2=A0=C2=A0=C2=A0 0.696688] Freeing unused kernel memory: 4096K. >>> >>> Signed-off-by: Faiyaz Mohammed >>> --- >>> =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 b37435c..f85c3b2 100644 >>> --- a/mm/page_alloc.c >>> +++ b/mm/page_alloc.c >>> @@ -8129,6 +8129,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 pr_info("Free= ing %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 s, pages << (PAGE_SHIFT - 10)); >>> =C2=A0 +#ifdef CONFIG_HAVE_MEMBLOCK >>> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 memblock_dbg("memblock_fr= ee: [%#016llx-%#016llx] %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 >> >> IMHO, the "memblock_free" part is misleading. Something was allocated >> early via memblock, then we transitioned to the buddy, now we're freei= ng >> that early allocation via the buddy. >> Yes, we're freeing the early allocation via buddy, but for proper > memblock accounting we need this debug print. >=20 What do you mean with "accounting" ? These are debug statements. --=20 Thanks, David / dhildenb