projects
/
platform
/
upstream
/
erofs-utils.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
2bd9d03
)
erofs-utils: optimize pthread_cond_signal calling
author
Noboru Asai
<asai@sijam.com>
Wed, 1 May 2024 02:24:20 +0000
(11:24 +0900)
committer
Gao Xiang
<hsiangkao@linux.alibaba.com>
Wed, 1 May 2024 06:45:37 +0000
(14:45 +0800)
Call pthread_cond_signal once per file.
Signed-off-by: Noboru Asai <asai@sijam.com>
Reviewed-by: Gao Xiang <hsiangkao@linux.alibaba.com>
Link:
https://lore.kernel.org/r/20240501022420.1881305-1-asai@sijam.com
[ Gao Xiang: add potential overflow detection. ]
Signed-off-by: Gao Xiang <hsiangkao@linux.alibaba.com>
lib/compress.c
patch
|
blob
|
history
diff --git
a/lib/compress.c
b/lib/compress.c
index 9772543d2c8c3e8962264a122257dbe415a7a3a1..e3e4c21d3afde458287fe9041b4de2d75d1cc4dc 100644
(file)
--- a/
lib/compress.c
+++ b/
lib/compress.c
@@
-1260,8
+1260,10
@@
void z_erofs_mt_workfn(struct erofs_work *work, void *tlsp)
out:
cwork->errcode = ret;
pthread_mutex_lock(&ictx->mutex);
- ++ictx->nfini;
- pthread_cond_signal(&ictx->cond);
+ if (++ictx->nfini >= ictx->seg_num) {
+ DBG_BUGON(ictx->nfini > ictx->seg_num);
+ pthread_cond_signal(&ictx->cond);
+ }
pthread_mutex_unlock(&ictx->mutex);
}