lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Mon, 12 Mar 2007 09:14:59 +0100
From:	Pavel Machek <pavel@....cz>
To:	"Paul E. McKenney" <paulmck@...ux.vnet.ibm.com>
Cc:	"Rafael J. Wysocki" <rjw@...k.pl>, Oleg Nesterov <oleg@...sign.ru>,
	Anton Blanchard <anton@...ba.org>,
	Andrew Morton <akpm@...l.org>,
	LKML <linux-kernel@...r.kernel.org>,
	Aneesh Kumar <aneesh.kumar@...il.com>,
	Srivatsa Vaddagiri <vatsa@...ibm.com>,
	Gautham R Shenoy <ego@...ibm.com>
Subject: Re: [PATCH] kthread_should_stop_check_freeze (was: Re: [PATCH -mm 3/7] Freezer: Remove PF_NOFREEZE from rcutorture thread)

Hi!

> > > I personally think we should do the opposite, add kthread_should_stop_check_freeze()
> > > or something. kthread_should_stop() is like signal_pending(), we can use
> > > it under spin_lock (and it is probably used this way by some out-of-tree
> > > driver). The new helper is obviously "might_sleep()".
> > 
> > Something like this, perhaps:
> 
> Looks good to me!  The other kthread_should_stop() calls in
> rcutorture.c should also become kthread_should_top_check_freeze().
> 
> Acked-by: Paul E. McKenney <paulmck@...ux.vnet.ibm.com>
> 
> >  include/linux/kthread.h |    1 +
> >  kernel/kthread.c        |   16 ++++++++++++++++
> >  kernel/rcutorture.c     |    5 ++---
> >  3 files changed, 19 insertions(+), 3 deletions(-)
> > 
> > Index: linux-2.6.21-rc3-mm2/kernel/kthread.c
> > ===================================================================
> > --- linux-2.6.21-rc3-mm2.orig/kernel/kthread.c	2007-03-08 21:58:48.000000000 +0100
> > +++ linux-2.6.21-rc3-mm2/kernel/kthread.c	2007-03-11 18:32:59.000000000 +0100
> > @@ -13,6 +13,7 @@
> >  #include <linux/file.h>
> >  #include <linux/module.h>
> >  #include <linux/mutex.h>
> > +#include <linux/freezer.h>
> >  #include <asm/semaphore.h>
> > 
> >  /*
> > @@ -60,6 +61,21 @@ int kthread_should_stop(void)
> >  }
> >  EXPORT_SYMBOL(kthread_should_stop);
> > 
> > +/**
> > + * kthread_should_stop_check_freeze - check if the thread should return now and
> > + * if not, check if there is a freezing request pending for it.
> > + */
> > +int kthread_should_stop_check_freeze(void)
> > +{
> > +	might_sleep();
> > +	if (kthread_stop_info.k == current)
> > +		return 1;
> > +
> > +	try_to_freeze();
> > +	return 0;
> > +}

Can we get better name for this function?

Why is it useful? Caller can do "try_to_freeze()" as well, no?

> >  		}
> >  		rcu_torture_current_version++;
> >  		oldbatch = cur_ops->completed();
> > -		try_to_freeze();
> > -	} while (!kthread_should_stop() && !fullstop);
> > +	} while (!kthread_should_stop_check_freeze() && !fullstop);
> >  	VERBOSE_PRINTK_STRING("rcu_torture_writer task stopping");
> > -	while (!kthread_should_stop())
> > +	while (!kthread_should_stop_check_freeze())
> >  		schedule_timeout_uninterruptible(1);
> >  	return 0;

Aha, I see, here it probably becomes handy.

Actually, no... I do not see it. Why don't you simply move first
try_to_freeze() to beggining of the loop and do

-   while (!kthread_should_stop()) {
             schedule_timeout_uninterruptible(1);
	     try_to_freeze()
}
									Pavel
-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ