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

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

 



On 04/14, Bart Van Assche wrote:
>
> 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); ) {

you could just use fatal_signal_pending(current)

> 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;

Oh. This is the user-visible change. With this change you send a private signal to
a zombie thread and it will kill the process. Perhaps this is even good, and in fact
I was thinking about this change too many times, but I am not sure.

And afaics it won't really help. If the exiting task is multithreaded then another
kill(SIGKILL) won't wake other threads up, you will need tkill(tid_of_bloked_thread).

OTOH. Please note that fatal_signal_pending(exiting_thread) can be true even if you
do not send another SIGKILL.

But the main problem is that the behaviour of signal sent to PF_EXITING task is not
defined, it is not clear to me what do we actually want to do.

Oleg.

--
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=mailto:"dont@xxxxxxxxx";> email@xxxxxxxxx </a>



[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