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-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20230403052233.1880567-4-ankur.a.arora@oracle.com>
Date:   Sun,  2 Apr 2023 22:22:27 -0700
From:   Ankur Arora <ankur.a.arora@...cle.com>
To:     linux-kernel@...r.kernel.org, linux-mm@...ck.org, x86@...nel.org
Cc:     torvalds@...ux-foundation.org, akpm@...ux-foundation.org,
        luto@...nel.org, bp@...en8.de, dave.hansen@...ux.intel.com,
        hpa@...or.com, mingo@...hat.com, juri.lelli@...hat.com,
        willy@...radead.org, mgorman@...e.de, peterz@...radead.org,
        rostedt@...dmis.org, tglx@...utronix.de,
        vincent.guittot@...aro.org, jon.grimm@....com, bharata@....com,
        boris.ostrovsky@...cle.com, konrad.wilk@...cle.com,
        ankur.a.arora@...cle.com
Subject: [PATCH 3/9] huge_page: allow arch override for clear/copy_huge_page()

clear/copy_huge_page() are constrained to operate on a page-at-a-time
because they also handle the CONFIG_HIGHMEM case.

Mark both __weak to allow for arch specific optimizations.

Suggested-by: Linus Torvalds <torvalds@...ux-foundation.org>
Signed-off-by: Ankur Arora <ankur.a.arora@...cle.com>
---
 mm/memory.c | 18 +++++++++++++-----
 1 file changed, 13 insertions(+), 5 deletions(-)

diff --git a/mm/memory.c b/mm/memory.c
index 6da97e6c7d21..9a6bce384616 100644
--- a/mm/memory.c
+++ b/mm/memory.c
@@ -5645,8 +5645,12 @@ static void clear_gigantic_page(struct page *page,
 	}
 }
 
-void clear_huge_page(struct page *page,
-		     unsigned long addr_hint, unsigned int pages_per_huge_page)
+/*
+ * clear_huge_page(): does page-at-a-time clearing to handle the
+ * CONFIG_HIGHMEM case.
+ */
+__weak void clear_huge_page(struct page *page,
+			    unsigned long addr_hint, unsigned int pages_per_huge_page)
 {
 	unsigned long addr = addr_hint &
 		~(((unsigned long)pages_per_huge_page << PAGE_SHIFT) - 1);
@@ -5712,9 +5716,13 @@ static void copy_user_gigantic_page(struct page *dst, struct page *src,
 	}
 }
 
-void copy_user_huge_page(struct page *dst, struct page *src,
-			 unsigned long addr_hint, struct vm_area_struct *vma,
-			 unsigned int pages_per_huge_page)
+/*
+ * copy_user_huge_page(): does page-at-a-time copying to handle
+ * the CONFIG_HIGHMEM case.
+ */
+__weak void copy_user_huge_page(struct page *dst, struct page *src,
+				unsigned long addr_hint, struct vm_area_struct *vma,
+				unsigned int pages_per_huge_page)
 {
 	unsigned long addr = addr_hint &
 		~(((unsigned long)pages_per_huge_page << PAGE_SHIFT) - 1);
-- 
2.31.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ