https://github.com/vitalybuka updated 
https://github.com/llvm/llvm-project/pull/231058

>From 0f8a76dd9aa6e77ca69b29fc7f76b08127c6514c Mon Sep 17 00:00:00 2001
From: Vitaly Buka <[email protected]>
Date: Sun, 11 Oct 2026 20:28:23 -0700
Subject: [PATCH] pin to single CPU instead of chunking memset

Created using spr 1.3.7
---
 compiler-rt/test/msan/release_origin.c | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)

diff --git a/compiler-rt/test/msan/release_origin.c 
b/compiler-rt/test/msan/release_origin.c
index 560aee5182207..182f9cefd5683 100644
--- a/compiler-rt/test/msan/release_origin.c
+++ b/compiler-rt/test/msan/release_origin.c
@@ -1,7 +1,11 @@
 // RUN: %clang_msan -fsanitize-memory-track-origins=0 -O0 %s -o %t && env 
MSAN_OPTIONS=soft_rss_limit_mb=60:verbosity=1:allocator_may_return_null=1 %run 
%t 2>&1 | FileCheck %s -implicit-check-not="soft rss limit" 
-check-prefixes=CHECK,NOORIG
 // RUN: %clang_msan -fsanitize-memory-track-origins=2 -O0 %s -o %t && env 
MSAN_OPTIONS=soft_rss_limit_mb=150:verbosity=1:allocator_may_return_null=1 %run 
%t 2>&1 | FileCheck %s -implicit-check-not="soft rss limit" 
-check-prefixes=CHECK,ORIGIN
 
+#define _GNU_SOURCE
 #include <assert.h>
+#ifdef __linux__
+#  include <sched.h>
+#endif
 #include <sanitizer/allocator_interface.h>
 #include <stdio.h>
 #include <stdlib.h>
@@ -11,13 +15,21 @@
 void *p;
 
 int main(int argc, char **argv) {
+#ifdef __linux__
+  int cpu = sched_getcpu();
+  if (cpu >= 0 && cpu < CPU_SETSIZE) {
+    cpu_set_t cpus;
+    CPU_ZERO(&cpus);
+    CPU_SET(cpu, &cpus);
+    sched_setaffinity(0, sizeof(cpus), &cpus);
+  }
+#endif
   int s = 100 * 1024 * 1024;
   fprintf(stderr, "malloc\n");
   p = malloc(s);
   sleep(1);
   fprintf(stderr, "memset\n");
-  for (int i = 0; i < s; i += 1024 * 1024)
-    memset((char *)p + i, 1, 1024 * 1024);
+  memset(p, 1, s);
   sleep(1);
   fprintf(stderr, "free\n");
   free(p);

_______________________________________________
llvm-branch-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits

Reply via email to