[PATCH 2/2] powerpc: tm: Enable transactional memory (TM) lazily for userspace
Cyril Bur
cyrilbur at gmail.com
Mon Sep 19 15:26:28 AEST 2016
On Mon, 2016-09-19 at 12:47 +0800, Simon Guo wrote:
> 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.
>
Doing so would extend the window that we keep TM enabled for when we
might not need to. It is possible that we could assume that if
MSR_TM_ACTIVE() then they're in codepathes that will reuse TM again
soon so load_tm = 0 could be a good idea but there's really no way to
know. Food for thought I guess...
Maybe?
Good thought,
Cyril
> Thanks,
> - Simon
More information about the Linuxppc-dev
mailing list