kernel: mem_domain: Add to current thread should configure immediately.

when a current thread is added to a memory domain the pages/sections
must be configured immediately.
A problem occurs when we add a thread to current and then drop
down to usermode. In such a case memory domain will become active
the next time a swap occurs.

Signed-off-by: Adithya Baglody <adithya.nagaraj.baglody@intel.com>
diff --git a/kernel/mem_domain.c b/kernel/mem_domain.c
index 64db41e..c50e19e 100644
--- a/kernel/mem_domain.c
+++ b/kernel/mem_domain.c
@@ -158,6 +158,10 @@
 			 &thread->mem_domain_info.mem_domain_q_node);
 	thread->mem_domain_info.mem_domain = domain;
 
+	if (_current == thread) {
+		_arch_mem_domain_configure(thread);
+	}
+
 	irq_unlock(key);
 }