Messages in this thread Patch in this message | | | Date | Fri, 04 Feb 2022 14:35:50 -0300 | From | Marcelo Tosatti <> | Subject | [patch v11 13/13] task isolation: only TIF_TASK_ISOL if task isolation is enabled |
| |
This avoids processing of TIF_TASK_ISOL, when returning to userspace, for tasks which do not have task isolation configured.
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Index: linux-2.6/include/linux/task_isolation.h =================================================================== --- linux-2.6.orig/include/linux/task_isolation.h +++ linux-2.6/include/linux/task_isolation.h @@ -5,6 +5,8 @@ #ifdef CONFIG_TASK_ISOLATION +#include <uapi/linux/prctl.h> + struct task_isol_info { /* Which features have been configured */ u64 conf_mask; @@ -51,6 +53,24 @@ int __copy_task_isol(struct task_struct void task_isol_exit_to_user_mode(void); +static inline bool task_isol_quiesce_activated(struct task_struct *tsk, + u64 quiesce_mask) +{ + struct task_isol_info *i; + + i = tsk->task_isol_info; + if (!i) + return false; + + if (i->active_mask != ISOL_F_QUIESCE) + return false; + + if ((i->quiesce_mask & quiesce_mask) == quiesce_mask) + return true; + + return false; +} + #else static inline void task_isol_exit_to_user_mode(void) @@ -105,6 +125,12 @@ static inline int prctl_task_isol_activa return -EOPNOTSUPP; } +static inline bool task_isol_quiesce_activated(struct task_struct *tsk, + u64 quiesce_mask) +{ + return false; +} + #endif /* CONFIG_TASK_ISOLATION */ #endif /* __LINUX_TASK_ISOL_H */ Index: linux-2.6/mm/vmstat.c =================================================================== --- linux-2.6.orig/mm/vmstat.c +++ linux-2.6/mm/vmstat.c @@ -28,6 +28,7 @@ #include <linux/mm_inline.h> #include <linux/page_ext.h> #include <linux/page_owner.h> +#include <linux/task_isolation.h> #include "internal.h" @@ -344,7 +345,8 @@ static inline void mark_vmstat_dirty(voi return; raw_cpu_write(vmstat_dirty, true); - set_thread_flag(TIF_TASK_ISOL); + if (task_isol_quiesce_activated(current, ISOL_F_QUIESCE_VMSTATS)) + set_thread_flag(TIF_TASK_ISOL); } void init_sync_vmstat(void)
| |