* __get_free_pages page count increment
@ 2009-07-15 0:02 omar ramirez
2009-07-15 2:30 ` Alexey Korolev
0 siblings, 1 reply; 3+ messages in thread
From: omar ramirez @ 2009-07-15 0:02 UTC (permalink / raw)
To: linux-mm
Hi,
I have been digging about __get_free_pages function, and wanted to now
why only the first page reserved with this function increments the
page count and for the other they are marked as 0.
So here it is what I'm doing, I'm reserving a chunk of pages (using
__get_free_pages) in a display driver, then I pass that through
userspace to a dsp driver to decode a video file and return the buffer
to display.
The buffer is mapped in the dsp, which also follows the get_page
approach but it goes page-by-page on the buffer, incrementing the page
count for all of the pages (so now first page count from the buffer
will be 2 <display, dsp>, but for the rest it will be 1 <dsp>).
The issue comes once those pages are unmapped from the dsp driver,
because it will do a page_cache_release on all the reserved pages
(which leave the count as it was before, first page 1 <display> and
the rest as 0).
This will throw the BUG: bad page state error because the count is
being marked as 0 for the process using that buffer.
So my question is, is it ok that the page count is NOT incremented for
all but first page of __get_free_pages?
Thanks in advance,
omar
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: __get_free_pages page count increment
2009-07-15 0:02 __get_free_pages page count increment omar ramirez
@ 2009-07-15 2:30 ` Alexey Korolev
2009-07-15 20:26 ` omar ramirez
0 siblings, 1 reply; 3+ messages in thread
From: Alexey Korolev @ 2009-07-15 2:30 UTC (permalink / raw)
To: omar ramirez; +Cc: linux-mm
Hi,
About two months ago I faced pretty much the same issue.
Yes it is a proper behaviour. Please see thread
http://marc.info/?l=linux-mm&m=124348722701100&w=2
The best solution for your case would be involving split_page() function.
Thanks
Alexey
On Wed, Jul 15, 2009 at 12:02 PM, omar ramirez<or.rmz1@gmail.com> wrote:
> Hi,
>
> I have been digging about __get_free_pages function, and wanted to now
> why only the first page reserved with this function increments the
> page count and for the other they are marked as 0.
>
> So here it is what I'm doing, I'm reserving a chunk of pages (using
> __get_free_pages) in a display driver, then I pass that through
> userspace to a dsp driver to decode a video file and return the buffer
> to display.
>
> The buffer is mapped in the dsp, which also follows the get_page
> approach but it goes page-by-page on the buffer, incrementing the page
> count for all of the pages (so now first page count from the buffer
> will be 2 <display, dsp>, but for the rest it will be 1 <dsp>).
>
> The issue comes once those pages are unmapped from the dsp driver,
> because it will do a page_cache_release on all the reserved pages
> (which leave the count as it was before, first page 1 <display> and
> the rest as 0).
>
> This will throw the BUG: bad page state error because the count is
> being marked as 0 for the process using that buffer.
>
> So my question is, is it ok that the page count is NOT incremented for
> all but first page of __get_free_pages?
>
> Thanks in advance,
>
> omar
>
> --
> To unsubscribe, send a message with 'unsubscribe linux-mm' in
> the body to majordomo@kvack.org. For more info on Linux MM,
> see: http://www.linux-mm.org/ .
> Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
>
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: __get_free_pages page count increment
2009-07-15 2:30 ` Alexey Korolev
@ 2009-07-15 20:26 ` omar ramirez
0 siblings, 0 replies; 3+ messages in thread
From: omar ramirez @ 2009-07-15 20:26 UTC (permalink / raw)
To: Alexey Korolev; +Cc: linux-mm
Hi,
On Tue, Jul 14, 2009 at 9:30 PM, Alexey Korolev<akorolex@gmail.com> wrote:
> Hi,
>
> About two months ago I faced pretty much the same issue.
> Yes it is a proper behaviour. Please see thread
> http://marc.info/?l=linux-mm&m=124348722701100&w=2
>
> The best solution for your case would be involving split_page() function.
>
Thanks for the quick reply it really helped a lot!
-omar
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2009-07-15 20:26 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-07-15 0:02 __get_free_pages page count increment omar ramirez
2009-07-15 2:30 ` Alexey Korolev
2009-07-15 20:26 ` omar ramirez
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).