s390/guarded storage: simplify task exit handling
authorHeiko Carstens <heiko.carstens@de.ibm.com>
Mon, 11 Sep 2017 09:24:23 +0000 (11:24 +0200)
committerMartin Schwidefsky <schwidefsky@de.ibm.com>
Thu, 28 Sep 2017 05:29:40 +0000 (07:29 +0200)
Free data structures required for guarded storage from
arch_release_task_struct(). This allows to simplify the code a bit,
and also makes the semantics a bit easier: arch_release_task_struct()
is never called from the task that is being removed.

In addition this allows to get rid of exit_thread() in a later patch.

Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
arch/s390/include/asm/processor.h
arch/s390/kernel/guarded_storage.c
arch/s390/kernel/process.c

index 4cc9bf53074bee22c66cc98dc56fd6bc3d0ba194..58eaaccd3cf03a0b423b344894b753ad7c42a49e 100644 (file)
@@ -220,8 +220,8 @@ void show_cacheinfo(struct seq_file *m);
 /* Free all resources held by a thread. */
 static inline void release_thread(struct task_struct *tsk) { }
 
-/* Free guarded storage control block for current */
-void exit_thread_gs(void);
+/* Free guarded storage control block */
+void guarded_storage_release(struct task_struct *tsk);
 
 unsigned long get_wchan(struct task_struct *p);
 #define task_pt_regs(tsk) ((struct pt_regs *) \
index 4920cf6ffa0073e8699bfe65b39b30f5685d2797..65b0eca2128c8f94397896f86f6c1ee6c4dec8f6 100644 (file)
 #include <asm/guarded_storage.h>
 #include "entry.h"
 
-void exit_thread_gs(void)
+void guarded_storage_release(struct task_struct *tsk)
 {
-       preempt_disable();
-       kfree(current->thread.gs_cb);
-       kfree(current->thread.gs_bc_cb);
-       current->thread.gs_cb = current->thread.gs_bc_cb = NULL;
-       preempt_enable();
+       kfree(tsk->thread.gs_cb);
+       kfree(tsk->thread.gs_bc_cb);
 }
 
 static int gs_enable(void)
index a7c6c5e944c7cd42d2605b91991b027c19a10294..0ecadd349106884e4a627604395ac1060b629f67 100644 (file)
@@ -48,8 +48,6 @@ extern void kernel_thread_starter(void);
  */
 void exit_thread(struct task_struct *tsk)
 {
-       if (tsk == current)
-               exit_thread_gs();
 }
 
 void flush_thread(void)
@@ -59,6 +57,7 @@ void flush_thread(void)
 void arch_release_task_struct(struct task_struct *tsk)
 {
        runtime_instr_release(tsk);
+       guarded_storage_release(tsk);
 }
 
 int arch_dup_task_struct(struct task_struct *dst, struct task_struct *src)