Skip to contentSkip to conversation

rmap: fixup page_referenced() for nommu systems

PATCH In review Mike Frysinger 4 participants 4 messages Jun 19, 2009 – Jun 22, 2009 MM rmap

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 rmap: fixup page_referenced() for nommu systems

After the recent changes that went into mm/vmscan.c to overhaul stuff, we ended up with these warnings on no-mmu systems:
mm/vmscan.c: In function ‘shrink_page_list’:
mm/vmscan.c:580: warning: unused variable ‘vm_flags’
mm/vmscan.c: In function ‘shrink_active_list’:
mm/vmscan.c:1294: warning: ‘vm_flags’ may be used uninitialized in this function mm/vmscan.c:1242: note: ‘vm_flags’ was declared here

This is because the no-mmu function defines page_referenced() to work on the first argument only (the page). It does not clear the vm_flags given to it because for no-mmu systems, they never actually get utilized. Since that is no longer strictly true, we need to set vm_flags to 0 like everyone else so gcc can do proper dead code elimination without annoying us with unused warnings.

---
 include/linux/rmap.h |    9 ++++++++-
 1 files changed, 8 insertions(+), 1 deletions(-)
include/linux/rmap.h +8 -1
index 216d024..bf116d0 100644
@@ -118,7 +118,14 @@ int try_to_munlock(struct page *);
 #define anon_vma_prepare(vma)	(0)
 #define anon_vma_link(vma)	do {} while (0)
 
-#define page_referenced(page, locked, cnt, flags) TestClearPageReferenced(page)
+static inline int page_referenced(struct page *page, int is_locked,
+				  struct mem_cgroup *cnt,
+				  unsigned long *vm_flags)
+{
+	*vm_flags = 0;
+	return TestClearPageReferenced(page);
+}
+
 #define try_to_unmap(page, refs) SWAP_FAIL
 
 static inline int page_mkclean(struct page *page)
Signature · 1 line
1.6.3.1
Acked-by on v1 1/1
#1 lore raw
Quoted 8 lines · Mike Frysinger

After the recent changes that went into mm/vmscan.c to overhaul stuff, we ended up with these warnings on no-mmu systems:
mm/vmscan.c: In function ???shrink_page_list???:
mm/vmscan.c:580: warning: unused variable ???vm_flags???
mm/vmscan.c: In function ???shrink_active_list???:
mm/vmscan.c:1294: warning: ???vm_flags??? may be used uninitialized in this function mm/vmscan.c:1242: note: ???vm_flags??? was declared here

Quoted 8 lines

This is because the no-mmu function defines page_referenced() to work on the first argument only (the page). It does not clear the vm_flags given to it because for no-mmu systems, they never actually get utilized. Since that is no longer strictly true, we need to set vm_flags to 0 like everyone else so gcc can do proper dead code elimination without annoying us with unused warnings.

Looks ok to me.

Acked-by on v1 1/1
#2 lore raw
In reply to Mike Frysinger
Quoted 8 lines · Mike Frysinger

After the recent changes that went into mm/vmscan.c to overhaul stuff, we ended up with these warnings on no-mmu systems:
mm/vmscan.c: In function 'shrink_page_list':
mm/vmscan.c:580: warning: unused variable 'vm_flags'
mm/vmscan.c: In function 'shrink_active_list':
mm/vmscan.c:1294: warning: 'vm_flags' may be used uninitialized in this function mm/vmscan.c:1242: note: 'vm_flags' was declared here

Quoted 8 lines

This is because the no-mmu function defines page_referenced() to work on the first argument only (the page). It does not clear the vm_flags given to it because for no-mmu systems, they never actually get utilized. Since that is no longer strictly true, we need to set vm_flags to 0 like everyone else so gcc can do proper dead code elimination without annoying us with unused warnings.

Acked-by on v1 1/1
#3 lore raw
In reply to Mike Frysinger
Quoted 8 lines · Mike Frysinger

After the recent changes that went into mm/vmscan.c to overhaul stuff, we ended up with these warnings on no-mmu systems:
mm/vmscan.c: In function ‘shrink_page_list’:
mm/vmscan.c:580: warning: unused variable ‘vm_flags’
mm/vmscan.c: In function ‘shrink_active_list’:
mm/vmscan.c:1294: warning: ‘vm_flags’ may be used uninitialized in this function mm/vmscan.c:1242: note: ‘vm_flags’ was declared here

Quoted 8 lines

This is because the no-mmu function defines page_referenced() to work on the first argument only (the page). It does not clear the vm_flags given to it because for no-mmu systems, they never actually get utilized. Since that is no longer strictly true, we need to set vm_flags to 0 like everyone else so gcc can do proper dead code elimination without annoying us with unused warnings.

Quoted 23 lines
 include/linux/rmap.h |    9 ++++++++-
 1 files changed, 8 insertions(+), 1 deletions(-)
include/linux/rmap.h +8 -1
index 216d024..bf116d0 100644
@@ -118,7 +118,14 @@ int try_to_munlock(struct page *);
 #define anon_vma_prepare(vma)	(0)
 #define anon_vma_link(vma)	do {} while (0)
 
-#define page_referenced(page, locked, cnt, flags) TestClearPageReferenced(page)
+static inline int page_referenced(struct page *page, int is_locked,
+				  struct mem_cgroup *cnt,
+				  unsigned long *vm_flags)
+{
+	*vm_flags = 0;
+	return TestClearPageReferenced(page);
+}
+
 #define try_to_unmap(page, refs) SWAP_FAIL
 
 static inline int page_mkclean(struct page *page)
Signature · 5 lines
------------------------------------------------------------------------
Greg Ungerer  --  Principal Engineer        EMAIL:     [email protected]
SnapGear Group, McAfee                      PHONE:       +61 7 3435 2888
825 Stanley St,                             FAX:         +61 7 3891 3630
Woolloongabba, QLD, 4102, Australia         WEB: http://www.SnapGear.com