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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7E14BC54E58 for ; Wed, 20 Mar 2024 08:18:36 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id C95EC6B0083; Wed, 20 Mar 2024 04:18:35 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id C47006B0085; Wed, 20 Mar 2024 04:18:35 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B0EE96B0088; Wed, 20 Mar 2024 04:18:35 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id 9D5CF6B0083 for ; Wed, 20 Mar 2024 04:18:35 -0400 (EDT) Received: from smtpin15.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 28F44A19F3 for ; Wed, 20 Mar 2024 08:18:35 +0000 (UTC) X-FDA: 81916715790.15.DC8F64B Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by imf26.hostedemail.com (Postfix) with ESMTP id 5A67C140009 for ; Wed, 20 Mar 2024 08:18:33 +0000 (UTC) Authentication-Results: imf26.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=BrpXJlfA; spf=pass (imf26.hostedemail.com: domain of bhe@redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=bhe@redhat.com; dmarc=pass (policy=none) header.from=redhat.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1710922713; h=from:from:sender: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: in-reply-to:in-reply-to:references:references:dkim-signature; bh=AMprTuECjX7S7TpqECbNTRgVRVbEeCClI2ScghSpeE0=; b=i8fMQJ7qofeQNq76izzhdbaedTGAGmE2yBeGaqeTAzs/ueznRk4fdDBlpWBSzMDfrQ4wEP /A9vvWtdl0zfGciMCDkhC/8MBgx87ec0XYBw/C+G5lXvYTP6dTvVn7cp0u+pxwysRviAVo eQuP3dhHYr16N7obb2PslpFiclizPjA= ARC-Authentication-Results: i=1; imf26.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=BrpXJlfA; spf=pass (imf26.hostedemail.com: domain of bhe@redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=bhe@redhat.com; dmarc=pass (policy=none) header.from=redhat.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1710922713; a=rsa-sha256; cv=none; b=pYWjb8GGM/0FK85QcXdVz7sVZG8eBkcK4eI7OJaBntzeoLdQdlmHe60EfHI/XG7umW6xM2 daXKP0VXSGHiT3BpaOWjeBsl+d/Vph1xUgLVvL4mjN+Z7Bs1Jd0zUGZz1x2N5LNhsaO096 CrCT7wYTJ3NbmWMwQmF6dlCUJO1rlPM= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1710922712; 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: in-reply-to:in-reply-to:references:references; bh=AMprTuECjX7S7TpqECbNTRgVRVbEeCClI2ScghSpeE0=; b=BrpXJlfA5m4YScIJsLc/L3E1LbIYON2vn5VXHNOK2L0b+GQg6OUpIMU1PAhhbnzpoCTd2k N1JIU7GxjGMy3ttATGordGiMj8H2WJcLULwO/Vni2bPkkh/ppbLSR2YnkFT9aTgR9TCgcL jhkuZwE7dD7sg/pKK9Q5Ina6cnh5NAY= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-265-6nQMCBe0MAyN1QsEiAmDgg-1; Wed, 20 Mar 2024 04:18:26 -0400 X-MC-Unique: 6nQMCBe0MAyN1QsEiAmDgg-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 72B90800267; Wed, 20 Mar 2024 08:18:26 +0000 (UTC) Received: from localhost (unknown [10.72.116.12]) by smtp.corp.redhat.com (Postfix) with ESMTPS id ADB97C1576F; Wed, 20 Mar 2024 08:18:25 +0000 (UTC) Date: Wed, 20 Mar 2024 16:18:18 +0800 From: Baoquan He To: Mike Rapoport Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, x86@kernel.org, linuxppc-dev@lists.ozlabs.org, akpm@linux-foundation.org Subject: Re: [PATCH 4/6] mm/mm_init.c: remove meaningless calculation of zone->managed_pages in free_area_init_core() Message-ID: References: <20240318142138.783350-1-bhe@redhat.com> <20240318142138.783350-5-bhe@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.8 X-Rspamd-Queue-Id: 5A67C140009 X-Rspam-User: X-Stat-Signature: qi819e8ayctxcpwh1h9q98j345qnys5j X-Rspamd-Server: rspam01 X-HE-Tag: 1710922713-839327 X-HE-Meta: U2FsdGVkX19msR6Mm4g3pgFgrJN8VNeM9WtF+CnVEDZXVPzGwljlG6bhit4TUjdl+vjBufUJgA+K+V9WC5V6OZU4yKTNwv6ETJMMNBSfHh4xauSYimPVxDXO+QEr7NH4vfoRdo/O600L9r5RwZK4FWmvkJ3ZsBTL+s8f42pt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osity: 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: List-Subscribe: List-Unsubscribe: On 03/19/24 at 06:17pm, Mike Rapoport wrote: > On Mon, Mar 18, 2024 at 10:21:36PM +0800, Baoquan He wrote: > > Currently, in free_area_init_core(), when initialize zone's field, a > > rough value is set to zone->managed_pages. That value is calculated by > > (zone->present_pages - memmap_pages). > > > > In the meantime, add the value to nr_all_pages and nr_kernel_pages which > > represent all free pages of system (only low memory or including HIGHMEM > > memory separately). Both of them are gonna be used in > > alloc_large_system_hash(). > > > > However, the rough calculation and setting of zone->managed_pages is > > meaningless because > > a) memmap pages are allocated on units of node in sparse_init() or > > alloc_node_mem_map(pgdat); The simple (zone->present_pages - > > memmap_pages) is too rough to make sense for zone; > > b) the set zone->managed_pages will be zeroed out and reset with > > acutal value in mem_init() via memblock_free_all(). Before the > > resetting, no buddy allocation request is issued. > > > > Here, remove the meaningless and complicated calculation of > > (zone->present_pages - memmap_pages), directly set zone->present_pages to > > zone->managed_pages. It will be adjusted in mem_init(). > > Do you mean "set zone->managed_pages to zone->present_pages"? Hmm, maybe 'set zone->managed_pages as zone->present_pages' or 'assign zone->present_pages to zone->managed_pages' which is more precise. Wwill update. > > I think we can just set zone->managed_pages to 0 in free_area_init_core(). > Anyway it will be reset before the first use. Yeah, setting to 0 is also fine. I thougt of 0 ever. Considering zone->present_pages is closer value to actual zone->managed_pages than 0, and it may be needed in the future in some way before mem_init(). If no strong objection, I will keep the assigning 'zone->present_pages' to 'zone->managed_pages'. Thanks again for careful reviewing.