Skip to contentSkip to conversation

/fs/proc/meminfo.c: fix compilation error

PATCH In review Claudio Scordino 2 participants 3 messages Nov 3, 2011 – Nov 17, 2011

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 /fs/proc/meminfo.c: fix compilation error

Hi all,

the current mainline kernel gives a "directives may not be used inside a
macro argument" error message when compiled for the cris architecture.

The error is located in the /fs/proc/meminfo.c file.

The attached patch fixed this error.

Best regards,

Claudio Scordino

Subject: /fs/proc/meminfo.c: fix compilation error
From: Claudio Scordino <[email protected]>

Patch to fix the error message "directives may not be used inside a macro argument" which appears when the kernel is compiled for the cris architecture.

---
 fs/proc/meminfo.c |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)
fs/proc/meminfo.c +4 -3
index 5861741..80e4645 100644
@@ -131,12 +131,13 @@ static int meminfo_proc_show(struct seq_file *m, void *v)
 		K(i.freeswap),
 		K(global_page_state(NR_FILE_DIRTY)),
 		K(global_page_state(NR_WRITEBACK)),
-		K(global_page_state(NR_ANON_PAGES)
 #ifdef CONFIG_TRANSPARENT_HUGEPAGE
+		K(global_page_state(NR_ANON_PAGES)
 		  + global_page_state(NR_ANON_TRANSPARENT_HUGEPAGES) *
-		  HPAGE_PMD_NR
+		  HPAGE_PMD_NR),
+#else
+		K(global_page_state(NR_ANON_PAGES)),
 #endif
-		  ),
 		K(global_page_state(NR_FILE_MAPPED)),
 		K(global_page_state(NR_SHMEM)),
 		K(global_page_state(NR_SLAB_RECLAIMABLE) +
Signature · 1 line
1.7.1
#1 lore raw
Quoted 11 lines · Claudio Scordino
fs/proc/meminfo.c +1 -1
index 5861741..80e4645 100644
@@ -131,12 +131,13 @@ static int meminfo_proc_show(struct seq_file *m, void *v)
 		K(i.freeswap),
 		K(global_page_state(NR_FILE_DIRTY)),
 		K(global_page_state(NR_WRITEBACK)),
-		K(global_page_state(NR_ANON_PAGES)
 #ifdef CONFIG_TRANSPARENT_HUGEPAGE
+		K(global_page_state(NR_ANON_PAGES)

fs/proc/meminfo.c static int meminfo_proc_show(struct seq_file *m, void *v) · line 143

Quoted 10 lines
fs/proc/meminfo.c +3 -2
 		  + global_page_state(NR_ANON_TRANSPARENT_HUGEPAGES) *
-		  HPAGE_PMD_NR
+		  HPAGE_PMD_NR),
+#else
+		K(global_page_state(NR_ANON_PAGES)),
 #endif
-		  ),
 		K(global_page_state(NR_FILE_MAPPED)),
 		K(global_page_state(NR_SHMEM)),
 		K(global_page_state(NR_SLAB_RECLAIMABLE) +

Looks like this needs to be fixed for the per-node sysfs meminfo files as well? See node_read_meminfo() in drivers/base/node.c.

#2 lore raw

Il 17/11/2011 06:06, David Rientjes ha scritto:

Quoted 18 lines · Claudio Scordino
Quoted 17 lines
fs/proc/meminfo.c +4 -2
index 5861741..80e4645 100644
@@ -131,12 +131,13 @@ static int meminfo_proc_show(struct seq_file *m, void *v)
  		K(i.freeswap),
  		K(global_page_state(NR_FILE_DIRTY)),
  		K(global_page_state(NR_WRITEBACK)),
-		K(global_page_state(NR_ANON_PAGES)
  #ifdef CONFIG_TRANSPARENT_HUGEPAGE
+		K(global_page_state(NR_ANON_PAGES)
  		  + global_page_state(NR_ANON_TRANSPARENT_HUGEPAGES) *
-		  HPAGE_PMD_NR
+		  HPAGE_PMD_NR),
+#else
+		K(global_page_state(NR_ANON_PAGES)),
Quoted 8 lines

fs/proc/meminfo.c static int meminfo_proc_show(struct seq_file *m, void *v) · line 143

Quoted 5 lines
fs/proc/meminfo.c +0 -1
  #endif
-		  ),
  		K(global_page_state(NR_FILE_MAPPED)),
  		K(global_page_state(NR_SHMEM)),
  		K(global_page_state(NR_SLAB_RECLAIMABLE) +

Looks like this needs to be fixed for the per-node sysfs meminfo files as well? See node_read_meminfo() in drivers/base/node.c.

Hi David,

that file cannot be compiled for the cris architecture
(therefore, with the compiler that gave me the error) because CONFIG_NUMA cannot be defined for the cris architecture.

However, I forced make to build also that file, and actually I got the same error (i.e., "directives may not be used inside a macro argument").

Since Andrew already took the patch for the meminfo.c file, I'm going to send a further patch for this specific file.

Let me know if instead you prefer to have a single patch for both files.

Best regards,

Claudio