On Wed, 18 Jan 2023 17:31:48 -0800 Yang Shi <shy828301@xxxxxxxxx> wrote: > On Wed, Jan 18, 2023 at 5:15 PM Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> wrote: > > > > > > The quilt patch titled > > Subject: mm/thp: check and bail out if page in deferred queue already > > has been removed from the -mm tree. Its filename was > > mm-thp-check-and-bail-out-if-page-in-deferred-queue-already.patch > > > > This patch was dropped because it was merged into the mm-stable branch > > of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm > > > > ------------------------------------------------------ > > From: Yin Fengwei <fengwei.yin@xxxxxxxxx> > > Subject: mm/thp: check and bail out if page in deferred queue already > > Date: Fri, 23 Dec 2022 21:52:07 +0800 > > > > Kernel build regression with LLVM was reported here: > > https://lore.kernel.org/all/Y1GCYXGtEVZbcv%2F5@dev-arch.thelio-3990X/ with > > commit f35b5d7d676e ("mm: align larger anonymous mappings on THP > > boundaries"). And the commit f35b5d7d676e was reverted. > > > > It turned out the regression is related with madvise(MADV_DONTNEED) > > was used by ld.lld. But with none PMD_SIZE aligned parameter len. > > trace-bpfcc captured: > > 531607 531732 ld.lld do_madvise.part.0 start: 0x7feca9000000, len: 0x7fb000, behavior: 0x4 > > 531607 531793 ld.lld do_madvise.part.0 start: 0x7fec86a00000, len: 0x7fb000, behavior: 0x4 > > This just reminds me that we should reinstantiate Rik's commit? OK, I did that. The changelog doesn't mention any performance testing results? From: Rik van Riel <riel@xxxxxxxxxxx> Subject: mm: align larger anonymous mappings on THP boundaries Date: Tue, 9 Aug 2022 14:24:57 -0400 Align larger anonymous memory mappings on THP boundaries by going through thp_get_unmapped_area if THPs are enabled for the current process. With this patch, larger anonymous mappings are now THP aligned. When a malloc library allocates a 2MB or larger arena, that arena can now be mapped with THPs right from the start, which can result in better TLB hit rates and execution time. Link: https://lkml.kernel.org/r/20220809142457.4751229f@xxxxxxxxxxxxxxxxxxxx Signed-off-by: Rik van Riel <riel@xxxxxxxxxxx> Reviewed-by: Yang Shi <shy828301@xxxxxxxxx> Cc: Matthew Wilcox <willy@xxxxxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- --- a/mm/mmap.c~mm-align-larger-anonymous-mappings-on-thp-boundaries +++ a/mm/mmap.c @@ -1782,6 +1782,9 @@ get_unmapped_area(struct file *file, uns */ pgoff = 0; get_area = shmem_get_unmapped_area; + } else if (IS_ENABLED(CONFIG_TRANSPARENT_HUGEPAGE)) { + /* Ensures that larger anonymous mappings are THP aligned. */ + get_area = thp_get_unmapped_area; } addr = get_area(file, addr, len, pgoff, flags); _