Re: [PATCH] [16/21] HWPOISON: The high level memory error handlerin the VM v7

From: Daniel Walker
Date: Fri Sep 11 2009 - 16:57:44 EST


On Fri, 2009-09-11 at 21:33 +0200, Andi Kleen wrote:
> > The rest of your patches are totally clean, except this one .. It has
> > some warning, but one error in the second ifdef block above ..
>
> That's intentional, fixing it would require a bare , on a single line
> which would be far uglier what is there today. I refuse to make code
> ugly just to work around checkpatch.pl


Like the following is clean, and I don't see why it would work. Although
I only compile tested it.

--

Order the seq_printfs so they can more easily (and cleanly) be added
to and ifdef'ed.

Cc: npiggin@xxxxxxx
Cc: riel@xxxxxxxxxx
Cc: Andi Kleen <ak@xxxxxxxxxxxxxxx>
Cc: Rik van Riel <riel@xxxxxxxxxx>
Cc: Hidehiro Kawai <hidehiro.kawai.ez@xxxxxxxxxxx>
Signed-off-by: Daniel Walker <dwalker@xxxxxxxxxx>
---
fs/proc/meminfo.c | 83 +++++++++++++++++++++++++---------------------------
1 files changed, 40 insertions(+), 43 deletions(-)

diff --git a/fs/proc/meminfo.c b/fs/proc/meminfo.c
index 78faedc..8309f1a 100644
--- a/fs/proc/meminfo.c
+++ b/fs/proc/meminfo.c
@@ -65,41 +65,7 @@ static int meminfo_proc_show(struct seq_file *m, void *v)
"Active(file): %8lu kB\n"
"Inactive(file): %8lu kB\n"
"Unevictable: %8lu kB\n"
- "Mlocked: %8lu kB\n"
-#ifdef CONFIG_HIGHMEM
- "HighTotal: %8lu kB\n"
- "HighFree: %8lu kB\n"
- "LowTotal: %8lu kB\n"
- "LowFree: %8lu kB\n"
-#endif
-#ifndef CONFIG_MMU
- "MmapCopy: %8lu kB\n"
-#endif
- "SwapTotal: %8lu kB\n"
- "SwapFree: %8lu kB\n"
- "Dirty: %8lu kB\n"
- "Writeback: %8lu kB\n"
- "AnonPages: %8lu kB\n"
- "Mapped: %8lu kB\n"
- "Slab: %8lu kB\n"
- "SReclaimable: %8lu kB\n"
- "SUnreclaim: %8lu kB\n"
- "PageTables: %8lu kB\n"
-#ifdef CONFIG_QUICKLIST
- "Quicklists: %8lu kB\n"
-#endif
- "NFS_Unstable: %8lu kB\n"
- "Bounce: %8lu kB\n"
- "WritebackTmp: %8lu kB\n"
- "CommitLimit: %8lu kB\n"
- "Committed_AS: %8lu kB\n"
- "VmallocTotal: %8lu kB\n"
- "VmallocUsed: %8lu kB\n"
- "VmallocChunk: %8lu kB\n"
-#ifdef CONFIG_MEMORY_FAILURE
- "HardwareCorrupted: %8lu kB\n"
-#endif
- ,
+ "Mlocked: %8lu kB\n",
K(i.totalram),
K(i.freeram),
K(i.bufferram),
@@ -112,16 +78,35 @@ static int meminfo_proc_show(struct seq_file *m, void *v)
K(pages[LRU_ACTIVE_FILE]),
K(pages[LRU_INACTIVE_FILE]),
K(pages[LRU_UNEVICTABLE]),
- K(global_page_state(NR_MLOCK)),
+ K(global_page_state(NR_MLOCK)));
+
#ifdef CONFIG_HIGHMEM
+ seq_printf(m,
+ "HighTotal: %8lu kB\n"
+ "HighFree: %8lu kB\n"
+ "LowTotal: %8lu kB\n"
+ "LowFree: %8lu kB\n",
K(i.totalhigh),
K(i.freehigh),
K(i.totalram-i.totalhigh),
- K(i.freeram-i.freehigh),
+ K(i.freeram-i.freehigh));
#endif
#ifndef CONFIG_MMU
- K((unsigned long) atomic_long_read(&mmap_pages_allocated)),
+ seq_printf(m,
+ "MmapCopy: %8lu kB\n",
+ K((unsigned long) atomic_long_read(&mmap_pages_allocated)));
#endif
+ seq_printf(m,
+ "SwapTotal: %8lu kB\n"
+ "SwapFree: %8lu kB\n"
+ "Dirty: %8lu kB\n"
+ "Writeback: %8lu kB\n"
+ "AnonPages: %8lu kB\n"
+ "Mapped: %8lu kB\n"
+ "Slab: %8lu kB\n"
+ "SReclaimable: %8lu kB\n"
+ "SUnreclaim: %8lu kB\n"
+ "PageTables: %8lu kB\n",
K(i.totalswap),
K(i.freeswap),
K(global_page_state(NR_FILE_DIRTY)),
@@ -132,10 +117,21 @@ static int meminfo_proc_show(struct seq_file *m, void *v)
global_page_state(NR_SLAB_UNRECLAIMABLE)),
K(global_page_state(NR_SLAB_RECLAIMABLE)),
K(global_page_state(NR_SLAB_UNRECLAIMABLE)),
- K(global_page_state(NR_PAGETABLE)),
+ K(global_page_state(NR_PAGETABLE)));
#ifdef CONFIG_QUICKLIST
- K(quicklist_total_size()),
+ seq_printf(m,
+ "Quicklists: %8lu kB\n"
+ K(quicklist_total_size()));
#endif
+ seq_printf(m,
+ "NFS_Unstable: %8lu kB\n"
+ "Bounce: %8lu kB\n"
+ "WritebackTmp: %8lu kB\n"
+ "CommitLimit: %8lu kB\n"
+ "Committed_AS: %8lu kB\n"
+ "VmallocTotal: %8lu kB\n"
+ "VmallocUsed: %8lu kB\n"
+ "VmallocChunk: %8lu kB\n",
K(global_page_state(NR_UNSTABLE_NFS)),
K(global_page_state(NR_BOUNCE)),
K(global_page_state(NR_WRITEBACK_TEMP)),
@@ -143,11 +139,12 @@ static int meminfo_proc_show(struct seq_file *m, void *v)
K(committed),
(unsigned long)VMALLOC_TOTAL >> 10,
vmi.used >> 10,
- vmi.largest_chunk >> 10
+ vmi.largest_chunk >> 10);
#ifdef CONFIG_MEMORY_FAILURE
- ,atomic_long_read(&mce_bad_pages) << (PAGE_SHIFT - 10)
+ seq_printf(m,
+ "HardwareCorrupted: %8lu kB\n",
+ atomic_long_read(&mce_bad_pages) << (PAGE_SHIFT - 10));
#endif
- );

hugetlb_report_meminfo(m);

--
1.5.6.3



--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/