Hi Fernando,

On Tue, Apr 7, 2009 at 10:26 PM, Guzman Lugo, Fernando <[email protected]> wrote:
>
> Hi,
>
>        Patch updated wit the fix in page_count(pg).
>
>
> From a5ab7e038b72e62358279ef3c4e64b2f260ceeee Mon Sep 17 00:00:00 2001
> From: Hari Kanigeri <[email protected]>
> Date: Thu, 26 Mar 2009 15:47:50 -0500
> Subject: [PATCH] DSPBRIDGE: Memory lock for DMM.
>
> Lock down the pages that are mapped to DSP virtual memory to prevent from
> getting swapped out
>
> Signed-off-by: Hari Kanigeri <[email protected]>
> ---
> +                       if (pfn_valid(__phys_to_pfn(patemp))) {
> +                               pg = phys_to_page(patemp);
> +                               get_page(pg);

get_page() makes sure that page->count is not zero and atomically increments it.
That means after execution of get_page(); page->count will be always 1
or greater
than 1.

If this is the case then what is the point of having following code?
if (page_count(pg) < 1)  <-- This will always evaluate to FALSE.

> +                               if (page_count(pg) < 1) {
> +                                       printk(KERN_EMERG "DSPBRIDGE:MAP  "
> +                                               "function: COUNT 0 FOR PA "
> +                                               "0x%x\n", patemp);
> +                                       printk(KERN_EMERG "Bad page state"
> +                                               "in process '%s'\n"
> +                                               "page:%p flags:0x%0*lx "
> +                                               "mapping:%p mapcount:%d "
> +                                               "count:%d\n"
> +                                               "Trying to fix it up, but "
> +                                               "a reboot is needed\n"
> +                                               "Backtrace:\n",
> +                                               current->comm, pg,
> +                                               (int)(2*sizeof(unsigned 
> long)),
> +                                               (unsigned long)pg->flags,
> +                                               pg->mapping, 
> page_mapcount(pg),
> +                                               page_count(pg));
> +                                       dump_stack();
> +                                       BUG_ON(1);
> +                               }

Cheers,
Ameya.
N�����r��y����b�X��ǧv�^�)޺{.n�+����{��f��{ay�ʇڙ�,j��f���h���z��w���
���j:+v���w�j�m��������zZ+�����ݢj"��!�i

Reply via email to