Skip to contentSkip to conversation

md: Fix userspace free_pages() macro

PATCH Applied Steven Rostedt 3 participants 3 messages Dec 14, 2011 – Dec 15, 2011 MD RAID

lore
Share & tools
lore
#0 lore raw

While using etags to find free_pages(), I stumbled across this debug definition of free_pages() that is to be used while debugging some raid code in userspace. The __get_free_pages() allocates the correct size, but the free_pages() does not match. free_pages(), like __get_free_pages(), takes an order and not a size.

include/linux/raid/pq.h +1 -1
index 2b59cc8..53272e9 100644
@@ -132,7 +132,7 @@ void raid6_dual_recov(int disks, size_t bytes, int faila, int failb,
 						     PROT_READ|PROT_WRITE,   \
 						     MAP_PRIVATE|MAP_ANONYMOUS,\
 						     0, 0))
-# define free_pages(x, y)	munmap((void *)(x), (y)*PAGE_SIZE)
+# define free_pages(x, y)	munmap((void *)(x), PAGE_SIZE << (y))
 
 static inline void cpu_relax(void)
 {
#1 lore raw
Quoted 8 lines · Steven Rostedt

While using etags to find free_pages(), I stumbled across this debug definition of free_pages() that is to be used while debugging some raid code in userspace. The __get_free_pages() allocates the correct size, but the free_pages() does not match. free_pages(), like __get_free_pages(), takes an order and not a size.

-hpa

Applied
#2 lore raw
Quoted 7 lines · On Wed, 14 Dec 2011 13:15:31 -0800 "H. Peter Anvin" <[email protected]> wrote:
Quoted 6 lines · Steven Rostedt

While using etags to find free_pages(), I stumbled across this debug definition of free_pages() that is to be used while debugging some raid code in userspace. The __get_free_pages() allocates the correct size, but the free_pages() does not match. free_pages(), like __get_free_pages(), takes an order and not a size.

Quoted 5 lines
Quoted 2 lines

Applied. Thanks.

NeilBrown