]> git.baikalelectronics.ru Git - kernel.git/commit
Fix __pfn_to_page(pfn) for CONFIG_DISCONTIGMEM=y
authorRafael J. Wysocki <rjw@sisk.pl>
Sat, 8 Nov 2008 12:53:33 +0000 (13:53 +0100)
committerLinus Torvalds <torvalds@linux-foundation.org>
Sat, 8 Nov 2008 18:02:48 +0000 (10:02 -0800)
commite596dbbec8eca9209b23c84f07809dd76d7569d7
tree35e98dc51e781bb24ef6a9bb7911d0cabef4c177
parent58cb85b19a31fd7ae01ebc21673cde3ea086abd2
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>
include/asm-generic/memory_model.h