lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <CABNBeK+6C9ToJcjhGBJQm5dDaddA0USOoRFmRckZ27PhLGUfQg@mail.gmail.com>
Date:   Thu, 29 Aug 2019 19:37:22 +0800
From:   zhigang lu <luzhigang001@...il.com>
To:     mike.kravetz@...cle.com, linux-mm@...ck.org,
        linux-kernel@...r.kernel.org
Cc:     tonnylu@...cent.com, hzhongzhang@...cent.com,
        knightzhang@...cent.com
Subject: [PATCH] mm/hugetlb: avoid looping to the same hugepage if !pages and !vmas

From: Zhigang Lu <tonnylu@...cent.com>

This change greatly decrease the time of mmaping a file in hugetlbfs.
With MAP_POPULATE flag, it takes about 50 milliseconds to mmap a
existing 128GB file in hugetlbfs. With this change, it takes less
then 1 millisecond.

Signed-off-by: Zhigang Lu <tonnylu@...cent.com>
Reviewed-by: Haozhong Zhang <hzhongzhang@...cent.com>
Reviewed-by: Zongming Zhang <knightzhang@...cent.com>
---
 mm/hugetlb.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/mm/hugetlb.c b/mm/hugetlb.c
index 6d7296d..2df941a 100644
--- a/mm/hugetlb.c
+++ b/mm/hugetlb.c
@@ -4391,6 +4391,17 @@ long follow_hugetlb_page(struct mm_struct *mm,
struct vm_area_struct *vma,
  break;
  }
  }
+
+ if (!pages && !vmas && !pfn_offset &&
+     (vaddr + huge_page_size(h) < vma->vm_end) &&
+     (remainder >= pages_per_huge_page(h))) {
+ vaddr += huge_page_size(h);
+ remainder -= pages_per_huge_page(h);
+ i += pages_per_huge_page(h);
+ spin_unlock(ptl);
+ continue;
+ }
+
 same_page:
  if (pages) {
  pages[i] = mem_map_offset(page, pfn_offset);
-- 
1.8.3.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ