mm: make folio_pte_batch available outside of mm/memory.c
authorBarry Song <v-songbaohua@oppo.com>
Tue, 27 Feb 2024 10:42:01 +0000 (23:42 +1300)
committerAndrew Morton <akpm@linux-foundation.org>
Wed, 6 Mar 2024 21:04:18 +0000 (13:04 -0800)
commitac96cc4d1ceda01d08deda1e45b9f1b55b0624d2
treec81cbf098c342a8df2539e34d90ccfd72a76b467
parent9164448d3100d5118bda5e9d38b69a9f32cea509
mm: make folio_pte_batch available outside of mm/memory.c

madvise, mprotect and some others might need folio_pte_batch to check if a
range of PTEs are completely mapped to a large folio with contiguous
physical addresses.  Let's make it available in mm/internal.h.

While at it, add proper kernel doc and sanity-check more input parameters
using two additional VM_WARN_ON_FOLIO().

[21cnbao@gmail.com: build fix]
Link: https://lkml.kernel.org/r/CAGsJ_4wWzG-37D82vqP_zt+Fcbz+URVe5oXLBc4M5wbN8A_gpQ@mail.gmail.com
[david@redhat.com: improve the doc for the exported func]
Link: https://lkml.kernel.org/r/20240227104201.337988-1-21cnbao@gmail.com
Signed-off-by: David Hildenbrand <david@redhat.com>
Signed-off-by: Barry Song <v-songbaohua@oppo.com>
Suggested-by: David Hildenbrand <david@redhat.com>
Reviewed-by: Ryan Roberts <ryan.roberts@arm.com>
Acked-by: David Hildenbrand <david@redhat.com>
Cc: Lance Yang <ioworker0@gmail.com>
Cc: Yin Fengwei <fengwei.yin@intel.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
mm/internal.h
mm/memory.c