ARM: mm: make UACCESS_WITH_MEMCPY huge page aware.
authorSteve Capper <steve.capper@arm.com>
Tue, 12 Mar 2013 08:14:51 +0000 (10:14 +0200)
committerGrazvydas Ignotas <notasas@gmail.com>
Tue, 12 Mar 2013 21:45:51 +0000 (23:45 +0200)
The memory pinning code in uaccess_with_memcpy.c does not check
for HugeTLB or THP pages, and will enter an infinite loop should
a __copy_to_user or __clear_user occur against a huge page.

This patch adds detection code for huge pages to pin_page_for_write.
As this code can be executed in a fast path it refers to the actual
pmds rather than the vma. It also takes advantage of the fact that
HugeTLB and THP pages have the same pmd layout on ARM.

Two helper functions are introduced; pmd_thp_or_huge will check
whether or not a page is huge or transparent huge (which have the
same pmd layout on ARM), and pmd_hugewillfault will detect whether
or not a page fault will occur on write to the page.

This patch is to be applied on top of the set at:
http://lists.infradead.org/pipermail/linux-arm-kernel/2013-February/148451.html

I would really welcome comments/discussion on this.

Reported-by: Grazvydas Ignotas <notasas@gmail.com>
Signed-off-by: Steve Capper <steve.capper@arm.com>

No differences found