Re: [PATCH v4 1/4] mm: reference totalram_pages and managed_pages once per function

From: Arun KS
Date: Mon Nov 12 2018 - 01:27:24 EST


Hello Matthew,

Thanks for reviewing.
On 2018-11-12 11:43, Matthew Wilcox wrote:
On Mon, Nov 12, 2018 at 11:37:46AM +0530, Arun KS wrote:
+++ b/arch/um/kernel/mem.c
@@ -51,8 +51,7 @@ void __init mem_init(void)

/* this will put all low memory onto the freelists */
memblock_free_all();
- max_low_pfn = totalram_pages;
- max_pfn = totalram_pages;
+ max_pfn = max_low_pfn = totalram_pages;

We don't normally do "a = b = c". How about:

max_low_pfn = totalram_pages;
- max_pfn = totalram_pages;
+ max_pfn = max_low_pfn;

Point taken. Will fix it.


+++ b/arch/x86/kernel/cpu/microcode/core.c
@@ -434,9 +434,10 @@ static ssize_t microcode_write(struct file *file, const char __user *buf,
size_t len, loff_t *ppos)
{
ssize_t ret = -EINVAL;
+ unsigned long totalram_pgs = totalram_pages;

Can't we use a better variable name here? Even nr_pages would look
better to me.

Looks better.

Regards,
Arun


+++ b/drivers/hv/hv_balloon.c
+ unsigned long totalram_pgs = totalram_pages;

Ditto

+++ b/fs/file_table.c
+ unsigned long totalram_pgs = totalram_pages;

... throughout, I guess.