aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/include/asm-generic/memory_model.h
diff options
context:
space:
mode:
authorRafael J. Wysocki <rjw@sisk.pl>2008-11-08 13:53:33 +0100
committerLinus Torvalds <torvalds@linux-foundation.org>2008-11-08 10:02:48 -0800
commitc5d712433ff57a66d8fb79a57a4fc7a7c3467b97 (patch)
tree35e98dc51e781bb24ef6a9bb7911d0cabef4c177 /include/asm-generic/memory_model.h
parentMerge branch 'release' of git://git.kernel.org/pub/scm/linux/kernel/git/aegl/linux-2.6 (diff)
downloadwireguard-linux-c5d712433ff57a66d8fb79a57a4fc7a7c3467b97.tar.xz
wireguard-linux-c5d712433ff57a66d8fb79a57a4fc7a7c3467b97.zip
Fix __pfn_to_page(pfn) for CONFIG_DISCONTIGMEM=y
Fix the __pfn_to_page(pfn) macro so that it doesn't evaluate its argument twice in the CONFIG_DISCONTIGMEM=y case, because 'pfn' may be a result of a funtion call having side effects. For example, the hibernation code applies pfn_to_page(pfn) to the result of a function returning the pfn corresponding to the next set bit in a bitmap and the current bit position is modified on each call. This leads to "interesting" failures for CONFIG_DISCONTIGMEM=y due to the current behavior of __pfn_to_page(pfn). Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl> Acked-by: Pavel Machek <pavel@suse.cz> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'include/asm-generic/memory_model.h')
-rw-r--r--include/asm-generic/memory_model.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/include/asm-generic/memory_model.h b/include/asm-generic/memory_model.h
index ae060c62aff1..18546d8eb78e 100644
--- a/include/asm-generic/memory_model.h
+++ b/include/asm-generic/memory_model.h
@@ -34,7 +34,7 @@
#define __pfn_to_page(pfn) \
({ unsigned long __pfn = (pfn); \
- unsigned long __nid = arch_pfn_to_nid(pfn); \
+ unsigned long __nid = arch_pfn_to_nid(__pfn); \
NODE_DATA(__nid)->node_mem_map + arch_local_page_offset(__pfn, __nid);\
})