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: <0ff0d56b88a64e2017b427f37b15ab41aa5d4019.1693287931.git.raghavendra.kt@amd.com>
Date:   Tue, 29 Aug 2023 11:36:14 +0530
From:   Raghavendra K T <raghavendra.kt@....com>
To:     <linux-kernel@...r.kernel.org>, <linux-mm@...ck.org>
CC:     Ingo Molnar <mingo@...hat.com>,
        Peter Zijlstra <peterz@...radead.org>,
        "Mel Gorman" <mgorman@...e.de>,
        Andrew Morton <akpm@...ux-foundation.org>,
        "David Hildenbrand" <david@...hat.com>, <rppt@...nel.org>,
        Juri Lelli <juri.lelli@...hat.com>,
        Vincent Guittot <vincent.guittot@...aro.org>,
        Bharata B Rao <bharata@....com>,
        Aithal Srikanth <sraithal@....com>,
        "kernel test robot" <oliver.sang@...el.com>,
        Raghavendra K T <raghavendra.kt@....com>,
        Sapkal Swapnil <Swapnil.Sapkal@....com>,
        K Prateek Nayak <kprateek.nayak@....com>
Subject: [RFC PATCH V1 6/6] sched/numa: Allow scanning of shared VMAs

VMAs being accessed by more than two tasks are critical. Scan them
unconditionally. Note that current patch considers full history of
VMA access.

Signed-off-by: Raghavendra K T <raghavendra.kt@....com>
---
 kernel/sched/fair.c | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)

diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index 6529da7f370a..70c8e62c1a89 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -2981,6 +2981,19 @@ static inline bool vma_accessed_recent(struct vm_area_struct *vma)
 	return (bitmap_weight(pids, BITS_PER_LONG) >= 1);
 }
 
+#define SHARED_VMA_THRESH	3
+
+static inline bool vma_shared_access(struct vm_area_struct *vma)
+{
+	int i;
+	unsigned long pids = 0;
+
+	for (i = 0; i < NR_ACCESS_PID_HIST; i++)
+		pids  |= vma->numab_state->access_pids[i];
+
+	return (bitmap_weight(&pids, BITS_PER_LONG) >= SHARED_VMA_THRESH);
+}
+
 static bool vma_is_accessed(struct vm_area_struct *vma)
 {
 	/* Check at least one task had accessed VMA recently. */
@@ -2991,7 +3004,8 @@ static bool vma_is_accessed(struct vm_area_struct *vma)
 	if (vma_test_access_pid_history(vma))
 		return true;
 
-	return false;
+	/* Check if VMA is shared by many tasks. */
+	return vma_shared_access(vma);
 }
 
 #define VMA_PID_RESET_PERIOD (4 * sysctl_numa_balancing_scan_delay)
-- 
2.34.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ