From patchwork Mon Mar 18 14:21:33 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Baoquan He X-Patchwork-Id: 13595399 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 D170DC54E58 for ; Mon, 18 Mar 2024 14:21:57 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 3F9A26B0087; Mon, 18 Mar 2024 10:21:57 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 3AAD96B0088; Mon, 18 Mar 2024 10:21:57 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 24A926B0089; Mon, 18 Mar 2024 10:21:57 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 10E4F6B0087 for ; Mon, 18 Mar 2024 10:21:57 -0400 (EDT) Received: from smtpin03.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id E06011A0EFE for ; Mon, 18 Mar 2024 14:21:56 +0000 (UTC) X-FDA: 81910373832.03.5AD071C Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by imf24.hostedemail.com (Postfix) with ESMTP id 3643D18002D for ; Mon, 18 Mar 2024 14:21:54 +0000 (UTC) Authentication-Results: imf24.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=jNEgGlwe; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf24.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=1710771715; 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=XJOj3+4C3poxnpNPxWTMxrcMSQ1iTdDLFjOZc5Aa/AQ=; b=dwzkDmUXFvdEEjZ2efRMQRJD8DbGo3IYh834ytG4lc77OcUFyLj7qHQFcwkMIDE3LJxKqc cDIK1a4zWC5QUhsjp2cii3Q4prIqT5XL+59oRQuOzKVaOuLRXLw9Pz8OhOIqmEXl9Cz2rk CY3sYEzTTzn1X+pV3hctuelWAEBgFIY= ARC-Authentication-Results: i=1; imf24.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=jNEgGlwe; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf24.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=1710771715; a=rsa-sha256; cv=none; b=QsKrMMS+7Z+czW+FJ0urTg5mlTvX38xSa4nX7L3/4Xdk1VFFpWM1iQc1NyhzHmiVUeUZpt wMB6m9ar14FgHP+irXxJa0HLQDbsKJo0AYW1UG0vOPW0CVOwERHZA3v/sVb73BAOiRl0rX 3CB4Y+VWKC98OauxuL4aS5FXY7rxeok= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1710771714; 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=XJOj3+4C3poxnpNPxWTMxrcMSQ1iTdDLFjOZc5Aa/AQ=; b=jNEgGlwemU3T2M1tk2uTLou5n8uloB6LrPKJwIbOEOZr3/L47HwN7z8BifNCQoSSys8tb+ PTIEIt2BatxQ/ZnvI/F6I2s4p3U/lm9CDRZM19HIskIbzeczVV9pomH1FVN8mbPOrZdTLH 3M2psUregHUESQzeAYb+BaZSqb2x0Hs= Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-534-jIm9PpjXNxK1eCnTJrVipA-1; Mon, 18 Mar 2024 10:21:53 -0400 X-MC-Unique: jIm9PpjXNxK1eCnTJrVipA-1 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (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 8B2A8380009C; Mon, 18 Mar 2024 14:21:52 +0000 (UTC) Received: from MiWiFi-R3L-srv.redhat.com (unknown [10.72.116.12]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9F74A492BD1; Mon, 18 Mar 2024 14:21:49 +0000 (UTC) From: Baoquan He To: linux-mm@kvack.org Cc: linux-kernel@vger.kernel.org, x86@kernel.org, linuxppc-dev@lists.ozlabs.org, akpm@linux-foundation.org, rppt@kernel.org, Baoquan He Subject: [PATCH 1/6] mm/mm_init.c: remove the useless dma_reserve Date: Mon, 18 Mar 2024 22:21:33 +0800 Message-ID: <20240318142138.783350-2-bhe@redhat.com> In-Reply-To: <20240318142138.783350-1-bhe@redhat.com> References: <20240318142138.783350-1-bhe@redhat.com> MIME-Version: 1.0 Content-type: text/plain X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.10 X-Rspam-User: X-Rspamd-Server: rspam12 X-Rspamd-Queue-Id: 3643D18002D X-Stat-Signature: nhhtbp5wchkbceeyhga4jqqq61wj7gnn X-HE-Tag: 1710771714-3416 X-HE-Meta: U2FsdGVkX1/DPrs0rMMX0hXJRgJYHH7ZodNLaNemRsXxnatuH1c3J1Y6spJQ7aBQTmVWTQCqai+Oit5izrlnr8vGeCmAQD6PTwuadk0vEWxAVsyPUOVxudaEVa8OMStQbdHTpy43xLf9nyemaYXqThm2gZMS9yYMpt9LvaPwzgZmO2Em0kwoRYkv+UOJuG4JzZZcpiHzXAm6mhcJ0T2BYdts09/XtHNMCxCSK32DYLlpbQxeK8RMt4Vqg/Bc07FcepMWw1klkBlHsXUH+NP2Mvh5AKYJkbWFEODd1nXwloLmglrdc5RAQn/slY/bF18TYqn1T3+BgTT6RLiHNqIA9g2+d2H3C1AMQQCFCWykLAko4rcProyYfaUoUwc1rdMPBwDvulMvgvkNmTHqm4/I5wmMded/1n/TAaeZCWjq11axV18CVVOFPH3ExPaDVe3w/QS0cRY+ezACv6s9xEE21bcVpdpgNAwlTsLmf+mB44UegHlXk8sSIDmi633wuQO8AMXc4XV/RalVpXUECFtKGDybeG7977UE3B+chJyVBzUgvboBSKhzS3LQaXH6SAy9R/7Qbq5cBDH4qAR7N1z2RSzf6Havb6EZoJjShIjNHqsvBc9+cCafCLZ0WDlED+IKmPko3lZQiuayAkNYlopdn0L4yakVHTJSlohGhvf/kLdhBzU6842m4rPSaxyaiMZa1WJjIzefgeAp8X4FteBdzJ6kQzZW686i+vDp7b8txjfjHOf5ulowtqz1oVznqsl/86oeV9YlxWFtemrhAny+KjE1nlkb1LP+qFueAcSAb6bV+sE+sD5U8uXoxUs2/zY2M0CzVraZimHHTXsHWXjwj8xfDshGD4x1/ISJKOoZGQGOEbLwlVBpqQXHsbTueWGfg63Y+JaOktgFBG1z75xJqhcsjB7DKSJ5WzcTzGTYL7ZGYY5ocCkqKJA/2qF2UTpn 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: Variable dma_reserve and its usage was introduced in commit 0e0b864e069c ("[PATCH] Account for memmap and optionally the kernel image as holes"). Its original purpose was to accounting for the reserved pages in DMA zone to make DMA zone's watermarks calculation more accurate on x86. However, currently there's zone->managed_pages to account for all available pages for buddy, zone->present_pages to account for all present physical pages in zone. What is more important, on x86, calculating and setting the zone->managed_pages is a temporary move, all zone's managed_pages will be zeroed out and reset to the actual value according to how many pages are added to buddy allocator in mem_init(). Before mem_init(), no buddy alloction is requested. And zone's pcp and watermark setting are all done after mem_init(). So, no need to worry about the DMA zone's setting accuracy during free_area_init(). Hence, remove dma_reserve and its handling in free_area_init_core() because it's useless and causes confusion. Signed-off-by: Baoquan He --- arch/x86/mm/init.c | 2 -- include/linux/mm.h | 1 - mm/mm_init.c | 23 ----------------------- 3 files changed, 26 deletions(-) diff --git a/arch/x86/mm/init.c b/arch/x86/mm/init.c index 679893ea5e68..5209549e8192 100644 --- a/arch/x86/mm/init.c +++ b/arch/x86/mm/init.c @@ -1032,8 +1032,6 @@ void __init memblock_find_dma_reserve(void) if (start_pfn < end_pfn) nr_free_pages += end_pfn - start_pfn; } - - set_dma_reserve(nr_pages - nr_free_pages); #endif } diff --git a/include/linux/mm.h b/include/linux/mm.h index 2c0910bc3e4a..1888b1935103 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -3210,7 +3210,6 @@ static inline int early_pfn_to_nid(unsigned long pfn) extern int __meminit early_pfn_to_nid(unsigned long pfn); #endif -extern void set_dma_reserve(unsigned long new_dma_reserve); extern void mem_init(void); extern void __init mmap_init(void); diff --git a/mm/mm_init.c b/mm/mm_init.c index 549e76af8f82..153fb2dc666f 100644 --- a/mm/mm_init.c +++ b/mm/mm_init.c @@ -226,7 +226,6 @@ static unsigned long required_movablecore_percent __initdata; static unsigned long nr_kernel_pages __initdata; static unsigned long nr_all_pages __initdata; -static unsigned long dma_reserve __initdata; static bool deferred_struct_pages __meminitdata; @@ -1583,12 +1582,6 @@ static void __init free_area_init_core(struct pglist_data *pgdat) zone_names[j], memmap_pages, freesize); } - /* Account for reserved pages */ - if (j == 0 && freesize > dma_reserve) { - freesize -= dma_reserve; - pr_debug(" %s zone: %lu pages reserved\n", zone_names[0], dma_reserve); - } - if (!is_highmem_idx(j)) nr_kernel_pages += freesize; /* Charge for highmem memmap if there are enough kernel pages */ @@ -2547,22 +2540,6 @@ void *__init alloc_large_system_hash(const char *tablename, return table; } -/** - * set_dma_reserve - set the specified number of pages reserved in the first zone - * @new_dma_reserve: The number of pages to mark reserved - * - * The per-cpu batchsize and zone watermarks are determined by managed_pages. - * In the DMA zone, a significant percentage may be consumed by kernel image - * and other unfreeable allocations which can skew the watermarks badly. This - * function may optionally be used to account for unfreeable pages in the - * first zone (e.g., ZONE_DMA). The effect will be lower watermarks and - * smaller per-cpu batchsize. - */ -void __init set_dma_reserve(unsigned long new_dma_reserve) -{ - dma_reserve = new_dma_reserve; -} - void __init memblock_free_pages(struct page *page, unsigned long pfn, unsigned int order) { From patchwork Mon Mar 18 14:21:34 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Baoquan He X-Patchwork-Id: 13595400 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 F0958C54E58 for ; Mon, 18 Mar 2024 14:22:01 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 7CEC78E0001; Mon, 18 Mar 2024 10:22:01 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 72C9D8D0002; Mon, 18 Mar 2024 10:22:01 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 5A6078E0001; Mon, 18 Mar 2024 10:22:01 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 47A588D0002 for ; Mon, 18 Mar 2024 10:22:01 -0400 (EDT) Received: from smtpin25.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 1B5491C04F2 for ; Mon, 18 Mar 2024 14:22:01 +0000 (UTC) X-FDA: 81910374042.25.BECB2AB Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by imf25.hostedemail.com (Postfix) with ESMTP id 621DFA0014 for ; Mon, 18 Mar 2024 14:21:59 +0000 (UTC) Authentication-Results: imf25.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=ciMMq23M; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf25.hostedemail.com: domain of bhe@redhat.com designates 170.10.129.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=1710771719; 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=xwNlozyVa9wCKfV2gAvZZNhZ5jeQ/QZALXvKTp7xRLg=; b=722HCxqZ6qBVjgHqXMGgMSarUQMQ90wL0Yxgbq4naclq+DIe7e0z1oVAGBf5NGaCM2XrkT nmaS9JJOW7QHuFaMsCgIqG9u2B3byMdY0rNM4bR5Wuxb8mw5vWsE9rqSn/4Gk/PaKGxwCV BGvyyizqXnZ/n27w/69eUyMwwIKGfDU= ARC-Authentication-Results: i=1; imf25.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=ciMMq23M; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf25.hostedemail.com: domain of bhe@redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=bhe@redhat.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1710771719; a=rsa-sha256; cv=none; b=vPJL7hI2TFwIPEzUIhKEmZL04tXIb0eW3aMeAVWyyZtfrmFLppSp4L3APzrvKxbiZgnXFu iXESNTXaZxzAQgZcGY1RrydUHOKgUR7+KyV4CzMKm07yE5E42xM2soznberqP7gctvSbaK 1LiS0cS2cqMfVx+RMOU9sRwxTLs5HsM= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1710771718; 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=xwNlozyVa9wCKfV2gAvZZNhZ5jeQ/QZALXvKTp7xRLg=; b=ciMMq23MHVySUD7SE0BY+VLO94klsaQmTtU6cllR7ztYRDOPY1S5vG8Uy7rKhQDJm5SiEv GRc90znVItIdO08pn8+fK8PEZfJB2cdRVf/5QKEi5GXC6XtpLZH4UTX1eTnmIw9KyKxANM h/Y4FWZsQQBevedJ1SbbLcs79uNl9BY= 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-433-PMNkGQMOMYiyTf9cUHnhqQ-1; Mon, 18 Mar 2024 10:21:57 -0400 X-MC-Unique: PMNkGQMOMYiyTf9cUHnhqQ-1 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (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 AEEC185A58C; Mon, 18 Mar 2024 14:21:56 +0000 (UTC) Received: from MiWiFi-R3L-srv.redhat.com (unknown [10.72.116.12]) by smtp.corp.redhat.com (Postfix) with ESMTP id 329C1492BC4; Mon, 18 Mar 2024 14:21:52 +0000 (UTC) From: Baoquan He To: linux-mm@kvack.org Cc: linux-kernel@vger.kernel.org, x86@kernel.org, linuxppc-dev@lists.ozlabs.org, akpm@linux-foundation.org, rppt@kernel.org, Baoquan He Subject: [PATCH 2/6] x86: remove memblock_find_dma_reserve() Date: Mon, 18 Mar 2024 22:21:34 +0800 Message-ID: <20240318142138.783350-3-bhe@redhat.com> In-Reply-To: <20240318142138.783350-1-bhe@redhat.com> References: <20240318142138.783350-1-bhe@redhat.com> MIME-Version: 1.0 Content-type: text/plain X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.10 X-Rspamd-Queue-Id: 621DFA0014 X-Rspam-User: X-Rspamd-Server: rspam02 X-Stat-Signature: xes4jwkuq69fswnyfhetkz3r81wgfs9j X-HE-Tag: 1710771719-108444 X-HE-Meta: U2FsdGVkX18Uf20FIJwVsuDZThza4LwLOeNW/Qzxq52r2XdBb6sCEZFuucJjXtQ0i8k9/4LXEE8q/ff+kPrMXwsdyP/5vewzRDlg1dbyZ15gQ8MpkvnlwUx1sL+L/zH+Vx8lYkSHw2ggnX+tDDPYP72QKIIAYelLnY+1UCoENvXTnv670MQQxABheEBTUacyz5zAhrpQ4tjT55JabHCETeQfSlAxzhalZpmbdg0YT3WOjrSA5eC1fbJxZ5NkBeq/VFBDtHdbHgds5cQj0BHYCBcS1oXshoIz1POlNZcML+vl9w8BdZ6dnxdjj4A4X4VDxH8io8jOgLSSak5hQdAx6zZRNsR5OVsF4BR/AY4QP86Dk14bSiGmk+vLD5G9u27qSMt10AWpRFKRHsABbv060ot8BpxyvqOsbPuroJIMnMz5jSU5dJ7yZW0L1U6tbJlx1Jo4/p+bE/orPBgBFFMExzOu+WCxU6XUMiZF3AtlEF97XM0DJBxHw76vx+HbzwWPaigpw+mYPTyTMcGM6GiE/+46oOuSmxYPqXJGW/omhAlnC4wL42f2haJgVp8Whl5Z9kPDzSm8UEDtduFs9kVZtVC/Kz4mbWksfAVte30JBnpCnNJTAK1RWTN6mWfkeVBdY+K9On2dtXehPtk+wrmzaTqaKifjXVQl61TnvpXl+G0kjH2AkgUKbnUkvgzYin7imYqam6mcuv02zB+XMJJX2weLh5J77pazguNpY+G/oR/M0UvyoDSpz9/fuS4nO6Kofl4qtn09a+8wSOwEXodLxd0HjRNZ0lHsTi7qGnn2FInSY5YtU4UONS8Yw7J0Gt8eYlOqSZiHVgidoNu71qBfZzts1G5Rn/+bv1B9VL3GUwwcAJOanybVDyAa9E5av5trhkfWM/gTKd+MXy6mledBgcRsLD+wNzxotZ1inOxbmxEyGTW1qR9n1VDi9y2EE6zRJ5MgCuk7AFd2mWAXoAC HdLaWB0k Icm1cDkHm2Hz3juxMc9wsw8XCm6JhTAP86a+ThNqxAE0Dzka3Dq6T3okMP465Ku6WS3NSQFplPf4hlxeKQiozGLmI9Chw52gkln9sWmvDAl99XB2Coev07M3GERskvnWNbPCsp8dMHI+o6cVSn4r2FocOcnQzff/PCC9G/6+SQUiZuhDtmqWgMZg69MmvUrQi9ireMG8Bw0+lCVvuDN+ZyAcAbw== 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: This is not needed any more. Signed-off-by: Baoquan He --- arch/x86/include/asm/pgtable.h | 1 - arch/x86/kernel/setup.c | 2 -- arch/x86/mm/init.c | 45 ---------------------------------- 3 files changed, 48 deletions(-) diff --git a/arch/x86/include/asm/pgtable.h b/arch/x86/include/asm/pgtable.h index 315535ffb258..cefc7a84f7a4 100644 --- a/arch/x86/include/asm/pgtable.h +++ b/arch/x86/include/asm/pgtable.h @@ -1200,7 +1200,6 @@ static inline int pgd_none(pgd_t pgd) extern int direct_gbpages; void init_mem_mapping(void); void early_alloc_pgt_buf(void); -extern void memblock_find_dma_reserve(void); void __init poking_init(void); unsigned long init_memory_mapping(unsigned long start, unsigned long end, pgprot_t prot); diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c index 3e1e96efadfe..5aa00938051f 100644 --- a/arch/x86/kernel/setup.c +++ b/arch/x86/kernel/setup.c @@ -1106,8 +1106,6 @@ void __init setup_arch(char **cmdline_p) */ arch_reserve_crashkernel(); - memblock_find_dma_reserve(); - if (!early_xdbc_setup_hardware()) early_xdbc_register_console(); diff --git a/arch/x86/mm/init.c b/arch/x86/mm/init.c index 5209549e8192..615f0bf4bda6 100644 --- a/arch/x86/mm/init.c +++ b/arch/x86/mm/init.c @@ -990,51 +990,6 @@ void __init free_initrd_mem(unsigned long start, unsigned long end) } #endif -/* - * Calculate the precise size of the DMA zone (first 16 MB of RAM), - * and pass it to the MM layer - to help it set zone watermarks more - * accurately. - * - * Done on 64-bit systems only for the time being, although 32-bit systems - * might benefit from this as well. - */ -void __init memblock_find_dma_reserve(void) -{ -#ifdef CONFIG_X86_64 - u64 nr_pages = 0, nr_free_pages = 0; - unsigned long start_pfn, end_pfn; - phys_addr_t start_addr, end_addr; - int i; - u64 u; - - /* - * Iterate over all memory ranges (free and reserved ones alike), - * to calculate the total number of pages in the first 16 MB of RAM: - */ - nr_pages = 0; - for_each_mem_pfn_range(i, MAX_NUMNODES, &start_pfn, &end_pfn, NULL) { - start_pfn = min(start_pfn, MAX_DMA_PFN); - end_pfn = min(end_pfn, MAX_DMA_PFN); - - nr_pages += end_pfn - start_pfn; - } - - /* - * Iterate over free memory ranges to calculate the number of free - * pages in the DMA zone, while not counting potential partial - * pages at the beginning or the end of the range: - */ - nr_free_pages = 0; - for_each_free_mem_range(u, NUMA_NO_NODE, MEMBLOCK_NONE, &start_addr, &end_addr, NULL) { - start_pfn = min_t(unsigned long, PFN_UP(start_addr), MAX_DMA_PFN); - end_pfn = min_t(unsigned long, PFN_DOWN(end_addr), MAX_DMA_PFN); - - if (start_pfn < end_pfn) - nr_free_pages += end_pfn - start_pfn; - } -#endif -} - void __init zone_sizes_init(void) { unsigned long max_zone_pfns[MAX_NR_ZONES]; From patchwork Mon Mar 18 14:21:35 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Baoquan He X-Patchwork-Id: 13595401 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 4F6DAC54E5D for ; Mon, 18 Mar 2024 14:22:07 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id BEA8B8E0003; Mon, 18 Mar 2024 10:22:06 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id B99378D0002; Mon, 18 Mar 2024 10:22:06 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A39418E0003; Mon, 18 Mar 2024 10:22:06 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 8FE1C8D0002 for ; Mon, 18 Mar 2024 10:22:06 -0400 (EDT) Received: from smtpin07.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 6FA3140576 for ; Mon, 18 Mar 2024 14:22:06 +0000 (UTC) X-FDA: 81910374252.07.923BFC9 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 B7CD5140015 for ; Mon, 18 Mar 2024 14:22:04 +0000 (UTC) Authentication-Results: imf26.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=NemGzvaQ; 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=1710771724; 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=1Ez2QF5MYw9LVg300C2Oo4I1YSujmhzgBkyBgmFJgxw=; b=QzLXH6qMIHqtnzXWX62ROk/ybRe+TrfeVI7pvJQEkBFaZeGJOw3YZJfiMu4vYkOrn+75Ou EKb4bRk2yaJ8sAbDGOv+r4mqGsTLZ9fdN8mNqDjSNr9B1F0l22Xeo/Uag9KLovynNwcubq zIRjubvQjZxs0qIAUwfkeEgtHiHznwA= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1710771724; a=rsa-sha256; cv=none; b=nNxxSZubFOao5nB/GfZwMrEZfqjE8kfOOchZQZ+ffpMDs6KUY/ayiucor+nrTVuIALdOc9 ZU84KNnwm+gZv52GPk6DTCRT0amn5EaD8eHS0ieZ77BQuc0yjKvk6hYNUdbyUgOg0bMvsJ ppS5G/RYRLI80ky7L3/IwRAXU4GlmA4= ARC-Authentication-Results: i=1; imf26.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=NemGzvaQ; 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 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1710771724; 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=1Ez2QF5MYw9LVg300C2Oo4I1YSujmhzgBkyBgmFJgxw=; b=NemGzvaQz6x+9Tvmazy9vlvUIO21sLbjiOkcA5S13eU4fAPFVkHhSew531dQILq15ZDgvN yUM1bJpsBmEghjwOoxm7lAup5MIf+J1T3m8CPfs/LUed8h1MxzyB6j2CuelNA88+L7zdcl QwVAplpjhg/l1c9IZ6a9reVhfZ2hZqc= 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-357-Ksx67UdVPXy4bpjfV4ra_w-1; Mon, 18 Mar 2024 10:22:00 -0400 X-MC-Unique: Ksx67UdVPXy4bpjfV4ra_w-1 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (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 3A2F4800269; Mon, 18 Mar 2024 14:22:00 +0000 (UTC) Received: from MiWiFi-R3L-srv.redhat.com (unknown [10.72.116.12]) by smtp.corp.redhat.com (Postfix) with ESMTP id 510F6492BD4; Mon, 18 Mar 2024 14:21:57 +0000 (UTC) From: Baoquan He To: linux-mm@kvack.org Cc: linux-kernel@vger.kernel.org, x86@kernel.org, linuxppc-dev@lists.ozlabs.org, akpm@linux-foundation.org, rppt@kernel.org, Baoquan He Subject: [PATCH 3/6] mm/mm_init.c: add new function calc_nr_kernel_pages() Date: Mon, 18 Mar 2024 22:21:35 +0800 Message-ID: <20240318142138.783350-4-bhe@redhat.com> In-Reply-To: <20240318142138.783350-1-bhe@redhat.com> References: <20240318142138.783350-1-bhe@redhat.com> MIME-Version: 1.0 Content-type: text/plain X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.10 X-Rspamd-Queue-Id: B7CD5140015 X-Rspam-User: X-Stat-Signature: 4w5wqyarzz5gseexaax44ww3kq1u3nto X-Rspamd-Server: rspam03 X-HE-Tag: 1710771724-904966 X-HE-Meta: U2FsdGVkX1/6NjGlYTGbEaoNUFymfQX+h1OmMil+bQ5ewFayVH9gpXSdk0a4q7lw6f8LctOcy2Hcoseh1YveldWOqBop8xajn1K6u8fvDQEqpr7NiAQSEUt+p8aWLMPaACeVkA3omk5TWzFaTUMAHTe4fJAgglsUSmirhWNGJo6k1Li+cZlE8j7Oza2H0oaJfhBth/Nu08A+QsVpVgXxABxwVsJiVi3oTJuRSQ11p2LsYJ7Cm8VIzU3mpwG6IbZ+8MyfcjT3w4pz/mer0+hExzJcpM216H36wck6hj9QPIRM8Gqnd5BDHxn9tjV6/2ZWFEXSVWUeKi96B5nsGGrSdChFK7zuVDUuUnFt1NqWDm5Nz41UfthD7lRhUnyrRNlmvtIlOC2n4LF23N938fLsbPF1lh4TU/1k/8LgVO0tYqWVrMk0tD6tnWW8M6ETRTnhK5kiQ8CPXSzgienQKYL4rylYufqPZjOSBX65FrmsqfYySVR+hR74+SUlgM/72B/5v4MFT/oioxwYRCA7vRxItViUlSkPRjvTcNkUk3u0cFSjhSqht5t2q2t+8KUSFUTQRYYyV0ILrFkCEZ9ib70CwXBq1ZIQ1jrNt20hV24GfWREtOu93cBtnq0Iw6MhXhiPfHmGb6wkYJwMDAeykCxZtws34ox+A62464ZaYRaMWXLpdwfSITNyLN3DVqmjRcxJJCQJUOILPQBdLvuqNDUMgeelhib1d/yP54YQkkCoF2Fnh0LwPgil63BwbvRsOOYc6XC4588tZCKg0+v9QLOA47aknMRnTKZDVX4ZpugBlFkdlwgxy13diHvRcHpMd/yw7ZIPUDe7nltrGf7NxAktZGoGLLcGtWEqMVR3nl990QPA1DG0+ZPYrwM5ID4DaJgAw1iXrqxtGoONrQbWEGiO3VvJ98rWaAoq8gJTlnFAWOH/4sdsRnXoKyp/BJaxvDlxwZcs81KAXezQ8IGwu7u FzQzoQm9 SQZ7C7vtd+PoyvmXw0sau/xzP/9QykoEPTiCWsHCyUaVbCyn9XB0J39OSoNtkZgrVvy1h5I6Sks7FZ1ttoxgTTpUZ4HuUw7NnKDrULXOVp70HZjZ3MBzxIG3BYp86QdZJO0zdd5nGHWLNlXyj19oM0dRmLgJuk4r4VykbgD7ACpFv4pxc3ENQW6Xdw/MQp4H93XHzKSEXZRjZ93qUuFrkT+jDDg== 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: This is a preparation to calculate nr_kernel_pages and nr_all_pages, both of which will be used later in alloc_large_system_hash(). nr_all_pages counts up all free but not reserved memory in memblock allocator, including HIGHMEM memory. While nr_kernel_pages counts up all free but not reserved low memory in memblock allocator, excluding HIGHMEM memory. Signed-off-by: Baoquan He --- mm/mm_init.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/mm/mm_init.c b/mm/mm_init.c index 153fb2dc666f..c57a7fc97a16 100644 --- a/mm/mm_init.c +++ b/mm/mm_init.c @@ -1264,6 +1264,30 @@ static void __init reset_memoryless_node_totalpages(struct pglist_data *pgdat) pr_debug("On node %d totalpages: 0\n", pgdat->node_id); } +static void __init calc_nr_kernel_pages(void) +{ + unsigned long start_pfn, end_pfn; + phys_addr_t start_addr, end_addr; + u64 u; +#ifdef CONFIG_HIGHMEM + unsigned long high_zone_low = arch_zone_lowest_possible_pfn[ZONE_HIGHMEM]; +#endif + + for_each_free_mem_range(u, NUMA_NO_NODE, MEMBLOCK_NONE, &start_addr, &end_addr, NULL) { + start_pfn = PFN_UP(start_addr); + end_pfn = PFN_DOWN(end_addr); + + if (start_pfn < end_pfn) { + nr_all_pages += end_pfn - start_pfn; +#ifdef CONFIG_HIGHMEM + start_pfn = clamp(start_pfn, 0, high_zone_low); + end_pfn = clamp(end_pfn, 0, high_zone_low); +#endif + nr_kernel_pages += end_pfn - start_pfn; + } + } +} + static void __init calculate_node_totalpages(struct pglist_data *pgdat, unsigned long node_start_pfn, unsigned long node_end_pfn) From patchwork Mon Mar 18 14:21:36 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Baoquan He X-Patchwork-Id: 13595402 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 A1E80C54E58 for ; Mon, 18 Mar 2024 14:22:12 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id ED28B8D0002; Mon, 18 Mar 2024 10:22:11 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id E7F358E0005; Mon, 18 Mar 2024 10:22:11 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D466B8D0003; Mon, 18 Mar 2024 10:22:11 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id C42378D0002 for ; Mon, 18 Mar 2024 10:22:11 -0400 (EDT) Received: from smtpin24.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 34265A11C4 for ; Mon, 18 Mar 2024 14:22:11 +0000 (UTC) X-FDA: 81910374462.24.2A88433 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by imf12.hostedemail.com (Postfix) with ESMTP id 7ECAF4002A for ; Mon, 18 Mar 2024 14:22:08 +0000 (UTC) Authentication-Results: imf12.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=MXUQs63A; spf=pass (imf12.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=1710771728; 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=KylbygHFZqY0Y1GdcbNhcWaGXpHQjrqCbtqoLy1m2Bc=; b=ALk0E+g2KnsINSlxZ2koXFwWkcXSq+lNuh6bdRLP74Mm4nJl4EtltqwWD5WwkwK+ICP35Q eZy4OzTRAYQpe5c+RBmmEBBN9DEe88yR6GdXLFZ8F9IE7N6GE34LpHNBCzwDL/2J/fyXRx sFtFqOWpR7dqnOnauY7hwbHc+OJ/AOA= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1710771728; a=rsa-sha256; cv=none; b=slrw9UjtPU41RWJiS1VA0Hsy/anDDveOrHvSuJseSKnF/4l3oE83+o7uLLllmWGTaVxwgu O0G+A0RRz1NEKlT7jPbe0OL8Nle20WP4Z9Et2C6WNJus+DDhWnIU2GSQzBcFdTeVHw2zcW PbNwW6x2mBBE3T8YcHPwi0B/sMe26iM= ARC-Authentication-Results: i=1; imf12.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=MXUQs63A; spf=pass (imf12.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 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1710771727; 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=KylbygHFZqY0Y1GdcbNhcWaGXpHQjrqCbtqoLy1m2Bc=; b=MXUQs63AK9CnyuPn6EwQLaMakGdcI/ynoV3nuyYHSFnCheTrwpxuFH0GuMetDou2VzVyqh f1pezdjAWZ2GHDgExC28ri3H3rdb+r3xnDqWfj+RWCLnbd7puB/NdlTB4Wo7GAlDImiIHI LW5XnfGJwdA2m0FDXDnipgSYvLPV7NE= 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-477-Mj8ycNDdNl-3_fqL6K9nzw-1; Mon, 18 Mar 2024 10:22:04 -0400 X-MC-Unique: Mj8ycNDdNl-3_fqL6K9nzw-1 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (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 BF3D085A58C; Mon, 18 Mar 2024 14:22:03 +0000 (UTC) Received: from MiWiFi-R3L-srv.redhat.com (unknown [10.72.116.12]) by smtp.corp.redhat.com (Postfix) with ESMTP id D7BC3492BC4; Mon, 18 Mar 2024 14:22:00 +0000 (UTC) From: Baoquan He To: linux-mm@kvack.org Cc: linux-kernel@vger.kernel.org, x86@kernel.org, linuxppc-dev@lists.ozlabs.org, akpm@linux-foundation.org, rppt@kernel.org, Baoquan He Subject: [PATCH 4/6] mm/mm_init.c: remove meaningless calculation of zone->managed_pages in free_area_init_core() Date: Mon, 18 Mar 2024 22:21:36 +0800 Message-ID: <20240318142138.783350-5-bhe@redhat.com> In-Reply-To: <20240318142138.783350-1-bhe@redhat.com> References: <20240318142138.783350-1-bhe@redhat.com> MIME-Version: 1.0 Content-type: text/plain X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.10 X-Rspamd-Queue-Id: 7ECAF4002A X-Rspam-User: X-Stat-Signature: zcdxumftewu5874reac76byngkt9e3yu X-Rspamd-Server: rspam03 X-HE-Tag: 1710771728-936540 X-HE-Meta: U2FsdGVkX18vqnI17pZvVQ1pe6lxMBtnpG35Ririslq+6CP2zf3XeS4ECvocBWt+Ej8Pdo+6UQYJIjSDWX9yH0i+YNqcEnMmQKbJD9Z4CT2wJeYFoHKHGOg804TptPiaZFfeB6D8CvpdJg8ajcXnmCyTDzh9HK87QyEQH4lVLDxkVNwEjnPYJLgPdiFuNlwPOpesRpR84OXPAHUI7ELTbWnvfGUXLMIkYNoksUXhdiBPM1OBtUccu8Xgxd4CE2amcAishUJFQDkzjpwBfYq0RV+yytYiXl5CZgWFXdjrwTv24T3ronvg7AX3QlYwNnsGOINIOPr1v3T0TfYJzYUEJuwFhFiDOetrvhOLkdS8Jq8yE2SPeKrOp8r34Y9ghVsoCYHUjAhX0ljA2UgmqO5QYMlivkjiijLbkWLhDpKczV/+QGARxPKvOTTI7xyZu8R71fkwbWKsGsJkiVwv78N2/JmXpTeDMXiUS+uyo/FI8t64dJIh9ApS48KOSdrgnFeMckCGfMSTCi4dAWnScdLuvjr8ndjld9X27pxgZA0D1O1ArOyc5GLV91vNEma5OpYghiQd7gHWjQ8sGjvx3XYCokw9Sj89GHbqB8UPeK7Q8tO5IqpPvpPVmTSUujfwdjsDDi5UZ8JWFfUTf/pvc/d6RR9p+IAIKwrj90QYj8ESwAGT5qvVnw34Xf5HUbMcFlXENF30sgkBhmYsjHt9iKRngesHb53YmiVSj712SdhA1s0shOqD1/6kCwyYu/A7d5MOSAJAcT4De+EOJLLx0wRBbnGCinTFwKQgd3e0pbCODZVrO/BApcenNT5f7q+9QMc8ZVRmZgTyvH0d+yXwtgB93Rzn/QdqgqcDvrxNTal1HF2ljvdiGNmENcIwwAZNYq8QkAy5kjM14Hsh20DtyaG36CzoXHvGi7qI0p9CWm92u4VjNxvFaEf7B22caNfMiKRnx56VjfoyrdSgYHjhKr7 vJm8c37H e8kYMoPF7s1QW6BhU4w4ktV2dp8kWDm/nfKXt9SJO034VJLdoFkUmDL0FY30nPyW+nTfKkQXhjMeqzxnWHx3OsF9yuQsEXarQzhYusNreI1fTNYNRKv1mlfknpXmyyPXxOzmcgU2wL6FgMdqxZ0d6joAYrDifoSlT21QGOByrg4FPPXDWFk/bgXRuwY+yA88CGgU9J4KyMfR3hQRKQOtKuNPM+g== 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: 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(). And also remove the assignment of nr_all_pages and nr_kernel_pages in free_area_init_core(). Instead, call the newly added calc_nr_kernel_pages() to count up all free but not reserved memory in memblock and assign to nr_all_pages and nr_kernel_pages. The counting excludes memmap_pages, and other kernel used data, which is more accurate than old way and simpler, and can also cover the ppc required arch_reserved_kernel_pages() case. Signed-off-by: Baoquan He --- mm/mm_init.c | 38 ++++++-------------------------------- 1 file changed, 6 insertions(+), 32 deletions(-) diff --git a/mm/mm_init.c b/mm/mm_init.c index c57a7fc97a16..55a2b886b7a6 100644 --- a/mm/mm_init.c +++ b/mm/mm_init.c @@ -1584,41 +1584,14 @@ static void __init free_area_init_core(struct pglist_data *pgdat) for (j = 0; j < MAX_NR_ZONES; j++) { struct zone *zone = pgdat->node_zones + j; - unsigned long size, freesize, memmap_pages; - - size = zone->spanned_pages; - freesize = zone->present_pages; - - /* - * Adjust freesize so that it accounts for how much memory - * is used by this zone for memmap. This affects the watermark - * and per-cpu initialisations - */ - memmap_pages = calc_memmap_size(size, freesize); - if (!is_highmem_idx(j)) { - if (freesize >= memmap_pages) { - freesize -= memmap_pages; - if (memmap_pages) - pr_debug(" %s zone: %lu pages used for memmap\n", - zone_names[j], memmap_pages); - } else - pr_warn(" %s zone: %lu memmap pages exceeds freesize %lu\n", - zone_names[j], memmap_pages, freesize); - } - - if (!is_highmem_idx(j)) - nr_kernel_pages += freesize; - /* Charge for highmem memmap if there are enough kernel pages */ - else if (nr_kernel_pages > memmap_pages * 2) - nr_kernel_pages -= memmap_pages; - nr_all_pages += freesize; + unsigned long size = zone->spanned_pages; /* - * Set an approximate value for lowmem here, it will be adjusted - * when the bootmem allocator frees pages into the buddy system. - * And all highmem pages will be managed by the buddy system. + * Set the zone->managed_pages as zone->present_pages roughly, it + * be zeroed out and reset when memblock allocator frees pages into + * buddy system. */ - zone_init_internals(zone, j, nid, freesize); + zone_init_internals(zone, j, nid, zone->present_pages); if (!size) continue; @@ -1915,6 +1888,7 @@ void __init free_area_init(unsigned long *max_zone_pfn) check_for_memory(pgdat); } + calc_nr_kernel_pages(); memmap_init(); /* disable hash distribution for systems with a single node */ From patchwork Mon Mar 18 14:21:37 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Baoquan He X-Patchwork-Id: 13595403 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 92B51C54E5D for ; Mon, 18 Mar 2024 14:22:14 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id D987F8E0006; Mon, 18 Mar 2024 10:22:13 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id CFA8B8E0005; Mon, 18 Mar 2024 10:22:13 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B73498E0006; Mon, 18 Mar 2024 10:22:13 -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 A54378E0005 for ; Mon, 18 Mar 2024 10:22:13 -0400 (EDT) Received: from smtpin02.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id 73832A0564 for ; Mon, 18 Mar 2024 14:22:13 +0000 (UTC) X-FDA: 81910374546.02.30C117D Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by imf12.hostedemail.com (Postfix) with ESMTP id B1F8440007 for ; Mon, 18 Mar 2024 14:22:11 +0000 (UTC) Authentication-Results: imf12.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=YXQpOaMC; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf12.hostedemail.com: domain of bhe@redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=bhe@redhat.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1710771731; a=rsa-sha256; cv=none; b=BUtQn7kXrvlWdTyql2WGdSaG4Rz94sVLIv/aJTcXZkMDQ3UyrrZaL3qdmX8KdQfok4IfQ2 dWTJZocC+ZuGZHI3yIQoQmP0XuVJloWUtzcbCT76q19TFYy3P+oTH1rcAKvcbvNiuDJhra Or/DMjRbQe3ZooISI/DKnZNYO2E700Q= ARC-Authentication-Results: i=1; imf12.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=YXQpOaMC; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf12.hostedemail.com: domain of bhe@redhat.com designates 170.10.129.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=1710771731; 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=D/H22rgu+0Eg3oELZT1F8mB3L7t/pq1y95Fbs8e1Y/U=; b=2cNj1GVQFsV+3gF0rOkf5eB/GgmWVcRSMOmrkqdd31WAjmym3adMxlOpvNZcRc1tYl2fYz sr1qv5PRWSSZqvfM3fF+SNq5IefXnNCuksffPZzTr0G7GgtSRHP281NybNUUcWyt0QprGD r+Gh+ZjHadW3Eb3CqaLSzwKNMvIaZtA= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1710771731; 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=D/H22rgu+0Eg3oELZT1F8mB3L7t/pq1y95Fbs8e1Y/U=; b=YXQpOaMC5VYJGmGlWMb2wG3NFWITYeVdBq7oWEBjYNjkOORqwGuVSeGUbwsPkhgLcKM2Nh JKU3hfELaJg/g4KknyaLpCAhJRnb1DE8gVJNwNc2X0adxXLFekY1nk/If2arOtqwQ6kZi/ 8EPIdIiDb5OsBR42lNSjVI1OINOKvHk= 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-43-gnPigdkEN5yTi6k7RKI_9g-1; Mon, 18 Mar 2024 10:22:09 -0400 X-MC-Unique: gnPigdkEN5yTi6k7RKI_9g-1 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (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 4F4BF800265; Mon, 18 Mar 2024 14:22:08 +0000 (UTC) Received: from MiWiFi-R3L-srv.redhat.com (unknown [10.72.116.12]) by smtp.corp.redhat.com (Postfix) with ESMTP id 65BA7492BD1; Mon, 18 Mar 2024 14:22:05 +0000 (UTC) From: Baoquan He To: linux-mm@kvack.org Cc: linux-kernel@vger.kernel.org, x86@kernel.org, linuxppc-dev@lists.ozlabs.org, akpm@linux-foundation.org, rppt@kernel.org, Baoquan He Subject: [PATCH 5/6] mm/mm_init.c: remove unneeded calc_memmap_size() Date: Mon, 18 Mar 2024 22:21:37 +0800 Message-ID: <20240318142138.783350-6-bhe@redhat.com> In-Reply-To: <20240318142138.783350-1-bhe@redhat.com> References: <20240318142138.783350-1-bhe@redhat.com> MIME-Version: 1.0 Content-type: text/plain X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.10 X-Rspam-User: X-Rspamd-Server: rspam06 X-Rspamd-Queue-Id: B1F8440007 X-Stat-Signature: emrpfd7kwcxchq19enh3cwg9niawdijo X-HE-Tag: 1710771731-869312 X-HE-Meta: U2FsdGVkX1+WkmNs+kGpENBA8AT+tRshd475583QI1NMyC84bSl6YY/BlOuHGi5EL69r8CnpC1Qw91E5jahjBq83kmTcv2c3LjCjHeF+PSgK0C1S9+0WT7lR6YiVUV0yJumQQr74HnPMXZhsvC8S/hkz3zdCPYTRAjiHP7xMExKS0iCmINFEQSE4wlNVpHtclc+gEKppWN6aal10nN2BTHY6wxL/2Zm6lGGbM0QP6hdT1B24pei4QzbyrCPalpgh8cKoxLI3Vlu/BV7kdrX5BIU9B68jvCCX0Ly1L/5ZoDNJ1cQiJRCSUaRdFBOx2VSjUwOoYXwCBnAbO0EPNI/68NOEVnxk2rgKa9uyLiPPhLw9UFaJznmpIvXd9rIJy0OzHDIvY8Al23YL8lMi1dE3k4WOuB7UFk4i14Kom21nMiMhuIte0dAWRnAMZXy6n7iriB5whvMQA/MCxknL3vgIseyy/Zui7Z/bYJ7p3sJOMJuqTne8Q1CumolodharDpuQXXtYpijaGL8tI5FVF1n/GjLmmenyoO8ezWU8Ztg1lp1YKhnfvSmqUlWiTcyr01w9HIh858QxNcKHtHoSjg8IzvAmtpmIalLqRqJ2RnCYSaNE0FbETTQIht0ziVKUOH6YUmnTshikRie0tVx/H/TZhPYyvhzr4qEHU67+4Q49jBeKm1m44Hx0XRfV1n+ehPSP6QMitP3Yao6jNg924xnqyDZxdMN/b34Tqwl9nX0XnZML5nouWU1VMfWTVNPFfMrmJ4PYf3YXvN9Ffee7p0VfhS43uuovv9DPjQEOciZ6T1wpfOEQp1GHjP0/FByuxLnczzL9hvDw4+3i+37fSm62K4SEOkrBs43FOH/ft3qOum0fTofIqSIjfyq+ri5MQlFoHThnFLG0GUXpz1Tg/nbroiJhYvZuQaDl74A5GQw4QHJ61MiIC52qYk1QCumicQF47OBwueHX3BJsbTK37mQ KvGMRPq+ nRIwfzv7Gfo7vwaGuj+R8utsfeYHEmFYgNw6zX0l3eM5GlaPv+5iVE5WoDsKPMvGVKzwJPYCYbJEoD9or+wsadFL3ih5V4eZDL2kk6qDInErEVmtN+ELQ7571yxznuqpb/LMjsRrPT17UNvWXSb2hOZnb+ARyzCLynfWPUHB3LyFpNWkHd8d6EftmmiafNaeubTibrmtX0V1fhhMhSOA72TMJlQ== 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 55a2b886b7a6..9ed4b9e77c4a 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) { From patchwork Mon Mar 18 14:21:38 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Baoquan He X-Patchwork-Id: 13595404 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 A3574C54E5D for ; Mon, 18 Mar 2024 14:22:17 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 3AC2D8E0007; Mon, 18 Mar 2024 10:22:17 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 35B628E0005; Mon, 18 Mar 2024 10:22:17 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 1886E8E0007; Mon, 18 Mar 2024 10:22:17 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id 00F6A8E0005 for ; Mon, 18 Mar 2024 10:22:16 -0400 (EDT) Received: from smtpin06.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id B2FD940E17 for ; Mon, 18 Mar 2024 14:22:16 +0000 (UTC) X-FDA: 81910374672.06.9AEA0CC 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 A8E5020024 for ; Mon, 18 Mar 2024 14:22:14 +0000 (UTC) Authentication-Results: imf13.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=Kc4oG2vi; 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=1710771734; 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=vKTxTfeu0kP46EkkGNeeOEWSSdSnmFAW9kbc1VMhmsg=; b=0dMN5V6bVCNnrllcM7mBz9H0BkEOGAJXdU3BRuT4frvCRMnTq4Y35wJdycT68qBUFygZHF f7IrXJaSJ1arG7DVeuQrBWDF3kXaiNGeDf9ss1QuyxAWpQaSpzCmXVZkVx5/8i8fVUklY2 zoTAzCgAf5HEMr1kt0masP07SpZLLJs= ARC-Authentication-Results: i=1; imf13.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=Kc4oG2vi; 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=1710771734; a=rsa-sha256; cv=none; b=WUZl/YxssSEs+yzPGd4v5lZrQUX32XbAo4O1N8aMK8jRHmdNLq30QuA6h6CQcjhQd3FAV9 xYdhugmQneNhjFmv88fOQgq8sKgYVkraU4d3RGgIlw0MiXaegZq6jfv3Csiqy1FKsFDhVC EQ2miFJOx3g+ULBJCqxRsBBfPjIygDw= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1710771734; 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=vKTxTfeu0kP46EkkGNeeOEWSSdSnmFAW9kbc1VMhmsg=; b=Kc4oG2vi3ZuJPYdF7AmF6Y0eRZ4vCHon6c7cwZ0BrN/Uiz/HRTzh1YDZPrNm3LMu/eFpog fVDHrCIjlSlLD6ATyuJ9JHri/AfR7r9sDXPTeCiYNOBPpq7HkuWUzR/btZftLbs759RsZt 6cz8rGGFd+3G9hHkUerkO2bgyrOgqaE= 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-418-GqW5-K1AMTGX1X-eXiw5PA-1; Mon, 18 Mar 2024 10:22:12 -0400 X-MC-Unique: GqW5-K1AMTGX1X-eXiw5PA-1 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (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 DBA65101A588; Mon, 18 Mar 2024 14:22:11 +0000 (UTC) Received: from MiWiFi-R3L-srv.redhat.com (unknown [10.72.116.12]) by smtp.corp.redhat.com (Postfix) with ESMTP id EB3EC492BC4; Mon, 18 Mar 2024 14:22:08 +0000 (UTC) From: Baoquan He To: linux-mm@kvack.org Cc: linux-kernel@vger.kernel.org, x86@kernel.org, linuxppc-dev@lists.ozlabs.org, akpm@linux-foundation.org, rppt@kernel.org, Baoquan He Subject: [PATCH 6/6] mm/mm_init.c: remove arch_reserved_kernel_pages() Date: Mon, 18 Mar 2024 22:21:38 +0800 Message-ID: <20240318142138.783350-7-bhe@redhat.com> In-Reply-To: <20240318142138.783350-1-bhe@redhat.com> References: <20240318142138.783350-1-bhe@redhat.com> MIME-Version: 1.0 Content-type: text/plain X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.10 X-Rspam-User: X-Stat-Signature: erhu4qtbwbdedmufzq38ro9d87wrsbjk X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: A8E5020024 X-HE-Tag: 1710771734-734724 X-HE-Meta: U2FsdGVkX1/63x6SVGKoUAcuaejo9zX6zOKLZOUM6IRSD7UCrCLuojrKUSPgZhe3Owm+x37efA5okN5ZuU8c3+baqEES6D/QqGGMvZcD+K9Xwxhmvf5ztg+yX4KDaOf17R7t8GWKvZO6bNmWMp1hoAhF7P1gPRH+56hoDZYcjrfxCFT/1cBB2PO30Vwm78QUqnC0MNi6z0kYfs1glm7y1oTzbeOYzjJcgsB9RBzOIB/dJYCundYXYnoJOaRJgyrZJuYSH3CoBtHWtvgqRMCWE5hmr76aBD0A3AsExe3SiyyhIctckgC5rim6BiRjTrAzmUV4VcNFz2O6zIrSlaum6n5NUks+CgN/t6RhkC8xkJl/MJ0CBDJqMc2XxZCV/+Hdi27Z/zp1V2L1EwVID3GsF9kp+xhlsTytDMRNT/j/HlNNb9xw85avaZ5Ti6TQZdF2hlnQLj606pQYXg/WD/O44W3AnpTHNLUfdJET+aXOj3/3wfZRNmzvj2vhVZVAGiVEEmLfEL0LsGCIdRg+sApy+tIL/Ffg6K/1NdBsRIEqYSURKrMDWtYWX6f4NXaxBNrm19yq9Z2CeRfO10uSywDmuHx9hGc+UUNGrVDu4pDv94YJoRvb6MzOImv8rxrg293OGDFzXVgDWzXA4J6RAmJB7VARSONbmEldRJP+5oJhTh9KT2DPZ0Kj/2KdrWRFa/JqNdXd99fUp9myyhD7Nl0xhY+XG1sP87lBqrHtjhCU4Al6l/A5Op31fWLWt0Bz2awI0Q4Pmpo6eyv4LLlDDsuaA+MvKA3/dsGQlHkqlO6MdSJF5g/nVfkz4CmTn/zWJFF3BUaRItZ8BoDt8pHFmrot9hwJRnoST6gmOsrhgutfhzWXmIpHStvv09md8mhWJW52RjDIJAjFq+I1HXYI4CZ3w0QJ/QK1EuAaYSiwrlfR5VszPC+/g/f85Tz8GmqVVhBNKiSYP3hb7y97E6IdaWv 3qG0TP4Q eSkUVoTvX5algoqtiA4ez4CIJYLh1x2esVC6lXbS0/P5YFZPOw+WJvTX27TjwJeM8zjkMQ/bUvHioAA3hinbixrCaMs+qR5cJhWdf9Gs1hK6Pqemb5OGyc7483lQ3ip7KVhCv1ZzacvKTyl0iV1XNuOQVLeAbIDTavMZ/UHH/Yu3FgJL27t8mYXb7+KYTAipnF3Lo5Cya1YNxc4ctZRG1CBNNGw== 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: Since the current calculation of calc_nr_kernel_pages() has taken into consideration of kernel reserved memory, no need to have arch_reserved_kernel_pages() any more. Signed-off-by: Baoquan He --- arch/powerpc/include/asm/mmu.h | 4 ---- arch/powerpc/kernel/fadump.c | 5 ----- include/linux/mm.h | 3 --- mm/mm_init.c | 12 ------------ 4 files changed, 24 deletions(-) diff --git a/arch/powerpc/include/asm/mmu.h b/arch/powerpc/include/asm/mmu.h index 3b72c7ed24cf..aa5c0fd5edb1 100644 --- a/arch/powerpc/include/asm/mmu.h +++ b/arch/powerpc/include/asm/mmu.h @@ -406,9 +406,5 @@ extern void *abatron_pteptrs[2]; #include #endif -#if defined(CONFIG_FA_DUMP) || defined(CONFIG_PRESERVE_FA_DUMP) -#define __HAVE_ARCH_RESERVED_KERNEL_PAGES -#endif - #endif /* __KERNEL__ */ #endif /* _ASM_POWERPC_MMU_H_ */ diff --git a/arch/powerpc/kernel/fadump.c b/arch/powerpc/kernel/fadump.c index d14eda1e8589..ae8c7619e597 100644 --- a/arch/powerpc/kernel/fadump.c +++ b/arch/powerpc/kernel/fadump.c @@ -1735,8 +1735,3 @@ static void __init fadump_reserve_crash_area(u64 base) memblock_reserve(mstart, msize); } } - -unsigned long __init arch_reserved_kernel_pages(void) -{ - return memblock_reserved_size() / PAGE_SIZE; -} diff --git a/include/linux/mm.h b/include/linux/mm.h index 1888b1935103..8147b1302413 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -3221,9 +3221,6 @@ static inline void show_mem(void) extern long si_mem_available(void); extern void si_meminfo(struct sysinfo * val); extern void si_meminfo_node(struct sysinfo *val, int nid); -#ifdef __HAVE_ARCH_RESERVED_KERNEL_PAGES -extern unsigned long arch_reserved_kernel_pages(void); -#endif extern __printf(3, 4) void warn_alloc(gfp_t gfp_mask, nodemask_t *nodemask, const char *fmt, ...); diff --git a/mm/mm_init.c b/mm/mm_init.c index 9ed4b9e77c4a..370a057dae97 100644 --- a/mm/mm_init.c +++ b/mm/mm_init.c @@ -2383,17 +2383,6 @@ void __init page_alloc_init_late(void) page_alloc_sysctl_init(); } -#ifndef __HAVE_ARCH_RESERVED_KERNEL_PAGES -/* - * Returns the number of pages that arch has reserved but - * is not known to alloc_large_system_hash(). - */ -static unsigned long __init arch_reserved_kernel_pages(void) -{ - return 0; -} -#endif - /* * Adaptive scale is meant to reduce sizes of hash tables on large memory * machines. As memory size is increased the scale is also increased but at @@ -2436,7 +2425,6 @@ void *__init alloc_large_system_hash(const char *tablename, if (!numentries) { /* round applicable memory size up to nearest megabyte */ numentries = nr_kernel_pages; - numentries -= arch_reserved_kernel_pages(); /* It isn't necessary when PAGE_SIZE >= 1MB */ if (PAGE_SIZE < SZ_1M)