anolis: crypto: ccp: use time_after() instead of time_before() to checks schedule condition
ANBZ: #22926 Used time_before(jiffies, last_je) in psp_mutex_lock_timeout() which yields CPU too early. Fixed to time_after(jiffies, last_je + msecs_to_jiffies(100)) for proper 100ms wait. Signed-off-by: xiongmengbiao <xiongmengbiao@hygon.cn> Reviewed-by: Guixin Liu <kanie@linux.alibaba.com> Link: https://gitee.com/anolis/cloud-kernel/pulls/5532
This commit is contained in:
parent
7fc3abd8b2
commit
71a37bdc5f
|
@ -84,7 +84,7 @@ int psp_mutex_lock_timeout(struct psp_mutex *mutex, uint64_t ms)
|
|||
int ret = 0;
|
||||
unsigned long je, last_je;
|
||||
|
||||
last_je = jiffies + msecs_to_jiffies(100);
|
||||
last_je = jiffies;
|
||||
je = jiffies + msecs_to_jiffies(ms);
|
||||
do {
|
||||
if (psp_mutex_trylock(mutex)) {
|
||||
|
@ -93,9 +93,9 @@ int psp_mutex_lock_timeout(struct psp_mutex *mutex, uint64_t ms)
|
|||
}
|
||||
|
||||
// avoid triggering soft lockup warning
|
||||
if (time_before(jiffies, last_je)) {
|
||||
if (time_after(jiffies, last_je + msecs_to_jiffies(100))) {
|
||||
schedule();
|
||||
last_je = jiffies + msecs_to_jiffies(100);
|
||||
last_je = jiffies;
|
||||
}
|
||||
} while ((ms == 0) || time_before(jiffies, je));
|
||||
|
||||
|
|
Loading…
Reference in New Issue