OSDN Git Service

bcache: ignore pending signals when creating gc and allocator thread
authorColy Li <colyli@suse.de>
Thu, 13 Feb 2020 14:12:05 +0000 (22:12 +0800)
committerJens Axboe <axboe@kernel.dk>
Thu, 13 Feb 2020 15:53:49 +0000 (08:53 -0700)
commit0b96da639a4874311e9b5156405f69ef9fc3bef8
tree4ae8a61d60b114f9a5b49973aa8dc1f76003e4d9
parentb74e58cd472cb782d34ecfad553c12c66eb02b6b
bcache: ignore pending signals when creating gc and allocator thread

When run a cache set, all the bcache btree node of this cache set will
be checked by bch_btree_check(). If the bcache btree is very large,
iterating all the btree nodes will occupy too much system memory and
the bcache registering process might be selected and killed by system
OOM killer. kthread_run() will fail if current process has pending
signal, therefore the kthread creating in run_cache_set() for gc and
allocator kernel threads are very probably failed for a very large
bcache btree.

Indeed such OOM is safe and the registering process will exit after
the registration done. Therefore this patch flushes pending signals
during the cache set start up, specificly in bch_cache_allocator_start()
and bch_gc_thread_start(), to make sure run_cache_set() won't fail for
large cahced data set.

Signed-off-by: Coly Li <colyli@suse.de>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
drivers/md/bcache/alloc.c
drivers/md/bcache/btree.c