#ifdef CONFIG_HSA_AMD
 extern int sched_policy;
 extern bool debug_evictions;
+extern bool no_system_mem_limit;
 #else
 static const int sched_policy = KFD_SCHED_POLICY_HWS;
 static const bool debug_evictions; /* = false */
+static const bool no_system_mem_limit;
 #endif
 
 extern int amdgpu_tmz;
 
 
        spin_lock(&kfd_mem_limit.mem_limit_lock);
 
+       if (kfd_mem_limit.system_mem_used + system_mem_needed >
+           kfd_mem_limit.max_system_mem_limit)
+               pr_debug("Set no_system_mem_limit=1 if using shared memory\n");
+
        if ((kfd_mem_limit.system_mem_used + system_mem_needed >
-            kfd_mem_limit.max_system_mem_limit) ||
+            kfd_mem_limit.max_system_mem_limit && !no_system_mem_limit) ||
            (kfd_mem_limit.ttm_mem_used + ttm_mem_needed >
             kfd_mem_limit.max_ttm_mem_limit) ||
            (adev->kfd.vram_used + vram_needed >
 
 bool debug_evictions;
 module_param(debug_evictions, bool, 0644);
 MODULE_PARM_DESC(debug_evictions, "enable eviction debug messages (false = default)");
+
+/**
+ * DOC: no_system_mem_limit(bool)
+ * Disable system memory limit, to support multiple process shared memory
+ */
+bool no_system_mem_limit;
+module_param(no_system_mem_limit, bool, 0644);
+MODULE_PARM_DESC(no_system_mem_limit, "disable system memory limit (false = default)");
+
 #endif
 
 /**