]> www.infradead.org Git - users/jedix/linux-maple.git/commit
mempolicy: optimize queue_folios_pte_range by PTE batching
authorDev Jain <dev.jain@arm.com>
Wed, 16 Apr 2025 05:30:48 +0000 (11:00 +0530)
committerAndrew Morton <akpm@linux-foundation.org>
Mon, 12 May 2025 00:48:33 +0000 (17:48 -0700)
commit4a34c584d8cd13d2b721d21cf629f77c60bfb4a4
treecdb64a916e3e5a9c9f849494524f0ff29b4139fb
parent75404e07663b1622948944cf31531fa87cb1785d
mempolicy: optimize queue_folios_pte_range by PTE batching

After the check for queue_folio_required(), the code only cares about the
folio in the for loop, i.e the PTEs are redundant.  Therefore, optimize
this loop by skipping over a PTE batch mapping the same folio.

With a test program migrating pages of the calling process, which includes
a mapped VMA of size 4GB with pte-mapped large folios of order-9, and
migrating once back and forth node-0 and node-1, the average execution
time reduces from 7.5 to 4 seconds, giving an approx 47% speedup.

Link: https://lkml.kernel.org/r/20250416053048.96479-1-dev.jain@arm.com
Signed-off-by: Dev Jain <dev.jain@arm.com>
Acked-by: David Hildenbrand <david@redhat.com>
Cc: Baolin Wang <baolin.wang@linux.alibaba.com>
Cc: Hugh Dickins <hughd@google.com>
Cc: Matthew Wilcox (Oracle) <willy@infradead.org>
Cc: Ryan Roberts <ryan.roberts@arm.com>
Cc: Vishal Moola (Oracle) <vishal.moola@gmail.com>
Cc: Yang Shi <yang@os.amperecomputing.com>
Cc: Zi Yan <ziy@nvidia.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
mm/mempolicy.c