[PATCH 2/2] powerpc: tm: Enable transactional memory (TM) lazily for userspace
Simon Guo
wei.guo.simon at gmail.com
Mon Sep 19 14:47:19 AEST 2016
On Wed, Sep 14, 2016 at 06:02:16PM +1000, Cyril Bur wrote:
> @@ -954,8 +963,16 @@ static inline void __switch_to_tm(struct task_struct *prev,
> struct task_struct *new)
> {
> if (cpu_has_feature(CPU_FTR_TM)) {
> - tm_enable();
> - tm_reclaim_task(prev);
> + if (tm_enabled(prev) || tm_enabled(new))
> + tm_enable();
> +
> + if (tm_enabled(prev)) {
> + prev->thread.load_tm++;
> + tm_reclaim_task(prev);
> + if (!MSR_TM_ACTIVE(prev->thread.regs->msr) && prev->thread.load_tm == 0)
> + prev->thread.regs->msr &= ~MSR_TM;
> + }
Hi Cyril,
If MSR_TM_ACTIVE(), is it better to reset load_tm to 0?
Other looks good to me.
Thanks,
- Simon
More information about the Linuxppc-dev
mailing list