Commit ae89fd3d authored by Mikulas Patocka's avatar Mikulas Patocka Committed by Shaohua Li

md: use TASK_IDLE instead of blocking signals

Hi - I submit this patch for the next merge window:

Some times ago, I made a patch f9c79bc0 that blocks signals around the
schedule() calls in MD. The MD subsystem needs to do an uninterruptible
sleep that is not accounted in load average - so we block signals and use
interruptible sleep.

The kernel has a special TASK_IDLE state for this purpose, so we can use
it instead of blocking signals. This patch doesn't fix any bug, it just
makes the code simpler.
Signed-off-by: default avatarMikulas Patocka <mpatocka@redhat.com>
Acked-by: default avatarNeilBrown <neilb@suse.com>
Signed-off-by: default avatarShaohua Li <shli@fb.com>
parent b03e0ccb
...@@ -37,7 +37,6 @@ ...@@ -37,7 +37,6 @@
#include <linux/module.h> #include <linux/module.h>
#include <linux/seq_file.h> #include <linux/seq_file.h>
#include <linux/ratelimit.h> #include <linux/ratelimit.h>
#include <linux/sched/signal.h>
#include <trace/events/block.h> #include <trace/events/block.h>
...@@ -1320,18 +1319,14 @@ static void raid1_write_request(struct mddev *mddev, struct bio *bio, ...@@ -1320,18 +1319,14 @@ static void raid1_write_request(struct mddev *mddev, struct bio *bio,
*/ */
DEFINE_WAIT(w); DEFINE_WAIT(w);
for (;;) { for (;;) {
sigset_t full, old;
prepare_to_wait(&conf->wait_barrier, prepare_to_wait(&conf->wait_barrier,
&w, TASK_INTERRUPTIBLE); &w, TASK_IDLE);
if (!mddev_is_clustered(mddev) || if (!mddev_is_clustered(mddev) ||
!md_cluster_ops->area_resyncing(mddev, WRITE, !md_cluster_ops->area_resyncing(mddev, WRITE,
bio->bi_iter.bi_sector, bio->bi_iter.bi_sector,
bio_end_sector(bio))) bio_end_sector(bio)))
break; break;
sigfillset(&full);
sigprocmask(SIG_BLOCK, &full, &old);
schedule(); schedule();
sigprocmask(SIG_SETMASK, &old, NULL);
} }
finish_wait(&conf->wait_barrier, &w); finish_wait(&conf->wait_barrier, &w);
} }
......
...@@ -55,7 +55,6 @@ ...@@ -55,7 +55,6 @@
#include <linux/ratelimit.h> #include <linux/ratelimit.h>
#include <linux/nodemask.h> #include <linux/nodemask.h>
#include <linux/flex_array.h> #include <linux/flex_array.h>
#include <linux/sched/signal.h>
#include <trace/events/block.h> #include <trace/events/block.h>
#include <linux/list_sort.h> #include <linux/list_sort.h>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment