From patchwork Mon Mar 25 15:04:56 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Baoquan He X-Patchwork-Id: 13602386 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 026DFC54E58 for ; Mon, 25 Mar 2024 15:05:28 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 45B346B009C; Mon, 25 Mar 2024 11:05:26 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 2FB446B009F; Mon, 25 Mar 2024 11:05:26 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 0B2126B009D; Mon, 25 Mar 2024 11:05:26 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id D48D46B009B for ; Mon, 25 Mar 2024 11:05:25 -0400 (EDT) Received: from smtpin01.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 5F2D7808CC for ; Mon, 25 Mar 2024 15:05:25 +0000 (UTC) X-FDA: 81935885010.01.D53C810 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by imf13.hostedemail.com (Postfix) with ESMTP id 6069D20029 for ; Mon, 25 Mar 2024 15:05:23 +0000 (UTC) Authentication-Results: imf13.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=dhMA8tJX; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf13.hostedemail.com: domain of bhe@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=bhe@redhat.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1711379123; 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:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=MVO6euUmFTCPCHk6L2/T00GcEz6lDO4YO+24ug8h660=; b=jMBqDAQe+Sgb1U7MC03nxG9XJNC+WV9lXYra835VY5bsvOMtQvtRSFeAPjI+SgSv7ZEufB ftI+QdyC8uVGVboqOqC3dHd2CLd6bsc/ZTeG/sAPNRDKKChAAYceYc4UH3QfCxQv/Pz9wA N9FOuk/YIU37GR9pU0745caYTLlwF+A= ARC-Authentication-Results: i=1; imf13.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=dhMA8tJX; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf13.hostedemail.com: domain of bhe@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=bhe@redhat.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1711379123; a=rsa-sha256; cv=none; b=rhGqVUCmJ8xOSJDcY7gLCTVckoav5rZTm09M1tGPqTZtOessrdg9SbzybxqsohO+bRLHGu zYzbU4ijtdzSB2Ezz7nRGFYRA9cqs241ZTJaumuTFgW7DWpA7RlSDRabCitMD8qBzA4rqj miwhQw5eXv3nrKNiLD0NO9KBB/F9IJE= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1711379122; 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=MVO6euUmFTCPCHk6L2/T00GcEz6lDO4YO+24ug8h660=; b=dhMA8tJXW4hmpM/4jaVS1k3BJU8swEPGtU1/B/ZEA+d9ZTVfBVtlpU1hTKPPF9Wza0hliI nh1KxaFFn+u9/F+ATqwgtNiep92Uy8xAFMQ99M8tg2HEQP+TmZfJE2n/JMZQu4vtFyKz2A xN4XhmyZxZeMdxlDV7GLYugfPinGdDs= 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-586-S5cVOsf1NnSk-zSGtEMnPw-1; Mon, 25 Mar 2024 11:05:20 -0400 X-MC-Unique: S5cVOsf1NnSk-zSGtEMnPw-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 78CBE811E81; Mon, 25 Mar 2024 15:05:20 +0000 (UTC) Received: from MiWiFi-R3L-srv.redhat.com (unknown [10.72.116.12]) by smtp.corp.redhat.com (Postfix) with ESMTP id 43CA5C04121; Mon, 25 Mar 2024 15:05:17 +0000 (UTC) From: Baoquan He To: linux-mm@kvack.org Cc: akpm@linux-foundation.org, rppt@kernel.org, mgorman@suse.de, Baoquan He Subject: [PATCH 4/7] mm/mm_init.c: remove unneeded calc_memmap_size() Date: Mon, 25 Mar 2024 23:04:56 +0800 Message-ID: <20240325150459.1045407-5-bhe@redhat.com> In-Reply-To: <20240325150459.1045407-1-bhe@redhat.com> References: <20240325150459.1045407-1-bhe@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.8 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-type: text/plain X-Rspamd-Server: rspam09 X-Rspamd-Queue-Id: 6069D20029 X-Stat-Signature: f7ocdwu35c58r6m3of1e6bkeaagzu4fp X-Rspam-User: X-HE-Tag: 1711379123-24610 X-HE-Meta: U2FsdGVkX19AGYyMq5b+cH3uhB+ImpvEMF6nfC5IDUOhb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79vweO91l6Da6yIw8OAAhgLttlMDGRziprCQhPtCyugqNsqYBHGBwk0rFhGupaS/Pl0Q2+d5UCjDYfW+0QzfG1wQ== 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: List-Subscribe: List-Unsubscribe: Nobody calls calc_memmap_size() now. Signed-off-by: Baoquan He --- mm/mm_init.c | 20 -------------------- 1 file changed, 20 deletions(-) diff --git a/mm/mm_init.c b/mm/mm_init.c index 7f71e56e83f3..e269a724f70e 100644 --- a/mm/mm_init.c +++ b/mm/mm_init.c @@ -1331,26 +1331,6 @@ static void __init calculate_node_totalpages(struct pglist_data *pgdat, pr_debug("On node %d totalpages: %lu\n", pgdat->node_id, realtotalpages); } -static unsigned long __init calc_memmap_size(unsigned long spanned_pages, - unsigned long present_pages) -{ - unsigned long pages = spanned_pages; - - /* - * Provide a more accurate estimation if there are holes within - * the zone and SPARSEMEM is in use. If there are holes within the - * zone, each populated memory region may cost us one or two extra - * memmap pages due to alignment because memmap pages for each - * populated regions may not be naturally aligned on page boundary. - * So the (present_pages >> 4) heuristic is a tradeoff for that. - */ - if (spanned_pages > present_pages + (present_pages >> 4) && - IS_ENABLED(CONFIG_SPARSEMEM)) - pages = present_pages; - - return PAGE_ALIGN(pages * sizeof(struct page)) >> PAGE_SHIFT; -} - #ifdef CONFIG_TRANSPARENT_HUGEPAGE static void pgdat_init_split_queue(struct pglist_data *pgdat) {