Re: [PATCH RT v2] crypto: limit more FPU-enabled sections

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Dec 01, 2017 at 02:32:56PM +0100, Sebastian Andrzej Siewior wrote:
> > diff --git a/arch/x86/kernel/fpu/core.c b/arch/x86/kernel/fpu/core.c
> > index f92a6593de1e..05321b98a55a 100644
> > --- a/arch/x86/kernel/fpu/core.c
> > +++ b/arch/x86/kernel/fpu/core.c
> > @@ -130,6 +130,18 @@ void kernel_fpu_begin(void)
> >  }
> >  EXPORT_SYMBOL_GPL(kernel_fpu_begin);
> >  
> > +void kernel_fpu_resched(void)
> > +{
> > +	WARN_ON_FPU(!this_cpu_read(in_kernel_fpu));
> > +
> > +	if (should_resched(PREEMPT_OFFSET)) {
> > +		kernel_fpu_end();
> > +		cond_resched();
> > +		kernel_fpu_begin();
> 
> I can do that but I would still keep it RT only to avoid the
> kernel_fpu_begin/end to be invoked more often on !RT.
> But why that cond_resched()? kernel_fpu_end() ends with preempt_enable()
> and this one should do the trick.

!PREEMPT kernels. The above should work for everyone and would allow
using 'long' kernel_fpu loops:

	kernel_fpu_begin();
	while (work) {
		do_work();
		kernel_fpu_resched();
	}
	kernel_fpu_end();

regardless of preempt setting.
--
To unsubscribe from this list: send the line "unsubscribe linux-rt-users" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [RT Stable]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux