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]
Date:   Mon,  6 Jun 2022 20:20:50 +0000
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,
        mike.kravetz@...cle.com, mingo@...nel.org, luto@...nel.org,
        tglx@...utronix.de, bp@...en8.de, peterz@...radead.org,
        ak@...ux.intel.com, arnd@...db.de, jgg@...dia.com,
        jon.grimm@....com, boris.ostrovsky@...cle.com,
        konrad.wilk@...cle.com, joao.martins@...cle.com,
        ankur.a.arora@...cle.com
Subject: [PATCH v3 02/21] mm, huge-page: refactor process_subpage()

process_subpage() takes an absolute address and an index, both
referencing the same region.

Change this so process_huge_page() deals only with the huge-page
region, offloading the indexing to process_subpage().

Signed-off-by: Ankur Arora <ankur.a.arora@...cle.com>
---
 mm/memory.c | 19 ++++++++++---------
 1 file changed, 10 insertions(+), 9 deletions(-)

diff --git a/mm/memory.c b/mm/memory.c
index c33aacdaaf11..2c86d79c9d98 100644
--- a/mm/memory.c
+++ b/mm/memory.c
@@ -5577,7 +5577,7 @@ struct subpage_arg {
 static inline void process_huge_page(struct subpage_arg *sa,
 	unsigned long addr_hint, unsigned int pages_per_huge_page,
 	void (*process_subpage)(struct subpage_arg *sa,
-				unsigned long addr, int idx))
+				unsigned long base_addr, int idx))
 {
 	int i, n, base, l;
 	unsigned long addr = addr_hint &
@@ -5593,7 +5593,7 @@ static inline void process_huge_page(struct subpage_arg *sa,
 		/* Process subpages at the end of huge page */
 		for (i = pages_per_huge_page - 1; i >= 2 * n; i--) {
 			cond_resched();
-			process_subpage(sa, addr + i * PAGE_SIZE, i);
+			process_subpage(sa, addr, i);
 		}
 	} else {
 		/* If target subpage in second half of huge page */
@@ -5602,7 +5602,7 @@ static inline void process_huge_page(struct subpage_arg *sa,
 		/* Process subpages at the begin of huge page */
 		for (i = 0; i < base; i++) {
 			cond_resched();
-			process_subpage(sa, addr + i * PAGE_SIZE, i);
+			process_subpage(sa, addr, i);
 		}
 	}
 	/*
@@ -5614,9 +5614,9 @@ static inline void process_huge_page(struct subpage_arg *sa,
 		int right_idx = base + 2 * l - 1 - i;
 
 		cond_resched();
-		process_subpage(sa, addr + left_idx * PAGE_SIZE, left_idx);
+		process_subpage(sa, addr, left_idx);
 		cond_resched();
-		process_subpage(sa, addr + right_idx * PAGE_SIZE, right_idx);
+		process_subpage(sa, addr, right_idx);
 	}
 }
 
@@ -5635,11 +5635,12 @@ static void clear_gigantic_page(struct page *page,
 	}
 }
 
-static void clear_subpage(struct subpage_arg *sa, unsigned long addr, int idx)
+static void clear_subpage(struct subpage_arg *sa,
+			  unsigned long base_addr, int idx)
 {
 	struct page *page = sa->dst;
 
-	clear_user_highpage(page + idx, addr);
+	clear_user_highpage(page + idx, base_addr + idx * PAGE_SIZE);
 }
 
 void clear_huge_page(struct page *page,
@@ -5681,10 +5682,10 @@ static void copy_user_gigantic_page(struct page *dst, struct page *src,
 }
 
 static void copy_subpage(struct subpage_arg *copy_arg,
-			 unsigned long addr, int idx)
+			 unsigned long base_addr, int idx)
 {
 	copy_user_highpage(copy_arg->dst + idx, copy_arg->src + idx,
-			   addr, copy_arg->vma);
+			   base_addr + idx * PAGE_SIZE, copy_arg->vma);
 }
 
 void copy_user_huge_page(struct page *dst, struct page *src,
-- 
2.31.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ