Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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>

authored by

Rafael J. Wysocki and committed by
Linus Torvalds
c5d71243 fed4d59b

+1 -1
+1 -1
include/asm-generic/memory_model.h
··· 34 34 35 35 #define __pfn_to_page(pfn) \ 36 36 ({ unsigned long __pfn = (pfn); \ 37 - unsigned long __nid = arch_pfn_to_nid(pfn); \ 37 + unsigned long __nid = arch_pfn_to_nid(__pfn); \ 38 38 NODE_DATA(__nid)->node_mem_map + arch_local_page_offset(__pfn, __nid);\ 39 39 }) 40 40