Re: mlockall and mmap of IO devices don't mix

From: Ingo Oeser
Date: Sat Oct 04 2003 - 03:54:53 EST


Hi,

On Saturday 04 October 2003 09:02, Andi Kleen wrote:
> Joe Korty <joe.korty@xxxxxxxx> writes:
> > I do not believe that the above constitutes a correct fix. The
> > problem is that follow_pages() is fundamentally not able to handle a
> > mapping which does not have a 'struct page' backing it up, and a
> > mapping to IO memory by definition has no 'struct page' structure to
> > back it up.
>
> The 2.4 vm scanner handles this by always checking VALID_PAGE().
>
> Maybe follow_pages() should do that too?

It does already.

Just see the most indented check there. It tries to find a struct page from the
page frame number (pfn_to_page) after obtaining the pfn from the pte.

This check is only done, if it is a valid pfn (pfn_valid()) of a present
pte.

Since make_pages_present uses get_user_pages(), which in turn calls
follow_pages() with the above checks, this is properly checked.

The only path where is is NOT checked, is hugetlb stuff. So the error must be
there.

If somebody does the changes, please remove the useless get_page_map(), since
it just does the above checks done already again after a reverse lookup and I
could not find ANY case, where the check in get_page_map() would fail.

So maybe a BUG_ON() the checks in get_page_map() and a LTP run combinded with
bttv usage afterwards would be good.

Regards

Ingo Oeser


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