lkml.org 
[lkml]   [2007]   [Mar]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
Subjecthow to purposfully fragment memory?

I'm trying to test code paths dealing with fragmented memory, so I'd
like to have a simple way to cause fragmented memory in the kernel. Is
there any API in the kernel that would let me allocate two contiguous
pages, then free one of them?


I tried the following, but it triggers an oops in free_page():

unsigned long addr =
__get_free_pages(GFP_KERNEL|__GFP_NORETRY|__GFP_NOWARN, 1);
if (!addr)
break;
free_page(addr+4096);


Thanks,

Chris
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2007-03-20 18:47    [W:0.047 / U:0.676 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site