Re: [PATCH] mm: Make truncate_inode_pages_range() killable

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

 



On Fri, 2017-04-14 at 14:55 -0700, Bart Van Assche wrote:
> diff --git a/mm/truncate.c b/mm/truncate.c
> index 6263affdef88..91abd16d74f8 100644
> --- a/mm/truncate.c
> +++ b/mm/truncate.c
> @@ -20,6 +20,7 @@
>  #include <linux/task_io_accounting_ops.h>
>  #include <linux/buffer_head.h>	/* grr. try_to_release_page,
>  				   do_invalidatepage */
> +#include <linux/sched/signal.h>
>  #include <linux/shmem_fs.h>
>  #include <linux/cleancache.h>
>  #include <linux/rmap.h>
> @@ -366,7 +367,7 @@ void truncate_inode_pages_range(struct address_space *mapping,
>  		return;
>  
>  	index = start;
> -	for ( ; ; ) {
> +	for ( ; !signal_pending_state(TASK_WAKEKILL, current); ) {
>  		cond_resched();
>  		if (!pagevec_lookup_entries(&pvec, mapping, index,
>  			min(end - index, (pgoff_t)PAGEVEC_SIZE), indices)) {
> @@ -400,7 +401,8 @@ void truncate_inode_pages_range(struct address_space *mapping,
>  				continue;
>  			}
>  
> -			lock_page(page);
> +			if (lock_page_killable(page))
> +				break;
>  			WARN_ON(page_to_index(page) != index);
>  			wait_on_page_writeback(page);
>  			truncate_inode_page(mapping, page);

Sorry but a small part of this patch got left out accidentally:

diff --git a/kernel/signal.c b/kernel/signal.c
index 7e59ebc2c25e..a02b273a4a1c 100644
--- a/kernel/signal.c
+++ b/kernel/signal.c
@@ -869,10 +869,10 @@ static inline int wants_signal(int sig, struct task_struct *p)
 {
 	if (sigismember(&p->blocked, sig))
 		return 0;
-	if (p->flags & PF_EXITING)
-		return 0;
 	if (sig == SIGKILL)
 		return 1;
+	if (p->flags & PF_EXITING)
+		return 0;
 	if (task_is_stopped_or_traced(p))
 		return 0;
 	return task_curr(p) || !signal_pending(p);

Does anyone who is on the CC-list of this e-mail know whether this change
is acceptable? As far as I can see the most recent change to that function
was made through the following commit:

commit 188a1eafa03aaa5e5fe6f53e637e704cd2c31c7c
Author: Linus Torvalds <torvalds@xxxxxxxxxxx>
Date:   Fri Sep 23 13:22:21 2005 -0700

    Make sure SIGKILL gets proper respect

Thanks,

Bart.
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@xxxxxxxxx.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href



[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]
  Powered by Linux