Skip to content

Commit

Permalink
Revert "bcache: ignore pending signals when creating gc and allocator…
Browse files Browse the repository at this point in the history
… thread"

This reverts commit 0b96da6.

We can't just go flushing random signals, under the assumption that the
OOM killer will just do something else. It's not safe from the OOM
perspective, and it could also cause other signals to get randomly lost.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
  • Loading branch information
Jens Axboe committed Mar 3, 2020
1 parent e959e54 commit 764b53b
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 29 deletions.
18 changes: 2 additions & 16 deletions drivers/md/bcache/alloc.c
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@
#include <linux/blkdev.h>
#include <linux/kthread.h>
#include <linux/random.h>
#include <linux/sched/signal.h>
#include <trace/events/bcache.h>

#define MAX_OPEN_BUCKETS 128
Expand Down Expand Up @@ -734,21 +733,8 @@ int bch_open_buckets_alloc(struct cache_set *c)

int bch_cache_allocator_start(struct cache *ca)
{
struct task_struct *k;

/*
* In case previous btree check operation occupies too many
* system memory for bcache btree node cache, and the
* registering process is selected by OOM killer. Here just
* ignore the SIGKILL sent by OOM killer if there is, to
* avoid kthread_run() being failed by pending signals. The
* bcache registering process will exit after the registration
* done.
*/
if (signal_pending(current))
flush_signals(current);

k = kthread_run(bch_allocator_thread, ca, "bcache_allocator");
struct task_struct *k = kthread_run(bch_allocator_thread,
ca, "bcache_allocator");
if (IS_ERR(k))
return PTR_ERR(k);

Expand Down
13 changes: 0 additions & 13 deletions drivers/md/bcache/btree.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@
#include <linux/random.h>
#include <linux/rcupdate.h>
#include <linux/sched/clock.h>
#include <linux/sched/signal.h>
#include <linux/rculist.h>
#include <linux/delay.h>
#include <trace/events/bcache.h>
Expand Down Expand Up @@ -1914,18 +1913,6 @@ static int bch_gc_thread(void *arg)

int bch_gc_thread_start(struct cache_set *c)
{
/*
* In case previous btree check operation occupies too many
* system memory for bcache btree node cache, and the
* registering process is selected by OOM killer. Here just
* ignore the SIGKILL sent by OOM killer if there is, to
* avoid kthread_run() being failed by pending signals. The
* bcache registering process will exit after the registration
* done.
*/
if (signal_pending(current))
flush_signals(current);

c->gc_thread = kthread_run(bch_gc_thread, c, "bcache_gc");
return PTR_ERR_OR_ZERO(c->gc_thread);
}
Expand Down

0 comments on commit 764b53b

Please sign in to comment.