linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Alexey Korolev <akorolex@gmail.com>
To: omar ramirez <or.rmz1@gmail.com>
Cc: linux-mm@kvack.org
Subject: Re: __get_free_pages page count increment
Date: Wed, 15 Jul 2009 14:30:18 +1200	[thread overview]
Message-ID: <202cde0e0907141930j6b59e8fdn84e2c21c43e7b12f@mail.gmail.com> (raw)
In-Reply-To: <983c694e0907141702t39bebefdr4024720f0a6dc4e1@mail.gmail.com>

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>

  reply	other threads:[~2009-07-15  1:54 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-07-15  0:02 __get_free_pages page count increment omar ramirez
2009-07-15  2:30 ` Alexey Korolev [this message]
2009-07-15 20:26   ` omar ramirez

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=202cde0e0907141930j6b59e8fdn84e2c21c43e7b12f@mail.gmail.com \
    --to=akorolex@gmail.com \
    --cc=linux-mm@kvack.org \
    --cc=or.rmz1@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).