From patchwork Tue Mar 26 06:11:32 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Baoquan He X-Patchwork-Id: 13603610 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 8570BC54E67 for ; Tue, 26 Mar 2024 06:12:07 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 10BDA6B0095; Tue, 26 Mar 2024 02:12:07 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 0256A6B0098; Tue, 26 Mar 2024 02:12:06 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id CF2976B0099; Tue, 26 Mar 2024 02:12:06 -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 AAC7C6B0095 for ; Tue, 26 Mar 2024 02:12:06 -0400 (EDT) Received: from smtpin21.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 3E81912098D for ; Tue, 26 Mar 2024 06:12:06 +0000 (UTC) X-FDA: 81938169852.21.87E88ED Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by imf24.hostedemail.com (Postfix) with ESMTP id 45B4518000C for ; Tue, 26 Mar 2024 06:12:04 +0000 (UTC) Authentication-Results: imf24.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=ePEPeDDt; spf=pass (imf24.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=1711433524; 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=GXw1e1oHgEN9rl4kfr56ThO6wyh2Sq3AhDPjDs68OcE=; b=0YJfsTTO41ch2jdtri/ldTAhAIMUf3PVfgUKgyYarMqGAuNA+JW7WS7h8i9B0fOf2jcQOu gjBOkVegtPI9zrg9BaBGcz9Oodfgg/cIe7IEhJ4Ikw6Cm9vK2W2bnowBWxixB8GMEHhxC7 9zYGb0w8/O/kx7SmI2KkVkODqAp+Sx8= ARC-Authentication-Results: i=1; imf24.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=ePEPeDDt; spf=pass (imf24.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=1711433524; a=rsa-sha256; cv=none; b=wp3/35g7CURpV8aIFqxVwBH3NIKveRhg+xWF5jUNwXvVXk9Ed/JgEqWoH+BiJUhSXlB6AI 69yCLy76swvyUtJGBXY9WR4HjHJl8ulVk3EsubT4Y62XA5pb1plRQzgwuGDg1aE9R0L/ub MTRsV8tXymWi9lMduNqlBiH5/pfn/Ko= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1711433523; 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=GXw1e1oHgEN9rl4kfr56ThO6wyh2Sq3AhDPjDs68OcE=; b=ePEPeDDtfxPrsVP/KsYs7LLJnIirCQTeDO4YMVbe4XJRIDvUEuxipgARVo1cr0XFw0H+ue pCoXznKBNwNe/6DrynxTJjrocIDZr8m6clfyAen9RK1Sm2GdRM6noavvXV4IDcVB6j8nLw rFYxh8aJiE6lWFzbeoWyQlIcCIP+m8w= 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-683-8s9IBzaPO0OZyDKnS2pGBQ-1; Tue, 26 Mar 2024 02:12:00 -0400 X-MC-Unique: 8s9IBzaPO0OZyDKnS2pGBQ-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (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 BA3BE101A552; Tue, 26 Mar 2024 06:11:59 +0000 (UTC) Received: from MiWiFi-R3L-srv.redhat.com (unknown [10.72.116.12]) by smtp.corp.redhat.com (Postfix) with ESMTP id 895FD1074E; Tue, 26 Mar 2024 06:11:57 +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 6/7] mm/page_alloc.c: don't show protection in zone's ->lowmem_reserve[] for empty zone Date: Tue, 26 Mar 2024 14:11:32 +0800 Message-ID: <20240326061134.1055295-7-bhe@redhat.com> In-Reply-To: <20240326061134.1055295-1-bhe@redhat.com> References: <20240326061134.1055295-1-bhe@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.5 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-type: text/plain X-Rspamd-Queue-Id: 45B4518000C X-Rspam-User: X-Stat-Signature: efi7r3bbqzf9ychzax7esas4pcb3ufmu X-Rspamd-Server: rspam01 X-HE-Tag: 1711433524-837889 X-HE-Meta: U2FsdGVkX194EA6DFx32J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T2CMastDPH32of6FvAhNzRgQ5k9kb7xIgTtr7PtT30jJMF+3mQOX3nDqhA0uyY0Q4za0+6u4jVBHTWRJFn3e7/TADwskT0lTQYkZU98PoRFZY8KA== 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: On one node, for lower zone's ->lowmem_reserve[], it will show how much memory is reserved in this lower zone to avoid excessive page allocation from the relevant higher zone's fallback allocation. However, currently lower zone's lowmem_reserve[] element will be filled even though the relevant higher zone is empty. That doesnt' make sense and can cause confusion. E.g on node 0 of one system as below, it has zone DMA/DMA32/NORMAL/MOVABLE/DEVICE, among them zone MOVABLE/DEVICE are the highest and both are empty. In zone DMA/DMA32's protection array, we can see that it has value for zone MOVABLE and DEVICE. Node 0, zone DMA ...... pages free 2816 boost 0 min 7 low 10 high 13 spanned 4095 present 3998 managed 3840 cma 0 protection: (0, 1582, 23716, 23716, 23716) ...... Node 0, zone DMA32 pages free 403269 boost 0 min 753 low 1158 high 1563 spanned 1044480 present 487039 managed 405070 cma 0 protection: (0, 0, 22134, 22134, 22134) ...... Node 0, zone Normal pages free 5423879 boost 0 min 10539 low 16205 high 21871 spanned 5767168 present 5767168 managed 5666438 cma 0 protection: (0, 0, 0, 0, 0) ...... Node 0, zone Movable pages free 0 boost 0 min 32 low 32 high 32 spanned 0 present 0 managed 0 cma 0 protection: (0, 0, 0, 0, 0) Node 0, zone Device pages free 0 boost 0 min 0 low 0 high 0 spanned 0 present 0 managed 0 cma 0 protection: (0, 0, 0, 0, 0) Here, clear out the element value in lower zone's ->lowmem_reserve[] if the relevant higher zone is empty. And also replace space with tab in _deferred_grow_zone() Signed-off-by: Baoquan He --- mm/page_alloc.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/mm/page_alloc.c b/mm/page_alloc.c index fd2b49aed59e..ce1d12cf2ec7 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -332,7 +332,7 @@ static inline bool deferred_pages_enabled(void) static bool __ref _deferred_grow_zone(struct zone *zone, unsigned int order) { - return deferred_grow_zone(zone, order); + return deferred_grow_zone(zone, order); } #else static inline bool deferred_pages_enabled(void) @@ -5806,10 +5806,11 @@ static void setup_per_zone_lowmem_reserve(void) for (j = i + 1; j < MAX_NR_ZONES; j++) { struct zone *upper_zone = &pgdat->node_zones[j]; + bool empty = !zone_managed_pages(upper_zone); managed_pages += zone_managed_pages(upper_zone); - if (clear) + if (clear || empty) zone->lowmem_reserve[j] = 0; else zone->lowmem_reserve[j] = managed_pages / ratio;