Re: [PATCH] md: use TASK_IDLE instead of blocking signals

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Oct 18, 2017 at 07:01:11PM -0400, Mikulas Patocka wrote:
> Hi - I submit this patch for the next merge window:
> 
> 
> Some times ago, I made a patch f9c79bc05a2a 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.

thanks, applied! 
> Signed-off-by: Mikulas Patocka <mpatocka@xxxxxxxxxx>
> 
> ---
>  drivers/md/raid1.c |    7 +------
>  drivers/md/raid5.c |    7 +------
>  2 files changed, 2 insertions(+), 12 deletions(-)
> 
> Index: linux-2.6/drivers/md/raid1.c
> ===================================================================
> --- linux-2.6.orig/drivers/md/raid1.c
> +++ linux-2.6/drivers/md/raid1.c
> @@ -37,7 +37,6 @@
>  #include <linux/module.h>
>  #include <linux/seq_file.h>
>  #include <linux/ratelimit.h>
> -#include <linux/sched/signal.h>
>  
>  #include <trace/events/block.h>
>  
> @@ -1322,9 +1321,8 @@ static void raid1_write_request(struct m
>  		 */
>  		DEFINE_WAIT(w);
>  		for (;;) {
> -			sigset_t full, old;
>  			prepare_to_wait(&conf->wait_barrier,
> -					&w, TASK_INTERRUPTIBLE);
> +					&w, TASK_IDLE);
>  			if (bio_end_sector(bio) <= mddev->suspend_lo ||
>  			    bio->bi_iter.bi_sector >= mddev->suspend_hi ||
>  			    (mddev_is_clustered(mddev) &&
> @@ -1332,10 +1330,7 @@ static void raid1_write_request(struct m
>  				     bio->bi_iter.bi_sector,
>  				     bio_end_sector(bio))))
>  				break;
> -			sigfillset(&full);
> -			sigprocmask(SIG_BLOCK, &full, &old);
>  			schedule();
> -			sigprocmask(SIG_SETMASK, &old, NULL);
>  		}
>  		finish_wait(&conf->wait_barrier, &w);
>  	}
> Index: linux-2.6/drivers/md/raid5.c
> ===================================================================
> --- linux-2.6.orig/drivers/md/raid5.c
> +++ linux-2.6/drivers/md/raid5.c
> @@ -55,7 +55,6 @@
>  #include <linux/ratelimit.h>
>  #include <linux/nodemask.h>
>  #include <linux/flex_array.h>
> -#include <linux/sched/signal.h>
>  
>  #include <trace/events/block.h>
>  #include <linux/list_sort.h>
> @@ -5691,14 +5690,10 @@ static bool raid5_make_request(struct md
>  				 * wait.
>  				 */
>  				prepare_to_wait(&conf->wait_for_overlap,
> -						&w, TASK_INTERRUPTIBLE);
> +						&w, TASK_IDLE);
>  				if (logical_sector >= mddev->suspend_lo &&
>  				    logical_sector < mddev->suspend_hi) {
> -					sigset_t full, old;
> -					sigfillset(&full);
> -					sigprocmask(SIG_BLOCK, &full, &old);
>  					schedule();
> -					sigprocmask(SIG_SETMASK, &old, NULL);
>  					do_prepare = true;
>  				}
>  				goto retry;
> --
> To unsubscribe from this list: send the line "unsubscribe linux-raid" in
> the body of a message to majordomo@xxxxxxxxxxxxxxx
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line "unsubscribe linux-raid" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux RAID Wiki]     [ATA RAID]     [Linux SCSI Target Infrastructure]     [Linux Block]     [Linux IDE]     [Linux SCSI]     [Linux Hams]     [Device Mapper]     [Device Mapper Cryptographics]     [Kernel]     [Linux Admin]     [Linux Net]     [GFS]     [RPM]     [git]     [Yosemite Forum]


  Powered by Linux