From mboxrd@z Thu Jan 1 00:00:00 1970 From: Stephane Eranian Date: Mon, 30 Jul 2007 09:30:34 +0000 Subject: [PATCH] remove unused TIF_NOTIFY_RESUME (take 2) Message-Id: <20070730093034.GD25162@frankl.hpl.hp.com> List-Id: References: <20070523095743.GC28832@frankl.hpl.hp.com> In-Reply-To: <20070523095743.GC28832@frankl.hpl.hp.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: linux-kernel@vger.kernel.org Cc: Stephane Eranian , ak@suse.de, akpm@linux-foundation.org, linux-ia64@vger.kernel.org, tony.luck@intel.com Hello, This following patch removes the TIF_NOTIFY_RESUME flag for thread_info. It is unused on all but the IA-64 architecture. This is take 2 of this patch. In this version, The definition is removed but no re-numbering of the TIF flags is done to minimize the possibility of errors and reduce the size of the patch. For IA-64, we ran out of low-order bits (first 7 bits). Adding a bit for perfmon would cause important code rescheduling changes in the kernel entry/exit path. Instead, we replace TIF_NOTIFY_RESUME with TIF_PERFMON_WORK. This way we get very close to what the new perfmon code base is doing. thread_info: remove unused TIF_NOTIFY_RESUME, add TIF_PERFMON_WORK to IA-64 Signed-off-by: Stephane Eranian diff --git a/arch/arm/kernel/entry-common.S b/arch/arm/kernel/entry-common.S index c589dc3..33e6cc2 100644 --- a/arch/arm/kernel/entry-common.S +++ b/arch/arm/kernel/entry-common.S @@ -46,7 +46,7 @@ fast_work_pending: work_pending: tst r1, #_TIF_NEED_RESCHED bne work_resched - tst r1, #_TIF_NOTIFY_RESUME | _TIF_SIGPENDING + tst r1, #_TIF_SIGPENDING beq no_work_pending mov r0, sp @ 'regs' mov r2, why @ 'syscall' diff --git a/arch/arm26/kernel/entry.S b/arch/arm26/kernel/entry.S index 91496cc..7ffcc6e 100644 --- a/arch/arm26/kernel/entry.S +++ b/arch/arm26/kernel/entry.S @@ -194,7 +194,7 @@ fast_work_pending: work_pending: tst r1, #_TIF_NEED_RESCHED bne work_resched - tst r1, #_TIF_NOTIFY_RESUME | _TIF_SIGPENDING + tst r1, #_TIF_SIGPENDING beq no_work_pending mov r0, sp @ 'regs' mov r2, why @ 'syscall' diff --git a/arch/ia64/kernel/perfmon.c b/arch/ia64/kernel/perfmon.c index b7133ca..af49b8f 100644 --- a/arch/ia64/kernel/perfmon.c +++ b/arch/ia64/kernel/perfmon.c @@ -361,9 +361,6 @@ typedef struct pfm_context { #define ctx_fl_no_msg ctx_flags.no_msg #define ctx_fl_can_restart ctx_flags.can_restart -#define PFM_SET_WORK_PENDING(t, v) do { (t)->thread.pfm_needs_checking = v; } while(0); -#define PFM_GET_WORK_PENDING(t) (t)->thread.pfm_needs_checking - /* * global information about all sessions * mostly used to synchronize between system wide and per-process @@ -591,13 +588,13 @@ pfm_set_task_notify(struct task_struct *task) struct thread_info *info; info = (struct thread_info *) ((char *) task + IA64_TASK_SIZE); - set_bit(TIF_NOTIFY_RESUME, &info->flags); + set_bit(TIF_PERFMON_WORK, &info->flags); } static inline void pfm_clear_task_notify(void) { - clear_thread_flag(TIF_NOTIFY_RESUME); + clear_thread_flag(TIF_PERFMON_WORK); } static inline void @@ -3728,7 +3725,7 @@ pfm_restart(pfm_context_t *ctx, void *arg, int count, struct pt_regs *regs) ctx->ctx_fl_trap_reason = PFM_TRAP_REASON_RESET; - PFM_SET_WORK_PENDING(task, 1); + set_ti_thread_flag(task_thread_info(task), TIF_PERFMON_WORK); pfm_set_task_notify(task); @@ -4609,7 +4606,7 @@ pfm_context_unload(pfm_context_t *ctx, void *arg, int count, struct pt_regs *reg task->thread.pfm_context = NULL; ctx->ctx_task = NULL; - PFM_SET_WORK_PENDING(task, 0); + clear_ti_thread_flag(task_thread_info(task), TIF_PERFMON_WORK); ctx->ctx_fl_trap_reason = PFM_TRAP_REASON_NONE; ctx->ctx_fl_can_restart = 0; @@ -5085,7 +5082,7 @@ pfm_handle_work(void) PROTECT_CTX(ctx, flags); - PFM_SET_WORK_PENDING(current, 0); + clear_thread_flag(TIF_PERFMON_WORK); pfm_clear_task_notify(); @@ -5449,7 +5446,7 @@ pfm_overflow_handler(struct task_struct *task, pfm_context_t *ctx, u64 pmc0, str /* * set the perfmon specific checking pending work for the task */ - PFM_SET_WORK_PENDING(task, 1); + set_ti_thread_flag(task_thread_info(task), TIF_PERFMON_WORK); /* * when coming from ctxsw, current still points to the @@ -5464,9 +5461,8 @@ pfm_overflow_handler(struct task_struct *task, pfm_context_t *ctx, u64 pmc0, str must_notify = 1; } - DPRINT_ovfl(("owner [%d] pending=%ld reason=%u ovfl_pmds=0x%lx ovfl_notify=0x%lx masked=%d\n", + DPRINT_ovfl(("owner [%d] reason=%u ovfl_pmds=0x%lx ovfl_notify=0x%lx masked=%d\n", GET_PMU_OWNER() ? GET_PMU_OWNER()->pid : -1, - PFM_GET_WORK_PENDING(task), ctx->ctx_fl_trap_reason, ovfl_pmds, ovfl_notify, @@ -5884,7 +5880,7 @@ pfm_force_cleanup(pfm_context_t *ctx, struct pt_regs *regs) /* * disconnect the task from the context and vice-versa */ - PFM_SET_WORK_PENDING(task, 0); + clear_ti_thread_flag(task_thread_info(task), TIF_PERFMON_WORK); task->thread.pfm_context = NULL; task->thread.flags &= ~IA64_THREAD_PM_VALID; @@ -6864,7 +6860,7 @@ pfm_inherit(struct task_struct *task, struct pt_regs *regs) */ thread->pfm_context = NULL; - PFM_SET_WORK_PENDING(task, 0); + clear_ti_thread_flag(task_thread_info(task), TIF_PERFMON_WORK); /* * the psr bits are already set properly in copy_threads() diff --git a/arch/ia64/kernel/process.c b/arch/ia64/kernel/process.c index 4158906..ede2da2 100644 --- a/arch/ia64/kernel/process.c +++ b/arch/ia64/kernel/process.c @@ -165,7 +165,7 @@ do_notify_resume_user (sigset_t *unused, struct sigscratch *scr, long in_syscall } #ifdef CONFIG_PERFMON - if (current->thread.pfm_needs_checking) + if (test_thread_flag(TIF_PERFMON_WORK)) pfm_handle_work(); #endif diff --git a/arch/powerpc/kernel/entry_64.S b/arch/powerpc/kernel/entry_64.S index 2b66d53..9ef28da 100644 --- a/arch/powerpc/kernel/entry_64.S +++ b/arch/powerpc/kernel/entry_64.S @@ -546,7 +546,6 @@ END_FW_FTR_SECTION_IFSET(FW_FEATURE_ISERIES) rfid b . /* prevent speculative execution */ -/* Note: this must change if we start using the TIF_NOTIFY_RESUME bit */ do_work: #ifdef CONFIG_PREEMPT andi. r0,r3,MSR_PR /* Returning to user mode? */ diff --git a/arch/x86_64/kernel/entry.S b/arch/x86_64/kernel/entry.S index 830cfc6..1d232e5 100644 --- a/arch/x86_64/kernel/entry.S +++ b/arch/x86_64/kernel/entry.S @@ -282,7 +282,7 @@ sysret_careful: sysret_signal: TRACE_IRQS_ON sti - testl $(_TIF_SIGPENDING|_TIF_NOTIFY_RESUME|_TIF_SINGLESTEP|_TIF_MCE_NOTIFY),%edx + testl $(_TIF_SIGPENDING|_TIF_SINGLESTEP|_TIF_MCE_NOTIFY),%edx jz 1f /* Really a signal */ @@ -375,7 +375,7 @@ int_very_careful: jmp int_restore_rest int_signal: - testl $(_TIF_NOTIFY_RESUME|_TIF_SIGPENDING|_TIF_SINGLESTEP|_TIF_MCE_NOTIFY),%edx + testl $(_TIF_SIGPENDING|_TIF_SINGLESTEP|_TIF_MCE_NOTIFY),%edx jz 1f movq %rsp,%rdi # &ptregs -> arg1 xorl %esi,%esi # oldset -> arg2 @@ -599,7 +599,7 @@ retint_careful: jmp retint_check retint_signal: - testl $(_TIF_SIGPENDING|_TIF_NOTIFY_RESUME|_TIF_SINGLESTEP|_TIF_MCE_NOTIFY),%edx + testl $(_TIF_SIGPENDING|_TIF_SINGLESTEP|_TIF_MCE_NOTIFY),%edx jz retint_swapgs TRACE_IRQS_ON sti diff --git a/include/asm-alpha/thread_info.h b/include/asm-alpha/thread_info.h index 48a22e3..beadb49 100644 --- a/include/asm-alpha/thread_info.h +++ b/include/asm-alpha/thread_info.h @@ -67,7 +67,6 @@ register struct thread_info *__current_thread_info __asm__("$8"); * TIF_SYSCALL_TRACE is known to be 0 via blbs. */ #define TIF_SYSCALL_TRACE 0 /* syscall trace active */ -#define TIF_NOTIFY_RESUME 1 /* resumption notification requested */ #define TIF_SIGPENDING 2 /* signal pending */ #define TIF_NEED_RESCHED 3 /* rescheduling necessary */ #define TIF_POLLING_NRFLAG 4 /* poll_idle is polling NEED_RESCHED */ @@ -79,15 +78,13 @@ register struct thread_info *__current_thread_info __asm__("$8"); #define TIF_RESTORE_SIGMASK 10 /* restore signal mask in do_signal */ #define _TIF_SYSCALL_TRACE (1<