[3/3] crypto: tcrypt - yield at end of test

Message ID 20221219203733.3063192-4-elliott@hpe.com
State New
Headers
Series crypto: yield at end of operations |

Commit Message

Elliott, Robert (Servers) Dec. 19, 2022, 8:37 p.m. UTC
  Call cond_resched() to let the scheduler reschedule the
CPU at the end of each test pass.

If the kernel is configured with CONFIG_PREEMPT_NONE=y (or
preempt=none is used on the kernel command line), the only
time the scheduler will intervene is when cond_resched()
is called. So, repeated calls to
	modprobe tcrypt mode=<something>

hold the CPU for a long time.

Signed-off-by: Robert Elliott <elliott@hpe.com>
---
 crypto/tcrypt.c | 1 +
 1 file changed, 1 insertion(+)
  

Comments

Herbert Xu Dec. 20, 2022, 3:55 a.m. UTC | #1
On Mon, Dec 19, 2022 at 02:37:33PM -0600, Robert Elliott wrote:
> Call cond_resched() to let the scheduler reschedule the
> CPU at the end of each test pass.
> 
> If the kernel is configured with CONFIG_PREEMPT_NONE=y (or
> preempt=none is used on the kernel command line), the only
> time the scheduler will intervene is when cond_resched()
> is called. So, repeated calls to
> 	modprobe tcrypt mode=<something>
> 
> hold the CPU for a long time.
> 
> Signed-off-by: Robert Elliott <elliott@hpe.com>
> ---
>  crypto/tcrypt.c | 1 +
>  1 file changed, 1 insertion(+)

I don't really see the point of this.

Cheers,
  

Patch

diff --git a/crypto/tcrypt.c b/crypto/tcrypt.c
index 3e9e4adeef02..916bddbf4e75 100644
--- a/crypto/tcrypt.c
+++ b/crypto/tcrypt.c
@@ -3027,6 +3027,7 @@  static int do_test(const char *alg, u32 type, u32 mask, int m, u32 num_mb)
 
 	}
 
+	cond_resched();
 	return ret;
 }