From: Kefeng Wang <wangkefeng.wang@huawei.com>
To: Luis Chamberlain <mcgrof@kernel.org>, <akpm@linux-foundation.org>,
<jhubbard@nvidia.com>, <vbabka@suse.cz>, <mgorman@suse.de>,
<linux-mm@kvack.org>
Cc: <linux-kernel@vger.kernel.org>, <dave@stgolabs.net>,
<p.raghav@samsung.com>, <da.gomez@samsung.com>
Subject: Re: [PATCH 1/3] mm/show_mem: simplify ifdef on si_meminfo_node()
Date: Thu, 14 Mar 2024 09:13:51 +0800 [thread overview]
Message-ID: <e59c7b3a-3763-4ee0-96d9-6018e1ab0904@huawei.com> (raw)
In-Reply-To: <20240314005436.2962962-2-mcgrof@kernel.org>
On 2024/3/14 8:54, Luis Chamberlain wrote:
> There is an ifdef where the same exact values are used at
> the end, so remove the else and keep the same values for both
> conditions.
>
> Signed-off-by: Luis Chamberlain <mcgrof@kernel.org>
> ---
> mm/show_mem.c | 5 +----
> 1 file changed, 1 insertion(+), 4 deletions(-)
>
> diff --git a/mm/show_mem.c b/mm/show_mem.c
> index 8dcfafbd283c..529d2f9b6410 100644
> --- a/mm/show_mem.c
> +++ b/mm/show_mem.c
> @@ -108,12 +108,9 @@ void si_meminfo_node(struct sysinfo *val, int nid)
> free_highpages += zone_page_state(zone, NR_FREE_PAGES);
> }
> }
> +#endif
> val->totalhigh = managed_highpages;
> val->freehigh = free_highpages;
> -#else
> - val->totalhigh = managed_highpages;
> - val->freehigh = free_highpages;
> -#endif
> val->mem_unit = PAGE_SIZE;
> }
> #endif
More cleanup?
diff --git a/mm/show_mem.c b/mm/show_mem.c
index 8dcfafbd283c..44dd6d6e9488 100644
--- a/mm/show_mem.c
+++ b/mm/show_mem.c
@@ -94,26 +94,21 @@ void si_meminfo_node(struct sysinfo *val, int nid)
unsigned long free_highpages = 0;
pg_data_t *pgdat = NODE_DATA(nid);
- for (zone_type = 0; zone_type < MAX_NR_ZONES; zone_type++)
- managed_pages +=
zone_managed_pages(&pgdat->node_zones[zone_type]);
- val->totalram = managed_pages;
- val->sharedram = node_page_state(pgdat, NR_SHMEM);
- val->freeram = sum_zone_node_page_state(nid, NR_FREE_PAGES);
-#ifdef CONFIG_HIGHMEM
for (zone_type = 0; zone_type < MAX_NR_ZONES; zone_type++) {
struct zone *zone = &pgdat->node_zones[zone_type];
+ managed_pages += zone_managed_pages(zone);
if (is_highmem(zone)) {
managed_highpages += zone_managed_pages(zone);
free_highpages += zone_page_state(zone,
NR_FREE_PAGES);
}
}
+
+ val->totalram = managed_pages;
+ val->sharedram = node_page_state(pgdat, NR_SHMEM);
+ val->freeram = sum_zone_node_page_state(nid, NR_FREE_PAGES);
val->totalhigh = managed_highpages;
val->freehigh = free_highpages;
-#else
- val->totalhigh = managed_highpages;
- val->freehigh = free_highpages;
-#endif
val->mem_unit = PAGE_SIZE;
}
next prev parent reply other threads:[~2024-03-14 1:14 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-03-14 0:54 [PATCH 0/3] mm: random cleanups Luis Chamberlain
2024-03-14 0:54 ` [PATCH 1/3] mm/show_mem: simplify ifdef on si_meminfo_node() Luis Chamberlain
2024-03-14 1:13 ` Kefeng Wang [this message]
2024-03-14 0:54 ` [PATCH 2/3] mm/compaction: add and use for_each_populated_zone_pgdat() helper Luis Chamberlain
2024-03-14 7:19 ` Baolin Wang
2024-03-15 5:38 ` Luis Chamberlain
2024-03-15 9:39 ` Baolin Wang
2024-03-15 11:09 ` Vlastimil Babka
2024-03-15 17:48 ` Luis Chamberlain
2024-03-14 11:40 ` kernel test robot
2024-03-14 0:54 ` [PATCH 3/3] mm/vmstat: simplfy extfrag_show_print with fragmentation_index() Luis Chamberlain
2024-03-15 11:13 ` Vlastimil Babka
2024-03-15 14:36 ` Davidlohr Bueso
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=e59c7b3a-3763-4ee0-96d9-6018e1ab0904@huawei.com \
--to=wangkefeng.wang@huawei.com \
--cc=akpm@linux-foundation.org \
--cc=da.gomez@samsung.com \
--cc=dave@stgolabs.net \
--cc=jhubbard@nvidia.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mcgrof@kernel.org \
--cc=mgorman@suse.de \
--cc=p.raghav@samsung.com \
--cc=vbabka@suse.cz \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox