From patchwork Tue Mar 24 14:22:25 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Baoquan He X-Patchwork-Id: 11455611 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id B394D159A for ; Tue, 24 Mar 2020 14:22:47 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 76FA22078A for ; Tue, 24 Mar 2020 14:22:47 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="hzAkbaXb" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 76FA22078A Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id ACDFC6B0003; Tue, 24 Mar 2020 10:22:46 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id A7ED26B0005; Tue, 24 Mar 2020 10:22:46 -0400 (EDT) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 9949D6B0007; Tue, 24 Mar 2020 10:22:46 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0207.hostedemail.com [216.40.44.207]) by kanga.kvack.org (Postfix) with ESMTP id 7ED4D6B0003 for ; Tue, 24 Mar 2020 10:22:46 -0400 (EDT) Received: from smtpin01.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 6908A12F22 for ; Tue, 24 Mar 2020 14:22:46 +0000 (UTC) X-FDA: 76630471932.01.dogs84_6f7d88404a052 X-Spam-Summary: 1,0,0,,d41d8cd98f00b204,bhe@redhat.com,,RULES_HIT:30012:30051:30054:30070,0,RBL:63.128.21.74:@redhat.com:.lbl8.mailshell.net-62.18.0.100 64.10.201.10,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:ft,MSBL:0,DNSBL:neutral,Custom_rules:0:0:0,LFtime:24,LUA_SUMMARY:none X-HE-Tag: dogs84_6f7d88404a052 X-Filterd-Recvd-Size: 4336 Received: from us-smtp-delivery-74.mimecast.com (us-smtp-delivery-74.mimecast.com [63.128.21.74]) by imf12.hostedemail.com (Postfix) with ESMTP for ; Tue, 24 Mar 2020 14:22:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1585059765; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:in-reply-to:in-reply-to:references:references; bh=26MBqTIy3VM6rKEvhuSVZBdiFAMRZ0dKsv4z+LdLChM=; b=hzAkbaXbpFljmS2fqeu8i1vs2fS/Y6UQD8I2pp5BpyNiunpVUoVhhzeuIQGOkktSbT32At fDjinS/HZJ1/ataEh2lQHrf8xXWDkNaZ5dB3ZH0UrLl0nvWv88aa4c95ur3EeM+r6uRLWV BjizP/KJthdom7y/nKbiql240P0mSWM= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-384-Tuqqbt2YPQSierum3NSpzQ-1; Tue, 24 Mar 2020 10:22:41 -0400 X-MC-Unique: Tuqqbt2YPQSierum3NSpzQ-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 7B93D10CE786; Tue, 24 Mar 2020 14:22:39 +0000 (UTC) Received: from MiWiFi-R3L-srv.redhat.com (ovpn-12-69.pek2.redhat.com [10.72.12.69]) by smtp.corp.redhat.com (Postfix) with ESMTP id A869F5C241; Tue, 24 Mar 2020 14:22:35 +0000 (UTC) From: Baoquan He To: linux-kernel@vger.kernel.org Cc: linux-mm@kvack.org, akpm@linux-foundation.org, iamjoonsoo.kim@lge.com, hannes@cmpxchg.org, mhocko@kernel.org, vbabka@suse.cz, bhe@redhat.com Subject: [PATCH 1/5] mm/page_alloc.c: only tune sysctl_lowmem_reserve_ratio value once when changing it Date: Tue, 24 Mar 2020 22:22:25 +0800 Message-Id: <20200324142229.12028-2-bhe@redhat.com> In-Reply-To: <20200324142229.12028-1-bhe@redhat.com> References: <20200324142229.12028-1-bhe@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 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: When people write to /proc/sys/vm/lowmem_reserve_ratio to change sysctl_lowmem_reserve_ratio[], setup_per_zone_lowmem_reserve() is called to recalculate all ->lowmem_reserve[] for each zone of all nodes as below: static void setup_per_zone_lowmem_reserve(void) { ... for_each_online_pgdat(pgdat) { for (j = 0; j < MAX_NR_ZONES; j++) { ... while (idx) { ... if (sysctl_lowmem_reserve_ratio[idx] < 1) { sysctl_lowmem_reserve_ratio[idx] = 0; lower_zone->lowmem_reserve[j] = 0; } else { ... } } } } Meanwhile, here, sysctl_lowmem_reserve_ratio[idx] will be tuned if its value is smaller than '1'. As we know, sysctl_lowmem_reserve_ratio[] is set for zone without regarding to which node it belongs to. That means the tuning will be done on all nodes, even though it has been done in the first node. And the tuning will be done too even when init_per_zone_wmark_min() calls setup_per_zone_lowmem_reserve(), where actually nobody tries to change sysctl_lowmem_reserve_ratio[]. So now move the tuning into lowmem_reserve_ratio_sysctl_handler(), to make code logic more reasonable. Signed-off-by: Baoquan He --- mm/page_alloc.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/mm/page_alloc.c b/mm/page_alloc.c index ca1453204e66..c0c788798d8b 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -7840,8 +7840,7 @@ static void setup_per_zone_lowmem_reserve(void) idx--; lower_zone = pgdat->node_zones + idx; - if (sysctl_lowmem_reserve_ratio[idx] < 1) { - sysctl_lowmem_reserve_ratio[idx] = 0; + if (!sysctl_lowmem_reserve_ratio[idx]) { lower_zone->lowmem_reserve[j] = 0; } else { lower_zone->lowmem_reserve[j] = @@ -8106,7 +8105,15 @@ int sysctl_min_slab_ratio_sysctl_handler(struct ctl_table *table, int write, int lowmem_reserve_ratio_sysctl_handler(struct ctl_table *table, int write, void __user *buffer, size_t *length, loff_t *ppos) { + int i; + proc_dointvec_minmax(table, write, buffer, length, ppos); + + for (i = 0; i < MAX_NR_ZONES; i++) { + if (sysctl_lowmem_reserve_ratio[i] < 1) + sysctl_lowmem_reserve_ratio[i] = 0; + } + setup_per_zone_lowmem_reserve(); return 0; } From patchwork Tue Mar 24 14:22:26 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Baoquan He X-Patchwork-Id: 11455615 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 60DB21667 for ; Tue, 24 Mar 2020 14:22:50 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 260452080C for ; Tue, 24 Mar 2020 14:22:50 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="ZRSjoqSA" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 260452080C Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 4666E6B0005; Tue, 24 Mar 2020 10:22:49 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 4169B6B0007; Tue, 24 Mar 2020 10:22:49 -0400 (EDT) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 353F86B0008; Tue, 24 Mar 2020 10:22:49 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0115.hostedemail.com [216.40.44.115]) by kanga.kvack.org (Postfix) with ESMTP id 1B5446B0005 for ; Tue, 24 Mar 2020 10:22:49 -0400 (EDT) Received: from smtpin12.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id EB99A87D3 for ; Tue, 24 Mar 2020 14:22:48 +0000 (UTC) X-FDA: 76630472016.12.rail13_6fd68a50b712b X-Spam-Summary: 1,0,0,,d41d8cd98f00b204,bhe@redhat.com,,RULES_HIT:30054:30070:30090,0,RBL:63.128.21.74:@redhat.com:.lbl8.mailshell.net-64.10.201.10 62.18.0.100,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:ft,MSBL:0,DNSBL:neutral,Custom_rules:0:0:0,LFtime:23,LUA_SUMMARY:none X-HE-Tag: rail13_6fd68a50b712b X-Filterd-Recvd-Size: 3952 Received: from us-smtp-delivery-74.mimecast.com (us-smtp-delivery-74.mimecast.com [63.128.21.74]) by imf20.hostedemail.com (Postfix) with ESMTP for ; Tue, 24 Mar 2020 14:22:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1585059767; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:in-reply-to:in-reply-to:references:references; bh=l3Lz3/NpN+EM4WUox3xNHgHxlnh2gL9sfw46cjDTFYo=; b=ZRSjoqSA6eoOr6E6lFp9NcMUatJvixZK2aHPRhfcnfgMYugkHllDV+48JM6MQpRPA4M7xr 13HTJtGxlPHhiQxdcKILS2m07zcUYCFAJ5YScsDn1DSBFXtKL7tMmG9JDfmqguE6qtRK3f PtUNqwdOQy2Q99kn5kOBLIRBcGi922o= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-480-jkE5FCHvPOSeM9Tz3mtRwQ-1; Tue, 24 Mar 2020 10:22:44 -0400 X-MC-Unique: jkE5FCHvPOSeM9Tz3mtRwQ-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id ACD3A800D5E; Tue, 24 Mar 2020 14:22:42 +0000 (UTC) Received: from MiWiFi-R3L-srv.redhat.com (ovpn-12-69.pek2.redhat.com [10.72.12.69]) by smtp.corp.redhat.com (Postfix) with ESMTP id 03AFD5C1B2; Tue, 24 Mar 2020 14:22:39 +0000 (UTC) From: Baoquan He To: linux-kernel@vger.kernel.org Cc: linux-mm@kvack.org, akpm@linux-foundation.org, iamjoonsoo.kim@lge.com, hannes@cmpxchg.org, mhocko@kernel.org, vbabka@suse.cz, bhe@redhat.com Subject: [PATCH 2/5] mm/page_alloc.c: clear out zone->lowmem_reserve[] if the zone is empty Date: Tue, 24 Mar 2020 22:22:26 +0800 Message-Id: <20200324142229.12028-3-bhe@redhat.com> In-Reply-To: <20200324142229.12028-1-bhe@redhat.com> References: <20200324142229.12028-1-bhe@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 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: When requesting memory allocation from a specific zone is not satisfied, it will fall to lower zone to try allocating memory. In this case, lower zone's ->lowmem_reserve[] will help protect its own memory resource. The higher the relevant ->lowmem_reserve[] is, the harder the upper zone can get memory from this lower zone. However, this protection mechanism should be applied to populated zone, but not an empty zone. So filling ->lowmem_reserve[] for empty zone is not necessary, and may mislead people that it's valid data in that zone. Node 2, zone DMA pages free 0 min 0 low 0 high 0 spanned 0 present 0 managed 0 protection: (0, 0, 1024, 1024) Node 2, zone DMA32 pages free 0 min 0 low 0 high 0 spanned 0 present 0 managed 0 protection: (0, 0, 1024, 1024) Node 2, zone Normal per-node stats nr_inactive_anon 0 nr_active_anon 143 nr_inactive_file 0 nr_active_file 0 nr_unevictable 0 nr_slab_reclaimable 45 nr_slab_unreclaimable 254 Here clear out zone->lowmem_reserve[] if zone is empty. Signed-off-by: Baoquan He --- mm/page_alloc.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/mm/page_alloc.c b/mm/page_alloc.c index c0c788798d8b..138a56c0f48f 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -7840,8 +7840,10 @@ static void setup_per_zone_lowmem_reserve(void) idx--; lower_zone = pgdat->node_zones + idx; - if (!sysctl_lowmem_reserve_ratio[idx]) { + if (!sysctl_lowmem_reserve_ratio[idx] || + !zone_managed_pages(lower_zone)) { lower_zone->lowmem_reserve[j] = 0; + continue; } else { lower_zone->lowmem_reserve[j] = managed_pages / sysctl_lowmem_reserve_ratio[idx]; From patchwork Tue Mar 24 14:22:27 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Baoquan He X-Patchwork-Id: 11455617 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id A3C691667 for ; Tue, 24 Mar 2020 14:22:53 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 727412080C for ; Tue, 24 Mar 2020 14:22:53 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="gTWZq+w8" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 727412080C Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 750B86B0007; Tue, 24 Mar 2020 10:22:52 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 6D6446B0008; Tue, 24 Mar 2020 10:22:52 -0400 (EDT) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 5EC146B000A; Tue, 24 Mar 2020 10:22:52 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0091.hostedemail.com [216.40.44.91]) by kanga.kvack.org (Postfix) with ESMTP id 46F156B0007 for ; Tue, 24 Mar 2020 10:22:52 -0400 (EDT) Received: from smtpin08.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 2FB518248047 for ; Tue, 24 Mar 2020 14:22:52 +0000 (UTC) X-FDA: 76630472184.08.burn35_705341e6d5c15 X-Spam-Summary: 1,0,0,,d41d8cd98f00b204,bhe@redhat.com,,RULES_HIT:30054:30056:30075,0,RBL:63.128.21.74:@redhat.com:.lbl8.mailshell.net-64.10.201.10 62.18.0.100,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:ft,MSBL:0,DNSBL:neutral,Custom_rules:0:0:0,LFtime:23,LUA_SUMMARY:none X-HE-Tag: burn35_705341e6d5c15 X-Filterd-Recvd-Size: 3264 Received: from us-smtp-delivery-74.mimecast.com (us-smtp-delivery-74.mimecast.com [63.128.21.74]) by imf34.hostedemail.com (Postfix) with ESMTP for ; Tue, 24 Mar 2020 14:22:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1585059771; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:in-reply-to:in-reply-to:references:references; bh=O7EMuney8gEiJb0wo0noEWCYTocW+RKYyaMoY0nHgzo=; b=gTWZq+w8Zaf5Tg+wbeGPprOkdX2xsTWQvYOKgdTW2KbZ2YoZq4gOyxhxv1CSLdrI8j4Lel 1FTFEj+oaTe+eQyUMIPlU2O/69KMz99DGskh7RaWJf9O6N5BaJZc5dS6l6AmHQar8h+R4X CqUotSKuUQKP1in4ZXpYWR+t4uPYJFI= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-26-hV_BtkOTODC5p6M5PaLp6A-1; Tue, 24 Mar 2020 10:22:49 -0400 X-MC-Unique: hV_BtkOTODC5p6M5PaLp6A-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 39ED4100550D; Tue, 24 Mar 2020 14:22:48 +0000 (UTC) Received: from MiWiFi-R3L-srv.redhat.com (ovpn-12-69.pek2.redhat.com [10.72.12.69]) by smtp.corp.redhat.com (Postfix) with ESMTP id 31EE35C241; Tue, 24 Mar 2020 14:22:42 +0000 (UTC) From: Baoquan He To: linux-kernel@vger.kernel.org Cc: linux-mm@kvack.org, akpm@linux-foundation.org, iamjoonsoo.kim@lge.com, hannes@cmpxchg.org, mhocko@kernel.org, vbabka@suse.cz, bhe@redhat.com Subject: [PATCH 3/5] mm/vmstat.c: do not show lowmem reserve protection information of empty zone Date: Tue, 24 Mar 2020 22:22:27 +0800 Message-Id: <20200324142229.12028-4-bhe@redhat.com> In-Reply-To: <20200324142229.12028-1-bhe@redhat.com> References: <20200324142229.12028-1-bhe@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 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: Because the lowmem reserve protection of a zone can't tell anything if the zone is empty, except of adding one more line in /proc/zoneinfo. Let's remove it from that zone's showing. Signed-off-by: Baoquan He --- mm/vmstat.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/mm/vmstat.c b/mm/vmstat.c index 96d21a792b57..6fd1407f4632 100644 --- a/mm/vmstat.c +++ b/mm/vmstat.c @@ -1590,6 +1590,12 @@ static void zoneinfo_show_print(struct seq_file *m, pg_data_t *pgdat, zone->present_pages, zone_managed_pages(zone)); + /* If unpopulated, no other information is useful */ + if (!populated_zone(zone)) { + seq_putc(m, '\n'); + return; + } + seq_printf(m, "\n protection: (%ld", zone->lowmem_reserve[0]); @@ -1597,12 +1603,6 @@ static void zoneinfo_show_print(struct seq_file *m, pg_data_t *pgdat, seq_printf(m, ", %ld", zone->lowmem_reserve[i]); seq_putc(m, ')'); - /* If unpopulated, no other information is useful */ - if (!populated_zone(zone)) { - seq_putc(m, '\n'); - return; - } - for (i = 0; i < NR_VM_ZONE_STAT_ITEMS; i++) seq_printf(m, "\n %-12s %lu", zone_stat_name(i), zone_page_state(zone, i)); From patchwork Tue Mar 24 14:22:28 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Baoquan He X-Patchwork-Id: 11455621 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id A10F31667 for ; Tue, 24 Mar 2020 14:23:01 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 652B820788 for ; Tue, 24 Mar 2020 14:23:01 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="NSZJf3Cw" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 652B820788 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id F16A96B000A; Tue, 24 Mar 2020 10:22:58 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id E9E306B000C; Tue, 24 Mar 2020 10:22:58 -0400 (EDT) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D18A76B000D; Tue, 24 Mar 2020 10:22:58 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0036.hostedemail.com [216.40.44.36]) by kanga.kvack.org (Postfix) with ESMTP id BAA796B000A for ; Tue, 24 Mar 2020 10:22:58 -0400 (EDT) Received: from smtpin07.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 8E5D71807A209 for ; Tue, 24 Mar 2020 14:22:58 +0000 (UTC) X-FDA: 76630472436.07.horse52_713fe7d07fa3c X-Spam-Summary: 1,0,0,,d41d8cd98f00b204,bhe@redhat.com,,RULES_HIT:30029:30054:30056,0,RBL:63.128.21.74:@redhat.com:.lbl8.mailshell.net-64.10.201.10 62.18.0.100,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:ft,MSBL:0,DNSBL:neutral,Custom_rules:0:0:0,LFtime:1,LUA_SUMMARY:none X-HE-Tag: horse52_713fe7d07fa3c X-Filterd-Recvd-Size: 4316 Received: from us-smtp-delivery-74.mimecast.com (us-smtp-delivery-74.mimecast.com [63.128.21.74]) by imf03.hostedemail.com (Postfix) with ESMTP for ; Tue, 24 Mar 2020 14:22:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1585059777; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:in-reply-to:in-reply-to:references:references; bh=+TmMAyQNdrsWtGKQJAPznO269BAHbZfbwCisH4kJOrg=; b=NSZJf3CwGxIxIoZShzyIuicCkBiq6jCStpsIqpUQMD3ouqtyTHCD9FiN8v9Xd9ZgFZM2eM ts//bW3UeVJLGTkpwk8thqV2OYrVF5IUUhr+bOaJ9u0LztrIpSUF4871jm9Kz0P9BdTO9B FqE8BDc2Ls15a/uQq2S0R/j1LolgoJY= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-384-ii-GG5eyOzmxWs7MUxp1FA-1; Tue, 24 Mar 2020 10:22:53 -0400 X-MC-Unique: ii-GG5eyOzmxWs7MUxp1FA-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 28FE1800D5E; Tue, 24 Mar 2020 14:22:52 +0000 (UTC) Received: from MiWiFi-R3L-srv.redhat.com (ovpn-12-69.pek2.redhat.com [10.72.12.69]) by smtp.corp.redhat.com (Postfix) with ESMTP id B53C05C557; Tue, 24 Mar 2020 14:22:48 +0000 (UTC) From: Baoquan He To: linux-kernel@vger.kernel.org Cc: linux-mm@kvack.org, akpm@linux-foundation.org, iamjoonsoo.kim@lge.com, hannes@cmpxchg.org, mhocko@kernel.org, vbabka@suse.cz, bhe@redhat.com Subject: [PATCH 4/5] mm/vmstat.c: move the per-node stats to the front of /proc/zoneinfo Date: Tue, 24 Mar 2020 22:22:28 +0800 Message-Id: <20200324142229.12028-5-bhe@redhat.com> In-Reply-To: <20200324142229.12028-1-bhe@redhat.com> References: <20200324142229.12028-1-bhe@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 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: This moving makes the layout of /proc/zoneinfo more sensible. And there are 4 zones at most currently, it doesn't need to scroll down much to get to the 1st populated zone, even though the 1st populated zone is MOVABLE zone. Node 2, per-node stats nr_inactive_anon 48 nr_active_anon 15454 ... nr_foll_pin_acquired 0 nr_foll_pin_released 0 Node 2, zone DMA pages free 0 min 0 low 0 high 0 spanned 0 present 0 managed 0 Node 2, zone DMA32 pages free 0 min 0 low 0 high 0 spanned 0 present 0 managed 0 Node 2, zone Normal pages free 0 min 0 low 0 high 0 spanned 0 present 0 managed 0 Node 2, zone Movable pages free 196346 min 3540 ... managed 262144 Signed-off-by: Baoquan He --- mm/vmstat.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/mm/vmstat.c b/mm/vmstat.c index 6fd1407f4632..4bbf9be786da 100644 --- a/mm/vmstat.c +++ b/mm/vmstat.c @@ -1567,13 +1567,6 @@ static void zoneinfo_show_print(struct seq_file *m, pg_data_t *pgdat, { int i; seq_printf(m, "Node %d, zone %8s", pgdat->node_id, zone->name); - if (is_zone_first_populated(pgdat, zone)) { - seq_printf(m, "\n per-node stats"); - for (i = 0; i < NR_VM_NODE_STAT_ITEMS; i++) { - seq_printf(m, "\n %-12s %lu", node_stat_name(i), - node_page_state(pgdat, i)); - } - } seq_printf(m, "\n pages free %lu" "\n min %lu" @@ -1648,7 +1641,18 @@ static void zoneinfo_show_print(struct seq_file *m, pg_data_t *pgdat, */ static int zoneinfo_show(struct seq_file *m, void *arg) { + int i; pg_data_t *pgdat = (pg_data_t *)arg; + + if (node_state(pgdat->node_id, N_MEMORY)) { + seq_printf(m, "Node %d, per-node stats", pgdat->node_id); + for (i = 0; i < NR_VM_NODE_STAT_ITEMS; i++) { + seq_printf(m, "\n %-12s %lu", node_stat_name(i), + node_page_state(pgdat, i)); + } + seq_putc(m, '\n'); + } + walk_zones_in_node(m, pgdat, false, false, zoneinfo_show_print); return 0; } From patchwork Tue Mar 24 14:22:29 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Baoquan He X-Patchwork-Id: 11455623 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id D7C9C1667 for ; Tue, 24 Mar 2020 14:23:04 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id A5F3C20788 for ; Tue, 24 Mar 2020 14:23:04 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="QzQ13DR7" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A5F3C20788 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 74C006B000C; Tue, 24 Mar 2020 10:23:03 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 6FD3D6B000D; Tue, 24 Mar 2020 10:23:03 -0400 (EDT) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 639926B000E; Tue, 24 Mar 2020 10:23:03 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0191.hostedemail.com [216.40.44.191]) by kanga.kvack.org (Postfix) with ESMTP id 4781F6B000C for ; Tue, 24 Mar 2020 10:23:03 -0400 (EDT) Received: from smtpin18.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id 14EE01821380A for ; Tue, 24 Mar 2020 14:23:03 +0000 (UTC) X-FDA: 76630472646.18.fang34_71e4dceefe23a X-Spam-Summary: 1,0,0,,d41d8cd98f00b204,bhe@redhat.com,,RULES_HIT:30012:30054,0,RBL:63.128.21.74:@redhat.com:.lbl8.mailshell.net-64.10.201.10 62.18.0.100,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:ft,MSBL:0,DNSBL:neutral,Custom_rules:0:0:0,LFtime:0,LUA_SUMMARY:none X-HE-Tag: fang34_71e4dceefe23a X-Filterd-Recvd-Size: 2766 Received: from us-smtp-delivery-74.mimecast.com (us-smtp-delivery-74.mimecast.com [63.128.21.74]) by imf07.hostedemail.com (Postfix) with ESMTP for ; Tue, 24 Mar 2020 14:23:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1585059781; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:in-reply-to:in-reply-to:references:references; bh=zQWZEZmUvi4qR88INJygABxgVNbImLNogNiP/46ZYIU=; b=QzQ13DR7dqhfTjW824W6IBwEqI6G0yiMd+SM+nnkWojdwdEU9Q6UkFRsqoSiktu7oNwtrO WjwUgz2SMx2Zh+eT7OSgazpXF3rBJXOFYJ7oXNNn/Ev0sCX6vbbdy37pR5KUf8oNYKIjOY 8PLQyvEKDWekRCuA5Mhe4tuHtaOU1S8= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-306-QyoWTaspMVCP-mDcxPeR4Q-1; Tue, 24 Mar 2020 10:22:56 -0400 X-MC-Unique: QyoWTaspMVCP-mDcxPeR4Q-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 7B40B8024DB; Tue, 24 Mar 2020 14:22:55 +0000 (UTC) Received: from MiWiFi-R3L-srv.redhat.com (ovpn-12-69.pek2.redhat.com [10.72.12.69]) by smtp.corp.redhat.com (Postfix) with ESMTP id A3F835C241; Tue, 24 Mar 2020 14:22:52 +0000 (UTC) From: Baoquan He To: linux-kernel@vger.kernel.org Cc: linux-mm@kvack.org, akpm@linux-foundation.org, iamjoonsoo.kim@lge.com, hannes@cmpxchg.org, mhocko@kernel.org, vbabka@suse.cz, bhe@redhat.com Subject: [PATCH 5/5] mm/vmstat.c: remove the useless code Date: Tue, 24 Mar 2020 22:22:29 +0800 Message-Id: <20200324142229.12028-6-bhe@redhat.com> In-Reply-To: <20200324142229.12028-1-bhe@redhat.com> References: <20200324142229.12028-1-bhe@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 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: No one calls is_zone_first_populated(), remove it. Signed-off-by: Baoquan He --- mm/vmstat.c | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/mm/vmstat.c b/mm/vmstat.c index 4bbf9be786da..7097eb99f30d 100644 --- a/mm/vmstat.c +++ b/mm/vmstat.c @@ -1548,20 +1548,6 @@ static const struct seq_operations pagetypeinfo_op = { .show = pagetypeinfo_show, }; -static bool is_zone_first_populated(pg_data_t *pgdat, struct zone *zone) -{ - int zid; - - for (zid = 0; zid < MAX_NR_ZONES; zid++) { - struct zone *compare = &pgdat->node_zones[zid]; - - if (populated_zone(compare)) - return zone == compare; - } - - return false; -} - static void zoneinfo_show_print(struct seq_file *m, pg_data_t *pgdat, struct zone *zone) {