* how to purposfully fragment memory?
@ 2007-03-20 17:43 Chris Friesen
[not found] ` <a8f16e2b0703201215q78dfdd3du54c77be7c9d843e0@mail.gmail.com>
0 siblings, 1 reply; 2+ messages in thread
From: Chris Friesen @ 2007-03-20 17:43 UTC (permalink / raw)
To: linux-kernel
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
^ permalink raw reply [flat|nested] 2+ messages in thread[parent not found: <a8f16e2b0703201215q78dfdd3du54c77be7c9d843e0@mail.gmail.com>]
[parent not found: <4600393C.8030401@nortel.com>]
* Re: how to purposfully fragment memory? [not found] ` <4600393C.8030401@nortel.com> @ 2007-03-20 21:34 ` Dan Kruchinin 0 siblings, 0 replies; 2+ messages in thread From: Dan Kruchinin @ 2007-03-20 21:34 UTC (permalink / raw) To: Chris Friesen, linux-kernel On 3/20/07, Chris Friesen <cfriesen@nortel.com> wrote: > Asgard wrote: > > > btw, can you describe your aim in details? > > I'm doing some work on a network device driver. We were having jumbo > frame issues after being up for a month or so because it couldn't > allocate enough contiguous memory. > > We've got a new code path now that doesn't need large contiguous > allocations, so I'd like to demonstrate it by forcing the system to > become severely fragmented. > > Chris > and by the way, you can try to use void split_page(struct page *page, unsigned int order) function, but keep in mind, that it's not recommended to use it in drivers: /* * split_page takes a non-compound higher-order page, and splits it into * n (1<<order) sub-pages: page[0..n] * Each sub-page must be freed individually. * * Note: this is probably too low level an operation for use in drivers. * Please consult with lkml before using this in your driver. */ void split_page(struct page *page, unsigned int order) Good luck. Dan. ^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2007-03-20 21:34 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-03-20 17:43 how to purposfully fragment memory? Chris Friesen
[not found] ` <a8f16e2b0703201215q78dfdd3du54c77be7c9d843e0@mail.gmail.com>
[not found] ` <4600393C.8030401@nortel.com>
2007-03-20 21:34 ` Dan Kruchinin
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox