mirror of
https://github.com/koverstreet/bcachefs-tools.git
synced 2025-02-23 00:00:02 +03:00
Run shrinkers when pthread_create fails
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
This commit is contained in:
parent
ded0160563
commit
71ed9f183b
@ -80,7 +80,13 @@ struct task_struct *kthread_create(int (*thread_fn)(void *data),
|
||||
pthread_attr_init(&attr);
|
||||
pthread_attr_setstacksize(&attr, 32 << 10);
|
||||
|
||||
ret = pthread_create(&p->thread, &attr, kthread_start_fn, p);
|
||||
for (unsigned i = 0; i < 10; i++) {
|
||||
ret = pthread_create(&p->thread, &attr, kthread_start_fn, p);
|
||||
if (!ret)
|
||||
break;
|
||||
|
||||
run_shrinkers(GFP_KERNEL, true);
|
||||
}
|
||||
if (ret)
|
||||
return ERR_PTR(-ret);
|
||||
pthread_setname_np(p->thread, p->comm);
|
||||
|
Loading…
Reference in New Issue
Block a user