Re: [PATCH -mm] workqueue: debug possible lockups in flush_workqueue
* Jarek Poplawski [EMAIL PROTECTED] wrote: Here is my patch proposal for detecting possible lockups, when flush_workqueue caller holds a lock (e.g. rtnl_lock) also used in work functions. looks good in principle - did you test it and it caught a bug that wasnt caught before? +#ifdef CONFIG_PROVE_LOCKING +/* Detect possible flush_workqueue() lockup with circular dependency check. */ +static struct lockdep_map flush_dep_map = { .name = flush_dep_map }; +#endif +#ifdef CONFIG_PROVE_LOCKING + /* lockdep dependency: flush_dep_map (read) before any lock: */ + lock_acquire(flush_dep_map, 0, 0, 1, 2, _THIS_IP_); +#endif i think the #ifdef should only be needed for the .name initialization - both lock_acquire() and lock_release() maps to NOP if PROVE_LOCKING is off. Ingo - To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: CFS and suspend2: hang in atomic copy
* Christian Hesse [EMAIL PROTECTED] wrote: I now got some error message from my system: http://www.eworm.de/tmp/cfs-suspend.jpg ah, this pinpoints a bug: for performance reasons pick_next_task() assumes that the runqueue is not empty - which is true for schedule(), but not in migrate_dead_tasks(). Does the patch below fix the crash for you? Ingo --- kernel/sched.c |2 ++ 1 file changed, 2 insertions(+) Index: linux/kernel/sched.c === --- linux.orig/kernel/sched.c +++ linux/kernel/sched.c @@ -4425,6 +4425,8 @@ static void migrate_dead_tasks(unsigned struct task_struct *next; for (;;) { + if (!rq-nr_running) + break; next = pick_next_task(rq, rq-curr); if (!next) break; - To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: CFS and suspend2: hang in atomic copy
* Bob Picco [EMAIL PROTECTED] wrote: I had hoped to collect more data with CFS V2. It crashes in scale_nice_down for s2ram when attempting to disable_nonboot_cpus. So part of traceback looks like (typed by hand with obvious omissions): scale_nice_down update_stats_wait_end - not shown in traceback because inlined pick_next_task_fair migration_call task_rq_lock notifier_call_chain _cpu_down disable_nonboot_cpus ok, this looks similar to the jpeg Christian did. Does the patch below fix the crash for you? Ingo --- kernel/sched.c |2 ++ 1 file changed, 2 insertions(+) Index: linux/kernel/sched.c === --- linux.orig/kernel/sched.c +++ linux/kernel/sched.c @@ -4425,6 +4425,8 @@ static void migrate_dead_tasks(unsigned struct task_struct *next; for (;;) { + if (!rq-nr_running) + break; next = pick_next_task(rq, rq-curr); if (!next) break; - To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [Announce] [patch] Modular Scheduler Core and Completely Fair
Pine.LNX.4.64.0704181515290.25880 () alien ! or ! mcafeemobile ! com Davide Libenzi wrote: On Wed, 18 Apr 2007, Ingo Molnar wrote: That's one reason why i dont think it's necessarily a good idea to group-schedule threads, we dont really want to do a per thread group percpu_alloc(). I still do not have clear how much overhead this will bring into the table, but I think (like Linus was pointing out) the hierarchy should look like: ... The run_queue concept (and data) that now is bound to a CPU, need to be replicated in: ROOT - VCPUs add themselves here VCPU - USERs add themselves here USER - PROCs add themselves here PROC - THREADs add themselves here THREAD (ultimate fine grained scheduling unit) So ROOT, VCPU, USER and PROC will have their own run_queue. ... I can't comment on the internals about run_queues, overhead and so on, but these discussion leads me to the idea about a dynamic *tree* of scheduler queues. With dynamic I mean that they are configured in user-space - be it with something like CLONE_NEW_SCHEDULER_CLASS, or possibly better some other interface to allow an *arbitrary* tree that is not coupled on the user/process/thread borders. New threads and processes are per default created in the parents queue, just like now. So user-space could build an tree like this (eg with a pam module): Default queue - init +- kernel-thread queue (to avoid having kernel threads being blocked by | user-space) +- cron, atd, sshd, unless they change their class +- user1 | +- X | +- kde | | + konsole | | \ kmail | |+ mail fetch thread | |+ mail filter thread | |+ GUI thread | | \- mplayer \- user2 +. Whether the queues are handled with some staircase behaviour, or CFS, or just get CPU time distributed by nice level, is another question - but they have to be fair only locally. Of course, that's simply some sort of moving the problem into user-space - but I think (and read that often enough) that the needs vary so much that a single, hardcoded system won't suffice. And we can try to get the right behaviour in each queue, just like now. Walking the tree might make the scheduler not fully O(1) - but per default only one queue is defined (or possibly two queues, one for kernel threads), and everything else can be done by user-space. The mentioned case of a web-server with gzip started would be done with having each httpd being in a queue just below init, and having everything else in another - or by nicing the webserver, as it's defined as important. (I believe that's called moving policy into userspace :-) Regards, Phil - To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] [KERNEL-DOC] kill warnings when building mandocs
snip I'm pretty sure the reason you cannot reproduce this warning is the line xsl:param name=refentry.version.suppress1/xsl:param which can be found in param.xsl, it being a part of the docbook-xsl distribution. The parameter's name is self-explanatory and a '1' suppresses the version generation. I was able to get this error because in the debian docbook-xsl package this param value is set to 0 by default. Hm, I don't seem to have that file installed (except in /usr/share/xml/docbook/stylesheet/...). Where would it normally be installed? /usr/share/xml/docbook/stylesheet/nwalsh/manpages/param.xsl here This means, some users will get this warning and some will not, depending on the setting in the param.xsl file. What is the way to go here wrt to a solution dealing with all cases: 1. patch the kernel-doc? 2. issue an info so that the user can suppress the annoying warning by themselves? 3. ...? Are other people seeing these warning messages ?? Hm, is anyone building the manpages target at all? If so, I think that we should patch the kernel-doc. I don't think that many people would read info about how to avoid the warnings. -- Regards/Gruß, Boris. - To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] [KERNEL-DOC] kill warnings when building mandocs
On Wed, Apr 18, 2007 at 10:16:54AM -0700, Randy Dunlap wrote: On Fri, 13 Apr 2007 11:29:43 +0200 Borislav Petkov wrote: Sorry for the improper whitespaces, here's a correct version. Signed-off-by: Borislav Petkov [EMAIL PROTECTED] Index: 21-rc6/scripts/kernel-doc === --- 21-rc6.orig/scripts/kernel-doc +++ 21-rc6/scripts/kernel-doc @@ -326,6 +326,32 @@ while ($ARGV[0] =~ m/^-(.*)/) { } } +# get kernel version +sub get_kernel_version() { +my $version; +open (FILE, ../Makefile) || die Can't open man kernel Makefile: $!; How are you running scripts/kernel-doc ? I had to change ../Makefile to just Makefile when using 'make htmldocs;. I knew this one would come around and bite me in the a**. My cmd is : make V=1 O=build/ htmldocs build.log 21 so man is cd-ing into the O=build directory and then the main Makefile is one level above it. Gonna fix this properly today and get back to you. +EOF: while (my $line = FILE) +{ + if ($line =~ /VERSION\s+=\s+(\d+)/) { +$version .= $1; +next; + } + if ($line =~ /PATCHLEVEL\s+=\s+(\d+)/) { +$version .= .$1; +next; + } + if ($line =~ /SUBLEVEL\s+=\s+(\d+)/) { +$version .= .$1; +next; + } + if ($line =~ /EXTRAVERSION\s+=\s+(.*)$/) { +$version .= $1; +last EOF; + } +} +return $version; +} # generate a sequence of code that will splice in highlighting information # using the s// operator. @@ -592,6 +618,7 @@ sub output_function_xml(%) { print refmeta\n; print refentrytitlephrase.$args{'function'}./phrase/refentrytitle\n; print manvolnum9/manvolnum\n; +print refmiscinfo class=\version\ . get_kernel_version() . /refmiscinfo\n; print /refmeta\n; print refnamediv\n; print refname.$args{'function'}./refname\n; @@ -668,6 +695,7 @@ sub output_struct_xml(%) { print refmeta\n; print refentrytitlephrase.$args{'type'}. .$args{'struct'}./phrase/refentrytitle\n; print manvolnum9/manvolnum\n; +print refmiscinfo class=\version\ . get_kernel_version() . /refmiscinfo\n; print /refmeta\n; print refnamediv\n; print refname.$args{'type'}. .$args{'struct'}./refname\n; @@ -752,6 +780,7 @@ sub output_enum_xml(%) { print refmeta\n; print refentrytitlephraseenum .$args{'enum'}./phrase/refentrytitle\n; print manvolnum9/manvolnum\n; +print refmiscinfo class=\version\ . get_kernel_version() . /refmiscinfo\n; print /refmeta\n; print refnamediv\n; print refnameenum .$args{'enum'}./refname\n; - --- ~Randy *** Remember to use Documentation/SubmitChecklist when testing your code *** -- Regards/Gruß, Boris. - To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [Announce] [patch] Modular Scheduler Core and Completely Fair Scheduler [CFS]
* Andrew Morton [EMAIL PROTECTED] wrote: And yes, by fairly, I mean fairly among all threads as a base resource class, because that's what Linux has always done Yes, there are potential compatibility problems. Example: a machine with 100 busy httpd processes and suddenly a big gzip starts up from console or cron. Under current kernels, that gzip will take ages and the httpds will take a 1% slowdown, which may well be exactly the behaviour which is desired. If we were to schedule by UID then the gzip suddenly gets 50% of the CPU and those httpd's all take a 50% hit, which could be quite serious. That's simple to fix via nicing, but people have to know to do that, and there will be a transition period where some disruption is possible. h. How about the following then: default to nice -10 for all (SCHED_NORMAL) kernel threads and all root-owned tasks. Root _is_ special: root already has disk space reserved to it, root has special memory allocation allowances, etc. I dont see a reason why we couldnt by default make all root tasks have nice -10. This would be instantly loved by sysadmins i suspect ;-) (distros that go the extra mile of making Xorg run under non-root could also go another extra one foot to renice that X server to -10.) Ingo - To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: CFS and suspend2: hang in atomic copy
* Ingo Molnar [EMAIL PROTECTED] wrote: i just tried the same and it suspended+resumed just fine: Restarting tasks ... done. Suspend2 debugging info: - Suspend core : 2.2.9.12 - Kernel Version : 2.6.21-rc7-CFS-v3 the key difference was that i should have attempted to sw-suspend to disk on an SMP box - that's where the bug triggered. Ingo - To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH -mm] workqueue: debug possible endless loop in cancel_rearming_delayed_work
Hi, IMHO cancel_rearming_delayed_work is dangerous place: - it assumes a work function always rearms (with no exception), which probably isn't explained enough now (but anyway should be checked in such loops); - probably possible (theoretical) scenario: a few work functions rearm themselves with very short, equal times; before flush_workqueue ends, their timers are already fired, so cancel_delayed_work has nothing to do. Maybe this patch could check, if I'm not dreaming... PS: of course the counter value below is a question of taste Signed-off-by: Jarek Poplawski [EMAIL PROTECTED] --- diff -Nurp 2.6.21-rc6-mm1-/kernel/workqueue.c 2.6.21-rc6-mm1/kernel/workqueue.c --- 2.6.21-rc6-mm1-/kernel/workqueue.c 2007-04-18 20:07:45.0 +0200 +++ 2.6.21-rc6-mm1/kernel/workqueue.c 2007-04-18 20:15:44.0 +0200 @@ -557,9 +557,12 @@ void cancel_rearming_delayed_work(struct /* Was it ever queued ? */ if (cwq != NULL) { struct workqueue_struct *wq = cwq-wq; + int i = 1000; - while (!cancel_delayed_work(dwork)) + while (!cancel_delayed_work(dwork)) { flush_workqueue(wq); + BUG_ON(!i--); + } } } EXPORT_SYMBOL(cancel_rearming_delayed_work); - To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [Announce] [patch] Modular Scheduler Core and Completely Fair Scheduler [CFS]
On Wed, 2007-04-18 at 23:48 +0200, Ingo Molnar wrote: so my current impression is that we want per UID accounting to solve the X problem, the kernel threads problem and the many-users problem, but i'd not want to do it for threads just yet because for them there's not really any apparent problem to be solved. If you really mean UID vs EUID as Linus mentioned, I suppose I could learn to login as !root, and set KDE up to always give me root shells. With a heavily reniced X (perfectly fine), that should indeed solve my daily usage pattern nicely (always need godmode for shells, but not for mozilla and ilk. 50/50 split automatic without renice of entire gui) -Mike - To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH v3] Bitbanging i2c bus driver using the GPIO API
Hi Len, On Wed, 18 Apr 2007 13:42:56 -0400, Lennart Sorensen wrote: On Sat, Apr 14, 2007 at 07:28:07PM +0200, Jean Delvare wrote: Otherwise it looks OK to me, I take the patch. If others have comments or objections, just speak up and submit incremental patches as needed. Now I would like to see platform code actually using this. Any idea how similar this new driver is to the scx200_i2c driver? As far as I can tell that driver is already a bit banged i2c over gpio lines. The major difference is that the implementation in scx200_i2c is hardware-specific, while the i2c-gpio driver is a generic one, so it's a lot better. What this means is that i2c-gpio obsoletes scx200_i2c, so I am inclined to delete scx200_i2c right away. I'm not even sure anyone still uses it now that scx200_acb has been fixed and is reported to work very well. If anyone really needs to do I2C over GPIO pins on SCx200, this should be reimplemented on top of i2c-gpio. It also looks to me like i2c-ixp2000 and i2c-ixp4xx are obsoleted by i2c-gpio. Deepak, can you please try using i2c-gpio instead and confirm that i2c-ixp2000 and i2c-ixp4xx can be deleted? Thanks, -- Jean Delvare - To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Remaining straight forward kthread API conversions...
The following patches are against 2.6.21.rc6-mm1. Hopefully that is enough to catch most of the recent development activity. I am aiming to remove all kernel threads that handle signals from user space, to remove all calls to daemonize and kernel_thread from non-core kernel code. kernel thrreads handling signals from user space is a problem because it makes the kernel thread part of the user/kernel API which make changing things difficult and it breaks as soon as you are inside of a pid namespace because you won't be able to see your kernel thread. Calling kernel_thread has problems because it returns a pid_t value which once we get to the pid namespace is context depending so it cannot be used to globally identify a process. kernel_thread is also a problem because it traps user space state and requires us to call daemonize to free that state. daemonize is a maintenance problem because every time you play with user space state and limiting things you need to remember to update daemonize. Occasionally it has taken years like in the case of the mount namespace before someone realizes they need to update it. With the kthread api we no longer need daemonize. In addition we don't want kernel threads visible in anything but the initial pid namespace or they will hold a reference to a child pid namespace. However calling kernel_thread from a non-kernel parent in a child pid namespace will give the thread a pid in the child pid namespace, and there is nothing daemonize can do about it. So daemonize appears impossible to support going forward, and I choose to remove all of it's callers rather than attempt to support it. Eric - To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH -mm] workqueue: debug possible lockups in flush_workqueue
On Thu, Apr 19, 2007 at 08:14:16AM +0200, Ingo Molnar wrote: * Jarek Poplawski [EMAIL PROTECTED] wrote: Here is my patch proposal for detecting possible lockups, when flush_workqueue caller holds a lock (e.g. rtnl_lock) also used in work functions. looks good in principle - did you test it and it caught a bug that wasnt caught before? Yes, but it was only my own testing bug... (I'm not a good tester, sorry). +#ifdef CONFIG_PROVE_LOCKING +/* Detect possible flush_workqueue() lockup with circular dependency check. */ +static struct lockdep_map flush_dep_map = { .name = flush_dep_map }; +#endif +#ifdef CONFIG_PROVE_LOCKING + /* lockdep dependency: flush_dep_map (read) before any lock: */ + lock_acquire(flush_dep_map, 0, 0, 1, 2, _THIS_IP_); +#endif i think the #ifdef should only be needed for the .name initialization - both lock_acquire() and lock_release() maps to NOP if PROVE_LOCKING is off. There is also DEBUG_LOCK_ALLOC without PROVE_LOCKING possibility, which isn't usable here. Jarek P. - To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] i386 balance_irq: Convert to the kthread api.
This patch just trivial converts from calling kernel_thread and daemonize to just calling kthread_run. Cc: Andi Kleen [EMAIL PROTECTED] Signed-off-by: Eric W. Biederman [EMAIL PROTECTED] --- arch/i386/kernel/io_apic.c |5 ++--- 1 files changed, 2 insertions(+), 3 deletions(-) diff --git a/arch/i386/kernel/io_apic.c b/arch/i386/kernel/io_apic.c index 24ac67c..84b412a 100644 --- a/arch/i386/kernel/io_apic.c +++ b/arch/i386/kernel/io_apic.c @@ -34,6 +34,7 @@ #include linux/msi.h #include linux/htirq.h #include linux/freezer.h +#include linux/kthread.h #include asm/io.h #include asm/smp.h @@ -660,8 +661,6 @@ static int balanced_irq(void *unused) unsigned long prev_balance_time = jiffies; long time_remaining = balanced_irq_interval; - daemonize(kirqd); - /* push everything to CPU 0 to give us a starting point. */ for (i = 0 ; i NR_IRQS ; i++) { irq_desc[i].pending_mask = cpumask_of_cpu(0); @@ -721,7 +720,7 @@ static int __init balanced_irq_init(void) } printk(KERN_INFO Starting balanced_irq\n); - if (kernel_thread(balanced_irq, NULL, CLONE_KERNEL) = 0) + if (!IS_ERR(kthread_run(balanced_irq, NULL, kirqd))) return 0; else printk(KERN_ERR balanced_irq_init: failed to spawn balanced_irq); -- 1.5.0.g53756 - To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] mtd_blkdevs: Convert to use the kthread API
From: Eric W. Biederman [EMAIL PROTECTED] - unquoted thread_run is used intead of kernel_thread, daemonize, and mucking around blocking signals directly. CC: David Woodhouse [EMAIL PROTECTED] Signed-off-by: Eric W. Biederman [EMAIL PROTECTED] --- drivers/mtd/mtd_blkdevs.c | 19 +-- 1 files changed, 5 insertions(+), 14 deletions(-) diff --git a/drivers/mtd/mtd_blkdevs.c b/drivers/mtd/mtd_blkdevs.c index db7397c..ed71d5e 100644 --- a/drivers/mtd/mtd_blkdevs.c +++ b/drivers/mtd/mtd_blkdevs.c @@ -21,6 +21,7 @@ #include linux/init.h #include linux/mutex.h #include linux/freezer.h +#include linux/kthread.h #include asm/uaccess.h static LIST_HEAD(blktrans_majors); @@ -84,17 +85,6 @@ static int mtd_blktrans_thread(void *arg) /* we might get involved when memory gets low, so use PF_MEMALLOC */ current-flags |= PF_MEMALLOC | PF_NOFREEZE; - daemonize(%sd, tr-name); - - /* daemonize() doesn't do this for us since some kernel threads - actually want to deal with signals. We can't just call - exit_sighand() since that'll cause an oops when we finally - do exit. */ - spin_lock_irq(current-sighand-siglock); - sigfillset(current-blocked); - recalc_sigpending(); - spin_unlock_irq(current-sighand-siglock); - spin_lock_irq(rq-queue_lock); while (!tr-blkcore_priv-exiting) { @@ -368,6 +358,7 @@ static struct mtd_notifier blktrans_notifier = { int register_mtd_blktrans(struct mtd_blktrans_ops *tr) { + struct task_struct *task; int ret, i; /* Register the notifier if/when the first device type is @@ -406,13 +397,13 @@ int register_mtd_blktrans(struct mtd_blktrans_ops *tr) blk_queue_hardsect_size(tr-blkcore_priv-rq, tr-blksize); tr-blkshift = ffs(tr-blksize) - 1; - ret = kernel_thread(mtd_blktrans_thread, tr, CLONE_KERNEL); - if (ret 0) { + task = kthread_run(mtd_blktrans_thread, tr, %sd, tr-name); + if (IS_ERR(task)) { blk_cleanup_queue(tr-blkcore_priv-rq); unregister_blkdev(tr-major, tr-name); kfree(tr-blkcore_priv); mutex_unlock(mtd_table_mutex); - return ret; + return PTR_ERR(task); } INIT_LIST_HEAD(tr-devs); -- 1.5.0.g53756 - To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] cpci_hotplug: Convert to use the kthread API
From: Eric W. Biederman [EMAIL PROTECTED] - unquoted kthread_run replaces the kernel_thread and daemonize calls during thread startup. Calls to signal_pending were also removed as it is currently impossible for the cpci_hotplug thread to receive signals. CC: Scott Murray [EMAIL PROTECTED] Signed-off-by: Eric W. Biederman [EMAIL PROTECTED] --- drivers/pci/hotplug/cpci_hotplug_core.c | 22 +++--- 1 files changed, 7 insertions(+), 15 deletions(-) diff --git a/drivers/pci/hotplug/cpci_hotplug_core.c b/drivers/pci/hotplug/cpci_hotplug_core.c index 6845515..c620c7e 100644 --- a/drivers/pci/hotplug/cpci_hotplug_core.c +++ b/drivers/pci/hotplug/cpci_hotplug_core.c @@ -33,6 +33,7 @@ #include linux/init.h #include linux/interrupt.h #include linux/smp_lock.h +#include linux/kthread.h #include asm/atomic.h #include linux/delay.h #include cpci_hotplug.h @@ -521,17 +522,13 @@ event_thread(void *data) { int rc; - lock_kernel(); - daemonize(cpci_hp_eventd); - unlock_kernel(); - dbg(%s - event thread started, __FUNCTION__); while (1) { dbg(event thread sleeping); down_interruptible(event_semaphore); dbg(event thread woken, thread_finished = %d, thread_finished); - if (thread_finished || signal_pending(current)) + if (thread_finished) break; do { rc = check_slots(); @@ -562,12 +559,8 @@ poll_thread(void *data) { int rc; - lock_kernel(); - daemonize(cpci_hp_polld); - unlock_kernel(); - while (1) { - if (thread_finished || signal_pending(current)) + if (thread_finished) break; if (controller-ops-query_enum()) { do { @@ -592,7 +585,7 @@ poll_thread(void *data) static int cpci_start_thread(void) { - int pid; + struct task_struct *task; /* initialize our semaphores */ init_MUTEX_LOCKED(event_semaphore); @@ -600,14 +593,13 @@ cpci_start_thread(void) thread_finished = 0; if (controller-irq) - pid = kernel_thread(event_thread, NULL, 0); + task = kthread_run(event_thread, NULL, cpci_hp_eventd); else - pid = kernel_thread(poll_thread, NULL, 0); - if (pid 0) { + task = kthread_run(poll_thread, NULL, cpci_hp_polld); + if (IS_ERR(task)) { err(Can't start up our thread); return -1; } - dbg(Our thread pid = %d, pid); return 0; } -- 1.5.0.g53756 - To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] ibmphp: Convert to use the kthreads API
From: Eric W. Biederman [EMAIL PROTECTED] - unquoted kthread_run replaces kernel_thread and dameonize. allow_signal is unnecessary and has been removed. tid_poll was unused and has been removed. Cc: Jyoti Shah [EMAIL PROTECTED] Cc: Greg Kroah-Hartman [EMAIL PROTECTED] Signed-off-by: Eric W. Biederman [EMAIL PROTECTED] --- drivers/pci/hotplug/ibmphp_hpc.c | 14 +- 1 files changed, 5 insertions(+), 9 deletions(-) diff --git a/drivers/pci/hotplug/ibmphp_hpc.c b/drivers/pci/hotplug/ibmphp_hpc.c index 46abaa8..27e12f1 100644 --- a/drivers/pci/hotplug/ibmphp_hpc.c +++ b/drivers/pci/hotplug/ibmphp_hpc.c @@ -34,6 +34,7 @@ #include linux/pci.h #include linux/init.h #include linux/mutex.h +#include linux/kthread.h #include ibmphp.h @@ -101,7 +102,6 @@ static int to_debug = 0; // global variables // static int ibmphp_shutdown; -static int tid_poll; static struct mutex sem_hpcaccess; // lock access to HPC static struct semaphore semOperations; // lock all operations and // access to data structures @@ -137,7 +137,6 @@ void __init ibmphp_hpc_initvars (void) init_MUTEX_LOCKED (sem_exit); to_debug = 0; ibmphp_shutdown = 0; - tid_poll = 0; debug (%s - Exit\n, __FUNCTION__); } @@ -1060,12 +1059,8 @@ static int hpc_poll_thread (void *data) { debug (%s - Entry\n, __FUNCTION__); - daemonize(hpc_poll); - allow_signal(SIGKILL); - poll_hpc (); - tid_poll = 0; debug (%s - Exit\n, __FUNCTION__); return 0; } @@ -1078,17 +1073,18 @@ static int hpc_poll_thread (void *data) *-*/ int __init ibmphp_hpc_start_poll_thread (void) { + struct task_struct *task; int rc = 0; debug (%s - Entry\n, __FUNCTION__); - tid_poll = kernel_thread (hpc_poll_thread, NULL, 0); - if (tid_poll 0) { + task = kthread_run(hpc_poll_thread, NULL, hpc_poll); + if (IS_ERR(task)) { err (%s - Error, thread not started\n, __FUNCTION__); rc = -1; } - debug (%s - Exit tid_poll[%d] rc[%d]\n, __FUNCTION__, tid_poll, rc); + debug (%s - Exit rc[%d]\n, __FUNCTION__, rc); return rc; } -- 1.5.0.g53756 - To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] i386 voyager: Convert the monitor thread to use the kthread API
From: Eric W. Biederman [EMAIL PROTECTED] - unquoted This patch just trivially replaces kernel_thread and daemonize with a single call to kthread_run. CC: James Bottomley [EMAIL PROTECTED] Signed-off-by: Eric W. Biederman [EMAIL PROTECTED] --- arch/i386/mach-voyager/voyager_thread.c |5 ++--- 1 files changed, 2 insertions(+), 3 deletions(-) diff --git a/arch/i386/mach-voyager/voyager_thread.c b/arch/i386/mach-voyager/voyager_thread.c index ebfd913..ee23d9b 100644 --- a/arch/i386/mach-voyager/voyager_thread.c +++ b/arch/i386/mach-voyager/voyager_thread.c @@ -23,6 +23,7 @@ #include linux/kmod.h #include linux/completion.h #include linux/sched.h +#include linux/kthread.h #include asm/desc.h #include asm/voyager.h #include asm/vic.h @@ -43,7 +44,7 @@ static __u8 set_timeout = 0; static int __init voyager_thread_start(void) { - if(kernel_thread(thread, NULL, CLONE_KERNEL) 0) { + if (IS_ERR(kthread_run(thread, NULL, %s, THREAD_NAME))) { /* This is serious, but not fatal */ printk(KERN_ERR Voyager: Failed to create system monitor thread!!!\n); return 1; @@ -122,8 +123,6 @@ thread(void *unused) kvoyagerd_running = 1; - daemonize(THREAD_NAME); - set_timeout = 0; init_timer(wakeup_timer); -- 1.5.0.g53756 - To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [ck] Announce - Staircase Deadline cpu scheduler v0.41
On Thu, 2007-04-19 at 10:41 +1000, Con Kolivas wrote: Mike you were the stick. (dirty job, somebody has to do it) - To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] synchro_test: Convert to the kthread API.
- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] bluetooth hidp: Convert to kthread API.
From: Eric W. Biederman [EMAIL PROTECTED] - unquoted This patch starts up khidp using kthread_run instead of kernel_thread and daemonize, resulting is slightly simpler and more maintainable code. Cc: Marcel Holtmann [EMAIL PROTECTED] Signed-off-by: Eric W. Biederman [EMAIL PROTECTED] --- net/bluetooth/hidp/core.c | 29 - 1 files changed, 16 insertions(+), 13 deletions(-) diff --git a/net/bluetooth/hidp/core.c b/net/bluetooth/hidp/core.c index df2c471..1c9b202 100644 --- a/net/bluetooth/hidp/core.c +++ b/net/bluetooth/hidp/core.c @@ -36,6 +36,7 @@ #include linux/init.h #include linux/wait.h #include linux/freezer.h +#include linux/kthread.h #include net/sock.h #include linux/input.h @@ -531,22 +532,11 @@ static int hidp_session(void *arg) struct sock *ctrl_sk = session-ctrl_sock-sk; struct sock *intr_sk = session-intr_sock-sk; struct sk_buff *skb; - int vendor = 0x, product = 0x; wait_queue_t ctrl_wait, intr_wait; BT_DBG(session %p, session); - if (session-input) { - vendor = session-input-id.vendor; - product = session-input-id.product; - } - - if (session-hid) { - vendor = session-hid-vendor; - product = session-hid-product; - } - daemonize(khidpd_%04x%04x, vendor, product); set_user_nice(current, -15); init_waitqueue_entry(ctrl_wait, current); @@ -747,7 +737,9 @@ static inline void hidp_setup_hid(struct hidp_session *session, struct hidp_conn int hidp_add_connection(struct hidp_connadd_req *req, struct socket *ctrl_sock, struct socket *intr_sock) { + int vendor = 0x, product = 0x; struct hidp_session *session, *s; + struct task_struct *task; int err; BT_DBG(); @@ -834,8 +826,19 @@ int hidp_add_connection(struct hidp_connadd_req *req, struct socket *ctrl_sock, hidp_set_timer(session); - err = kernel_thread(hidp_session, session, CLONE_KERNEL); - if (err 0) + if (session-input) { + vendor = session-input-id.vendor; + product = session-input-id.product; + } + + if (session-hid) { + vendor = session-hid-vendor; + product = session-hid-product; + } + task = kthread_run(hidp_session, session, + khidpd_%04x%04x, vendor, product); + err = PTR_ERR(task); + if (IS_ERR(task)) goto unlink; if (session-input) { -- 1.5.0.g53756 - To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] saa7134-tvaudio: Convert to kthread API.
From: Eric W. Biederman [EMAIL PROTECTED] - unquoted It is my goal to replace all kernel code that handles signals from user space, calls kernel_thread or calls daemonize. All of which the kthread_api makes unncessary. Handling signals from user space is a maintenance problem becuase using a kernel thread is an implementation detail and if user space cares it does not allow us to change the implementation. Calling daemonize is a problem because it has to undo a continually changing set of state generated by user space, requiring the implemetation to change continually. kernel_thread is a problem because it returns a pid_t value. Numeric pids are inherently racy and in the presence of a pid namespace they are no longer global making them useless for general use in the kernel. So this patch renames the pid member of struct saa7134_thread started and changes it's type from pid_t to int. All it has ever been used for is to detect if the kernel thread is has been started so this works. allow_signal(SIGTERM) and the calls to signal_pending have been removed they are needed for the driver to operation. The startup of tvaudio_thread and tvaudio_thread_dep have been modified to use kthread_run instead of a combination of kernel_thread and daemonize. The result is code that is slightly simpler and more maintainable. Cc: Hartmut Hackmann [EMAIL PROTECTED] Cc: Mauro Carvalho Chehab [EMAIL PROTECTED] Signed-off-by: Eric W. Biederman [EMAIL PROTECTED] --- drivers/media/video/saa7134/saa7134-tvaudio.c | 27 - drivers/media/video/saa7134/saa7134.h |2 +- 2 files changed, 14 insertions(+), 15 deletions(-) diff --git a/drivers/media/video/saa7134/saa7134-tvaudio.c b/drivers/media/video/saa7134/saa7134-tvaudio.c index 7b56041..b636cb1 100644 --- a/drivers/media/video/saa7134/saa7134-tvaudio.c +++ b/drivers/media/video/saa7134/saa7134-tvaudio.c @@ -27,6 +27,7 @@ #include linux/kernel.h #include linux/slab.h #include linux/delay.h +#include linux/kthread.h #include asm/div64.h #include saa7134-reg.h @@ -505,11 +506,9 @@ static int tvaudio_thread(void *data) unsigned int i, audio, nscan; int max1,max2,carrier,rx,mode,lastmode,default_carrier; - daemonize(%s, dev-name); - allow_signal(SIGTERM); for (;;) { tvaudio_sleep(dev,-1); - if (dev-thread.shutdown || signal_pending(current)) + if (dev-thread.shutdown) goto done; restart: @@ -618,7 +617,7 @@ static int tvaudio_thread(void *data) for (;;) { if (tvaudio_sleep(dev,5000)) goto restart; - if (dev-thread.shutdown || signal_pending(current)) + if (dev-thread.shutdown) break; if (UNSET == dev-thread.mode) { rx = tvaudio_getstereo(dev,tvaudio[i]); @@ -782,9 +781,6 @@ static int tvaudio_thread_ddep(void *data) struct saa7134_dev *dev = data; u32 value, norms, clock; - daemonize(%s, dev-name); - allow_signal(SIGTERM); - clock = saa7134_boards[dev-board].audio_clock; if (UNSET != audio_clock_override) clock = audio_clock_override; @@ -796,7 +792,7 @@ static int tvaudio_thread_ddep(void *data) for (;;) { tvaudio_sleep(dev,-1); - if (dev-thread.shutdown || signal_pending(current)) + if (dev-thread.shutdown) goto done; restart: @@ -986,14 +982,17 @@ int saa7134_tvaudio_init2(struct saa7134_dev *dev) break; } - dev-thread.pid = -1; + dev-thread.started = 0; if (my_thread) { + struct task_struct *task; /* start tvaudio thread */ init_waitqueue_head(dev-thread.wq); init_completion(dev-thread.exit); - dev-thread.pid = kernel_thread(my_thread,dev,0); - if (dev-thread.pid 0) - printk(KERN_WARNING %s: kernel_thread() failed\n, + task = kthread_run(my_thread, dev, %s, dev-name); + if (!IS_ERR(task)) + dev-thread.started = 1; + else + printk(KERN_WARNING %s: kthread_create() failed\n, dev-name); saa7134_tvaudio_do_scan(dev); } @@ -1005,7 +1004,7 @@ int saa7134_tvaudio_init2(struct saa7134_dev *dev) int saa7134_tvaudio_fini(struct saa7134_dev *dev) { /* shutdown tvaudio thread */ - if (dev-thread.pid = 0) { + if (dev-thread.started) { dev-thread.shutdown = 1; wake_up_interruptible(dev-thread.wq); wait_for_completion(dev-thread.exit); @@ -1020,7 +1019,7 @@ int saa7134_tvaudio_do_scan(struct saa7134_dev *dev)
[PATCH] ipv4/ipvs: Convert to kthread API
From: Eric W. Biederman [EMAIL PROTECTED] - unquoted Modify startup of ipvs sync threads to use kthread_run instead of a weird combination of calling kernel_thread to start a fork_sync_thread whose hole purpose in life was to call kernel_thread again starting the actually sync thread which called daemonize. To use kthread_run I had to move the name calcuation from sync_thread into start_sync_thread resulting in a small amount of code motion. The result is simpler and more maintainable piece of code. Cc: Wensong Zhang [EMAIL PROTECTED] Cc: Julian Anastasov [EMAIL PROTECTED] Cc: Simon Horman [EMAIL PROTECTED] Signed-off-by: Eric W. Biederman [EMAIL PROTECTED] --- net/ipv4/ipvs/ip_vs_sync.c | 49 ++- 1 files changed, 12 insertions(+), 37 deletions(-) diff --git a/net/ipv4/ipvs/ip_vs_sync.c b/net/ipv4/ipvs/ip_vs_sync.c index 7ea2d98..c4be9dc 100644 --- a/net/ipv4/ipvs/ip_vs_sync.c +++ b/net/ipv4/ipvs/ip_vs_sync.c @@ -29,6 +29,7 @@ #include linux/in.h #include linux/igmp.h /* for ip_mc_join_group */ #include linux/udp.h +#include linux/kthread.h #include net/ip.h #include net/sock.h @@ -750,34 +751,23 @@ static int sync_thread(void *startup) DECLARE_WAITQUEUE(wait, current); mm_segment_t oldmm; int state; - const char *name; /* increase the module use count */ ip_vs_use_count_inc(); - if (ip_vs_sync_state IP_VS_STATE_MASTER !sync_master_pid) { + if (ip_vs_sync_state IP_VS_STATE_MASTER !sync_master_pid) state = IP_VS_STATE_MASTER; - name = ipvs_syncmaster; - } else if (ip_vs_sync_state IP_VS_STATE_BACKUP !sync_backup_pid) { + else if (ip_vs_sync_state IP_VS_STATE_BACKUP !sync_backup_pid) state = IP_VS_STATE_BACKUP; - name = ipvs_syncbackup; - } else { + else { IP_VS_BUG(); ip_vs_use_count_dec(); return -EINVAL; } - daemonize(name); - oldmm = get_fs(); set_fs(KERNEL_DS); - /* Block all signals */ - spin_lock_irq(current-sighand-siglock); - siginitsetinv(current-blocked, 0); - recalc_sigpending(); - spin_unlock_irq(current-sighand-siglock); - /* set the maximum length of sync message */ set_sync_mesg_maxlen(state); @@ -815,29 +805,11 @@ static int sync_thread(void *startup) return 0; } - -static int fork_sync_thread(void *startup) -{ - pid_t pid; - - /* fork the sync thread here, then the parent process of the - sync thread is the init process after this thread exits. */ - repeat: - if ((pid = kernel_thread(sync_thread, startup, 0)) 0) { - IP_VS_ERR(could not create sync_thread due to %d... - retrying.\n, pid); - msleep_interruptible(1000); - goto repeat; - } - - return 0; -} - - int start_sync_thread(int state, char *mcast_ifn, __u8 syncid) { DECLARE_COMPLETION_ONSTACK(startup); - pid_t pid; + struct task_struct *task; + const char *name; if ((state == IP_VS_STATE_MASTER sync_master_pid) || (state == IP_VS_STATE_BACKUP sync_backup_pid)) @@ -852,16 +824,19 @@ int start_sync_thread(int state, char *mcast_ifn, __u8 syncid) strlcpy(ip_vs_master_mcast_ifn, mcast_ifn, sizeof(ip_vs_master_mcast_ifn)); ip_vs_master_syncid = syncid; + name = ipvs_syncmaster; } else { strlcpy(ip_vs_backup_mcast_ifn, mcast_ifn, sizeof(ip_vs_backup_mcast_ifn)); ip_vs_backup_syncid = syncid; + name = ipvs_syncbackup; } repeat: - if ((pid = kernel_thread(fork_sync_thread, startup, 0)) 0) { - IP_VS_ERR(could not create fork_sync_thread due to %d... - retrying.\n, pid); + task = kthread_run(sync_thread, startup, name); + if (IS_ERR(task)) { + IP_VS_ERR(could not create sync_thread due to %ld... + retrying.\n, PTR_ERR(task)); msleep_interruptible(1000); goto repeat; } -- 1.5.0.g53756 - To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] nfsv4 delegation: Convert to kthread API
From: Eric W. Biederman [EMAIL PROTECTED] - unquoted To start the nfsv4-delegreturn thread this patch uses kthread_run instead of a combination of kernel_thread and daemonize. In addition allow_signal(SIGKILL) is removed from the expire delegations thread. Cc: Neil Brown [EMAIL PROTECTED] Cc: Trond Myklebust [EMAIL PROTECTED] Signed-off-by: Eric W. Biederman [EMAIL PROTECTED] --- fs/nfs/delegation.c | 11 --- 1 files changed, 4 insertions(+), 7 deletions(-) diff --git a/fs/nfs/delegation.c b/fs/nfs/delegation.c index 841c99a..7b9b88c 100644 --- a/fs/nfs/delegation.c +++ b/fs/nfs/delegation.c @@ -232,7 +232,6 @@ int nfs_do_expire_all_delegations(void *ptr) struct nfs_delegation *delegation; struct inode *inode; - allow_signal(SIGKILL); restart: spin_lock(clp-cl_lock); if (test_bit(NFS4CLNT_STATE_RECOVER, clp-cl_state) != 0) @@ -310,8 +309,6 @@ static int recall_thread(void *data) struct nfs_inode *nfsi = NFS_I(inode); struct nfs_delegation *delegation; - daemonize(nfsv4-delegreturn); - nfs_msync_inode(inode); down_read(clp-cl_sem); down_write(nfsi-rwsem); @@ -350,18 +347,18 @@ int nfs_async_inode_return_delegation(struct inode *inode, const nfs4_stateid *s .inode = inode, .stateid = stateid, }; - int status; + struct task_struct *task; init_completion(data.started); __module_get(THIS_MODULE); - status = kernel_thread(recall_thread, data, CLONE_KERNEL); - if (status 0) + task = kthread_run(recall_thread, data, nfsv4-delegreturn); + if (IS_ERR(task)) goto out_module_put; wait_for_completion(data.started); return data.result; out_module_put: module_put(THIS_MODULE); - return status; + return PTR_ERR(task); } /* -- 1.5.0.g53756 - To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] nfsd/nfs4state: Remove unnecessary daemonize call.
From: Eric W. Biederman [EMAIL PROTECTED] - unquoted Cc: Neil Brown [EMAIL PROTECTED] Cc: Trond Myklebust [EMAIL PROTECTED] Signed-off-by: Eric W. Biederman [EMAIL PROTECTED] --- fs/nfsd/nfs4state.c |2 -- 1 files changed, 0 insertions(+), 2 deletions(-) diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c index 678f3be..3cc8ce4 100644 --- a/fs/nfsd/nfs4state.c +++ b/fs/nfsd/nfs4state.c @@ -1326,8 +1326,6 @@ do_recall(void *__dp) { struct nfs4_delegation *dp = __dp; - daemonize(nfsv4-recall); - nfsd4_cb_recall(dp); return 0; } -- 1.5.0.g53756 - To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] nfs lockd reclaimer: Convert to kthread API
From: Eric W. Biederman [EMAIL PROTECTED] - unquoted Start the reclaimer thread using kthread_run instead of a combination of kernel_thread and daemonize. The small amount of signal handling code is also removed as it makes no sense and is a maintenance problem to handle signals in kernel threads. Cc: Neil Brown [EMAIL PROTECTED] Cc: Trond Myklebust [EMAIL PROTECTED] Signed-off-by: Eric W. Biederman [EMAIL PROTECTED] --- fs/lockd/clntlock.c |8 ++-- 1 files changed, 2 insertions(+), 6 deletions(-) diff --git a/fs/lockd/clntlock.c b/fs/lockd/clntlock.c index f4d45d4..83591f6 100644 --- a/fs/lockd/clntlock.c +++ b/fs/lockd/clntlock.c @@ -9,6 +9,7 @@ #include linux/module.h #include linux/types.h #include linux/time.h +#include linux/kthread.h #include linux/nfs_fs.h #include linux/sunrpc/clnt.h #include linux/sunrpc/svc.h @@ -153,7 +154,7 @@ nlmclnt_recovery(struct nlm_host *host) if (!host-h_reclaiming++) { nlm_get_host(host); __module_get(THIS_MODULE); - if (kernel_thread(reclaimer, host, CLONE_KERNEL) 0) + if (IS_ERR(kthread_run(reclaimer, host, %s-reclaim, host-h_name))) module_put(THIS_MODULE); } } @@ -166,9 +167,6 @@ reclaimer(void *ptr) struct file_lock *fl, *next; u32 nsmstate; - daemonize(%s-reclaim, host-h_name); - allow_signal(SIGKILL); - down_write(host-h_rwsem); /* This one ensures that our parent doesn't terminate while the @@ -193,8 +191,6 @@ restart: list_del_init(fl-fl_u.nfs_fl.list); /* Why are we leaking memory here? --okir */ - if (signalled()) - continue; if (nlmclnt_reclaim(host, fl) != 0) continue; list_add_tail(fl-fl_u.nfs_fl.list, host-h_granted); -- 1.5.0.g53756 - To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] bluetooth rfcomm: Convert to kthread API.
From: Eric W. Biederman [EMAIL PROTECTED] - unquoted This patch starts krfcommd using kthread_run instead of a combination of kernel_thread and daemonize making the code slightly simpler and more maintainable. Cc: Marcel Holtmann [EMAIL PROTECTED] Signed-off-by: Eric W. Biederman [EMAIL PROTECTED] --- net/bluetooth/rfcomm/core.c |4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/net/bluetooth/rfcomm/core.c b/net/bluetooth/rfcomm/core.c index 34f993a..baaad49 100644 --- a/net/bluetooth/rfcomm/core.c +++ b/net/bluetooth/rfcomm/core.c @@ -38,6 +38,7 @@ #include linux/net.h #include linux/mutex.h #include linux/freezer.h +#include linux/kthread.h #include net/sock.h #include asm/uaccess.h @@ -1938,7 +1939,6 @@ static int rfcomm_run(void *unused) atomic_inc(running); - daemonize(krfcommd); set_user_nice(current, -10); BT_DBG(); @@ -2058,7 +2058,7 @@ static int __init rfcomm_init(void) hci_register_cb(rfcomm_cb); - kernel_thread(rfcomm_run, NULL, CLONE_KERNEL); + kthread_run(rfcomm_run, NULL, krfcommd); if (class_create_file(bt_class, class_attr_rfcomm_dlc) 0) BT_ERR(Failed to create RFCOMM info file); -- 1.5.0.g53756 - To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] s390/net/lcs: Convert to the kthread API
From: Eric W. Biederman [EMAIL PROTECTED] - unquoted Use kthread_run to start the lcs kernel threads not a combination of kernel_thread and daemonize. This makes the code slightly simpler and more maintainable. Cc: Frank Pavlic [EMAIL PROTECTED] Signed-off-by: Eric W. Biederman [EMAIL PROTECTED] --- drivers/s390/net/lcs.c |8 +++- 1 files changed, 3 insertions(+), 5 deletions(-) diff --git a/drivers/s390/net/lcs.c b/drivers/s390/net/lcs.c index 08a994f..0300d87 100644 --- a/drivers/s390/net/lcs.c +++ b/drivers/s390/net/lcs.c @@ -36,6 +36,7 @@ #include linux/in.h #include linux/igmp.h #include linux/delay.h +#include linux/kthread.h #include net/arp.h #include net/ip.h @@ -1248,7 +1249,6 @@ lcs_register_mc_addresses(void *data) struct in_device *in4_dev; card = (struct lcs_card *) data; - daemonize(regipm); if (!lcs_do_run_thread(card, LCS_SET_MC_THREAD)) return 0; @@ -1728,11 +1728,10 @@ lcs_start_kernel_thread(struct work_struct *work) struct lcs_card *card = container_of(work, struct lcs_card, kernel_thread_starter); LCS_DBF_TEXT(5, trace, krnthrd); if (lcs_do_start_thread(card, LCS_RECOVERY_THREAD)) - kernel_thread(lcs_recovery, (void *) card, SIGCHLD); + kthread_run(lcs_recovery, card, lcs_recover); #ifdef CONFIG_IP_MULTICAST if (lcs_do_start_thread(card, LCS_SET_MC_THREAD)) - kernel_thread(lcs_register_mc_addresses, - (void *) card, SIGCHLD); + kernel_run(lcs_register_mc_addresses, card, regipm); #endif } @@ -2232,7 +2231,6 @@ lcs_recovery(void *ptr) int rc; card = (struct lcs_card *) ptr; - daemonize(lcs_recover); LCS_DBF_TEXT(4, trace, recover1); if (!lcs_do_run_thread(card, LCS_RECOVERY_THREAD)) -- 1.5.0.g53756 - To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] pnpbios: Conert to use the kthread API.
From: Eric W. Biederman [EMAIL PROTECTED] - unquoted This patches modifies the pnpbios kernel thread to start with ktrhead_run not kernel_thread and deamonize. Doing this makes the code a little simpler and easier to maintain. Signed-off-by: Eric W. Biederman [EMAIL PROTECTED] --- drivers/pnp/pnpbios/core.c | 16 +++- 1 files changed, 7 insertions(+), 9 deletions(-) diff --git a/drivers/pnp/pnpbios/core.c b/drivers/pnp/pnpbios/core.c index c2ed53f..3a201b7 100644 --- a/drivers/pnp/pnpbios/core.c +++ b/drivers/pnp/pnpbios/core.c @@ -62,6 +62,7 @@ #include linux/delay.h #include linux/acpi.h #include linux/freezer.h +#include linux/kthread.h #include asm/page.h #include asm/desc.h @@ -159,9 +160,7 @@ static int pnp_dock_thread(void * unused) { static struct pnp_docking_station_info now; int docked = -1, d = 0; - daemonize(kpnpbiosd); - allow_signal(SIGKILL); - while(!unloading !signal_pending(current)) + while (!unloading) { int status; @@ -170,11 +169,8 @@ static int pnp_dock_thread(void * unused) */ msleep_interruptible(2000); - if(signal_pending(current)) { - if (try_to_freeze()) - continue; - break; - } + if (try_to_freeze()) + continue; status = pnp_bios_dock_station_info(now); @@ -582,6 +578,7 @@ subsys_initcall(pnpbios_init); static int __init pnpbios_thread_init(void) { + struct task_struct *task; #if defined(CONFIG_PPC_MERGE) if (check_legacy_ioport(PNPBIOS_BASE)) return 0; @@ -590,7 +587,8 @@ static int __init pnpbios_thread_init(void) return 0; #ifdef CONFIG_HOTPLUG init_completion(unload_sem); - if (kernel_thread(pnp_dock_thread, NULL, CLONE_KERNEL) 0) + task = kthread_run(pnp_dock_thread, NULL, kpnpbiosd); + if (!IS_ERR(task)) unloading = 0; #endif return 0; -- 1.5.0.g53756 - To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] sparc64/power.c: Convert to use the kthread API
From: Eric W. Biederman [EMAIL PROTECTED] - unquoted This starts the sparc64 powerd using kthread_run instead of kernel_thread and daemonize. Making the code slightly simpler and more maintainable. In addition the unnecessary flush_signals is removed. Cc: David S. Miller [EMAIL PROTECTED] Signed-off-by: Eric W. Biederman [EMAIL PROTECTED] --- arch/sparc64/kernel/power.c |8 1 files changed, 4 insertions(+), 4 deletions(-) diff --git a/arch/sparc64/kernel/power.c b/arch/sparc64/kernel/power.c index 699b24b..03feb8b 100644 --- a/arch/sparc64/kernel/power.c +++ b/arch/sparc64/kernel/power.c @@ -13,6 +13,7 @@ #include linux/interrupt.h #include linux/pm.h #include linux/syscalls.h +#include linux/kthread.h #include asm/system.h #include asm/auxio.h @@ -81,15 +82,12 @@ static int powerd(void *__unused) char *argv[] = { /sbin/shutdown, -h, now, NULL }; DECLARE_WAITQUEUE(wait, current); - daemonize(powerd); - add_wait_queue(powerd_wait, wait); again: for (;;) { set_task_state(current, TASK_INTERRUPTIBLE); if (button_pressed) break; - flush_signals(current); schedule(); } __set_current_state(TASK_RUNNING); @@ -128,7 +126,9 @@ static int __devinit power_probe(struct of_device *op, const struct of_device_id poweroff_method = machine_halt; /* able to use the standard halt */ if (has_button_interrupt(irq, op-node)) { - if (kernel_thread(powerd, NULL, CLONE_FS) 0) { + struct task_struct *task; + task = kthread_urn(powerd, NULL, powerd); + if (IS_ERR(task)) { printk(Failed to start power daemon.\n); return 0; } -- 1.5.0.g53756 - To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] sas_scsi_host: Convert to use the kthread API
From: Eric W. Biederman [EMAIL PROTECTED] - unquoted This patch modifies the sas scsi host thread startup to use kthread_run not kernel_thread and deamonize. kthread_run is slightly simpler and more maintainable. Cc: Darrick J. Wong [EMAIL PROTECTED] Cc: James Bottomley [EMAIL PROTECTED] Signed-off-by: Eric W. Biederman [EMAIL PROTECTED] --- drivers/scsi/libsas/sas_scsi_host.c | 11 ++- 1 files changed, 6 insertions(+), 5 deletions(-) diff --git a/drivers/scsi/libsas/sas_scsi_host.c b/drivers/scsi/libsas/sas_scsi_host.c index 46ba3a7..7a38ac5 100644 --- a/drivers/scsi/libsas/sas_scsi_host.c +++ b/drivers/scsi/libsas/sas_scsi_host.c @@ -40,6 +40,7 @@ #include linux/blkdev.h #include linux/scatterlist.h #include linux/freezer.h +#include linux/kthread.h /* -- SCSI Host glue -- */ @@ -870,7 +871,6 @@ static int sas_queue_thread(void *_sas_ha) struct sas_ha_struct *sas_ha = _sas_ha; struct scsi_core *core = sas_ha-core; - daemonize(sas_queue_%d, core-shost-host_no); current-flags |= PF_NOFREEZE; complete(queue_th_comp); @@ -891,19 +891,20 @@ static int sas_queue_thread(void *_sas_ha) int sas_init_queue(struct sas_ha_struct *sas_ha) { - int res; struct scsi_core *core = sas_ha-core; + struct task_struct *task; spin_lock_init(core-task_queue_lock); core-task_queue_size = 0; INIT_LIST_HEAD(core-task_queue); init_MUTEX_LOCKED(core-queue_thread_sema); - res = kernel_thread(sas_queue_thread, sas_ha, 0); - if (res = 0) + task = kthread_run(sas_queue_thread, sas_ha, + sas_queue_%d, core-shost-host_no); + if (!IS_ERR(task)) wait_for_completion(queue_th_comp); - return res 0 ? res : 0; + return IS_ERR(task) ? PTR_ERR(task) : 0; } void sas_shutdown_queue(struct sas_ha_struct *sas_ha) -- 1.5.0.g53756 - To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] cpqphp: Convert to use the kthread API
From: Eric W. Biederman [EMAIL PROTECTED] - unquoted This patch changes cpqphp to use kthread_run and not kernel_thread and daemonize to startup and setup the cpqphp thread. Cc: Greg Kroah-Hartman [EMAIL PROTECTED] Signed-off-by: Eric W. Biederman [EMAIL PROTECTED] --- drivers/pci/hotplug/cpqphp_ctrl.c | 12 1 files changed, 4 insertions(+), 8 deletions(-) diff --git a/drivers/pci/hotplug/cpqphp_ctrl.c b/drivers/pci/hotplug/cpqphp_ctrl.c index 79ff6b4..c2c06c4 100644 --- a/drivers/pci/hotplug/cpqphp_ctrl.c +++ b/drivers/pci/hotplug/cpqphp_ctrl.c @@ -37,6 +37,7 @@ #include linux/smp_lock.h #include linux/pci.h #include linux/pci_hotplug.h +#include linux/kthread.h #include cpqphp.h static u32 configure_new_device(struct controller* ctrl, struct pci_func *func, @@ -1746,10 +1747,6 @@ static void pushbutton_helper_thread(unsigned long data) static int event_thread(void* data) { struct controller *ctrl; - lock_kernel(); - daemonize(phpd_event); - - unlock_kernel(); while (1) { dbg(event_thread sleeping\n); @@ -1771,7 +1768,7 @@ static int event_thread(void* data) int cpqhp_event_start_thread(void) { - int pid; + struct task_struct *task; /* initialize our semaphores */ init_MUTEX(delay_sem); @@ -1779,12 +1776,11 @@ int cpqhp_event_start_thread(void) init_MUTEX_LOCKED(event_exit); event_finished=0; - pid = kernel_thread(event_thread, NULL, 0); - if (pid 0) { + task = kthread_run(event_thread, NULL, phpd_event); + if (IS_ERR(task)) { err (Can't start up our event thread\n); return -1; } - dbg(Our event thread pid = %d\n, pid); return 0; } -- 1.5.0.g53756 - To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] fs/afs: Convert to kthread API.
From: Eric W. Biederman [EMAIL PROTECTED] - unquoted This patch modifies the startup of kafscmd, kafsasyncd, and kafstimod to use kthread_run instead of a combination of kernel_thread and daemonize making the code slightly simpler and more maintainable. In addition since by default all signals are ignored when delivered to a kernel thread the code to flush signals has been removed. Cc: David Howells [EMAIL PROTECTED] Signed-off-by: Eric W. Biederman [EMAIL PROTECTED] --- fs/afs/cmservice.c | 10 +- fs/afs/internal.h | 11 --- fs/afs/kafsasyncd.c | 17 ++--- fs/afs/kafstimod.c | 16 ++-- 4 files changed, 17 insertions(+), 37 deletions(-) diff --git a/fs/afs/cmservice.c b/fs/afs/cmservice.c index 3d097fd..f7e2355 100644 --- a/fs/afs/cmservice.c +++ b/fs/afs/cmservice.c @@ -13,6 +13,7 @@ #include linux/init.h #include linux/sched.h #include linux/completion.h +#include linux/kthread.h #include server.h #include cell.h #include transport.h @@ -120,8 +121,6 @@ static int kafscmd(void *arg) printk(KERN_INFO kAFS: Started kafscmd %d\n, current-pid); - daemonize(kafscmd); - complete(kafscmd_alive); /* loop around looking for things to attend to */ @@ -133,7 +132,6 @@ static int kafscmd(void *arg) for (;;) { set_current_state(TASK_INTERRUPTIBLE); if (!list_empty(kafscmd_attention_list) || - signal_pending(current) || kafscmd_die) break; @@ -297,8 +295,10 @@ int afscm_start(void) down_write(afscm_sem); if (!afscm_usage) { - ret = kernel_thread(kafscmd, NULL, 0); - if (ret 0) + struct task_struct *task; + task = kthread_run(kafscmd, NULL, kafscmd); + ret = PTR_ERR(task); + if (IS_ERR(task)) goto out; wait_for_completion(kafscmd_alive); diff --git a/fs/afs/internal.h b/fs/afs/internal.h index 5151d5d..2d667b7 100644 --- a/fs/afs/internal.h +++ b/fs/afs/internal.h @@ -40,17 +40,6 @@ #define _net(FMT, a...)do { } while(0) #endif -static inline void afs_discard_my_signals(void) -{ - while (signal_pending(current)) { - siginfo_t sinfo; - - spin_lock_irq(current-sighand-siglock); - dequeue_signal(current,current-blocked, sinfo); - spin_unlock_irq(current-sighand-siglock); - } -} - /* * cell.c */ diff --git a/fs/afs/kafsasyncd.c b/fs/afs/kafsasyncd.c index 615df24..ead025f 100644 --- a/fs/afs/kafsasyncd.c +++ b/fs/afs/kafsasyncd.c @@ -21,6 +21,7 @@ #include linux/sched.h #include linux/completion.h #include linux/freezer.h +#include linux/kthread.h #include cell.h #include server.h #include volume.h @@ -56,15 +57,15 @@ static void kafsasyncd_null_call_error_func(struct rxrpc_call *call) */ int afs_kafsasyncd_start(void) { - int ret; + struct task_struct *task; - ret = kernel_thread(kafsasyncd, NULL, 0); - if (ret 0) - return ret; + task = kthread_run(kafsasyncd, NULL, kafsasyncd); + if (IS_ERR(task)) + return PTR_ERR(task); wait_for_completion(kafsasyncd_alive); - return ret; + return 0; } /* end afs_kafsasyncd_start() */ /*/ @@ -95,8 +96,6 @@ static int kafsasyncd(void *arg) printk(kAFS: Started kafsasyncd %d\n, current-pid); - daemonize(kafsasyncd); - complete(kafsasyncd_alive); /* loop around looking for things to attend to */ @@ -106,7 +105,6 @@ static int kafsasyncd(void *arg) for (;;) { if (!list_empty(kafsasyncd_async_attnq) || - signal_pending(current) || kafsasyncd_die) break; @@ -119,9 +117,6 @@ static int kafsasyncd(void *arg) try_to_freeze(); - /* discard pending signals */ - afs_discard_my_signals(); - die = kafsasyncd_die; /* deal with the next asynchronous operation requiring diff --git a/fs/afs/kafstimod.c b/fs/afs/kafstimod.c index 694344e..caeac88 100644 --- a/fs/afs/kafstimod.c +++ b/fs/afs/kafstimod.c @@ -14,6 +14,7 @@ #include linux/sched.h #include linux/completion.h #include linux/freezer.h +#include linux/kthread.h #include cell.h #include volume.h #include kafstimod.h @@ -36,15 +37,15 @@ static int kafstimod(void *arg); */ int afs_kafstimod_start(void) { - int ret; + struct task_struct *task; - ret = kernel_thread(kafstimod, NULL, 0); - if (ret 0) - return ret; + task = kthread_run(kafstimod,
[PATCH] ia64 sn xpc: Convert to use kthread API.
From: Eric W. Biederman [EMAIL PROTECTED] - unquoted This patch starts the xpc kernel threads using kthread_run not a combination of kernel_thread and daemonize. Resuling in slightly simpler and more maintainable code. Cc: Jes Sorensen [EMAIL PROTECTED] Cc: Tony Luck [EMAIL PROTECTED] Signed-off-by: Eric W. Biederman [EMAIL PROTECTED] --- arch/ia64/sn/kernel/xpc_main.c | 31 +-- 1 files changed, 13 insertions(+), 18 deletions(-) diff --git a/arch/ia64/sn/kernel/xpc_main.c b/arch/ia64/sn/kernel/xpc_main.c index e336e16..5b53642 100644 --- a/arch/ia64/sn/kernel/xpc_main.c +++ b/arch/ia64/sn/kernel/xpc_main.c @@ -56,6 +56,7 @@ #include linux/reboot.h #include linux/completion.h #include linux/kdebug.h +#include linux/kthread.h #include asm/sn/intr.h #include asm/sn/sn_sal.h #include asm/uaccess.h @@ -253,8 +254,6 @@ xpc_hb_checker(void *ignore) /* this thread was marked active by xpc_hb_init() */ - daemonize(XPC_HB_CHECK_THREAD_NAME); - set_cpus_allowed(current, cpumask_of_cpu(XPC_HB_CHECK_CPU)); xpc_hb_check_timeout = jiffies + (xpc_hb_check_interval * HZ); @@ -324,8 +323,6 @@ xpc_hb_checker(void *ignore) static int xpc_initiate_discovery(void *ignore) { - daemonize(XPC_DISCOVERY_THREAD_NAME); - xpc_discovery(); dev_dbg(xpc_part, discovery thread is exiting\n); @@ -494,8 +491,6 @@ xpc_activating(void *__partid) dev_dbg(xpc_part, bringing partition %d up\n, partid); - daemonize(xpc%02d, partid); - /* * This thread needs to run at a realtime priority to prevent a * significant performance degradation. @@ -559,7 +554,7 @@ xpc_activate_partition(struct xpc_partition *part) { partid_t partid = XPC_PARTID(part); unsigned long irq_flags; - pid_t pid; + struct task_struct *task; spin_lock_irqsave(part-act_lock, irq_flags); @@ -571,9 +566,10 @@ xpc_activate_partition(struct xpc_partition *part) spin_unlock_irqrestore(part-act_lock, irq_flags); - pid = kernel_thread(xpc_activating, (void *) ((u64) partid), 0); + task = kthread_run(xpc_activating, (void *) ((u64) partid), + xpc%02d, partid); - if (unlikely(pid = 0)) { + if (unlikely(IS_ERR(task))) { spin_lock_irqsave(part-act_lock, irq_flags); part-act_state = XPC_P_INACTIVE; XPC_SET_REASON(part, xpcCloneKThreadFailed, __LINE__); @@ -724,8 +720,6 @@ xpc_daemonize_kthread(void *args) unsigned long irq_flags; - daemonize(xpc%02dc%d, partid, ch_number); - dev_dbg(xpc_chan, kthread starting, partid=%d, channel=%d\n, partid, ch_number); @@ -844,8 +838,9 @@ xpc_create_kthreads(struct xpc_channel *ch, int needed, (void) xpc_part_ref(part); xpc_msgqueue_ref(ch); - pid = kernel_thread(xpc_daemonize_kthread, (void *) args, 0); - if (pid 0) { + task = kthread_run(xpc_daemonize_kthread, args, + xpc%02dc%d, partid, ch_number); + if (IS_ERR(task)) { /* the fork failed */ /* @@ -1222,7 +1217,7 @@ xpc_init(void) int ret; partid_t partid; struct xpc_partition *part; - pid_t pid; + struct task_struct *task; size_t buf_size; @@ -1353,8 +1348,8 @@ xpc_init(void) * The real work-horse behind xpc. This processes incoming * interrupts and monitors remote heartbeats. */ - pid = kernel_thread(xpc_hb_checker, NULL, 0); - if (pid 0) { + task = kthread_run(xpc_hb_checker, NULL, XPC_HB_CHECK_THREAD_NAME); + if (IS_ERR(task)) { dev_err(xpc_part, failed while forking hb check thread\n); /* indicate to others that our reserved page is uninitialized */ @@ -1384,8 +1379,8 @@ xpc_init(void) * activate based on info provided by SAL. This new thread is short * lived and will exit once discovery is complete. */ - pid = kernel_thread(xpc_initiate_discovery, NULL, 0); - if (pid 0) { + task = kthread_run(xpc_initiate_discovery, NULL, XPC_DISCOVERY_THREAD_NAME); + if (IS_ERR(task)) { dev_err(xpc_part, failed while forking discovery thread\n); /* mark this new thread as a non-starter */ -- 1.5.0.g53756 - To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [Suspend2-devel] Re: CFS and suspend2: hang in atomic copy
* Nigel Cunningham [EMAIL PROTECTED] wrote: From subsequent emails, I think you already got your answer, but just in case... Yes, if you enabled Replace swsusp by default and you already had it set up for getting swsusp to resume. If not, and you're using an initrd/ramfs, you'll need to modify it to echo /sys/power/suspend2/do_resume after /sys and /proc are mounted but prior to mounting / and so on. yeah, went with the default suggested by your patch: CONFIG_SUSPEND2_REPLACE_SWSUSP=y and it was pretty easy to set things up. I used echo disk /sys/power/state to trigger it. In hindsight it was all pretty straightforward and suspend2 worked beautifully on an UP and on an SMP system i tried. So in exchange for suspend2 folks debugging a bug in CFS here's some suspend2 review feedback ;) Any plans about moving suspend2 to the upstream kernel? It should be pretty easy for it to co-exist with the current swsuspend code. The patch has quite some size: 89 files changed, 16452 insertions(+), 69 deletions(-) that should obviously be split up into more than a dozen sub-patches, and fed to lkml with the small ones first. (unless it already is split up?) i cannot comment on the kernel/power/ bits (they are way too large anyway), other than that they look pretty clean visually, but the lowlevel arch and generic kernel bits look sane in detail too, sans a few mostly trivial cleanliness issues: +int suspend2_faulted = 0; +EXPORT_SYMBOL(suspend2_faulted); should be done via the pagefault notifier chain mechanism. Also, all the exports you added should be EXPORT_SYMBOL_GPL(). this: - ClearPageReserved(virt_to_page(addr)); - init_page_count(virt_to_page(addr)); + //ClearPageReserved(virt_to_page(addr)); + //init_page_count(virt_to_page(addr)); looks like there's a buglet in there still somewhere? + if(PageHighMem(page)) + return 0; coding style. + BUG_ON( test_suspend_state(SUSPEND_RUNNING) /* Suspend2, that is */ make this a WARN_ON() or a WARN_ON_ONCE() - that way you have a chance to even get feedback from users, instead of a 'uhm, X froze' report. +#define FREEZER_OFF 0 +#define FREEZER_USERSPACE_FROZEN 1 +#define FREEZER_FULLY_ON 2 should be: +#define FREEZER_OFF0 +#define FREEZER_USERSPACE_FROZEN 1 +#define FREEZER_FULLY_ON 2 (you want your reviewers have an pleasant time reading your code :) +#define NETLINK_SUSPEND2_USERUI20 /* For suspend2's userui */ IIRC userui was at the center of suspend2 merge flames, right? So you might want to layer it ontop a less flashy suspend2-core and thus get 90% of your patch upstream? +++ linux/mm/vmscan.c the MM impact looks quite nontrivial. But i suspect this is unavoidable, because you zap portions of the pagecache on the way to disk, so when it comes back it results in a different pagecache (new lru lists, etc.), right? +++ linux/lib/dyn_pageflags.c shouldnt this be in mm/dyn_pageflags.c? Plus it would be nice to use some other core kernel user for this infrastructure. (but it's not a necessity i guess) but ... again, the patch looks sane all around. Ingo - To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] arm ecard: Conver to use the kthread API.
From: Eric W. Biederman [EMAIL PROTECTED] - unquoted This patch modifies the startup of kecardd to use kthread_run not a kernel_thread combination of kernel_thread and daemonize. Making the code slightly simpler and more maintainable. Cc: Russell King [EMAIL PROTECTED] Signed-off-by: Eric W. Biederman [EMAIL PROTECTED] --- arch/arm/kernel/ecard.c | 14 +++--- 1 files changed, 7 insertions(+), 7 deletions(-) diff --git a/arch/arm/kernel/ecard.c b/arch/arm/kernel/ecard.c index f1c0fb9..6c15f5f 100644 --- a/arch/arm/kernel/ecard.c +++ b/arch/arm/kernel/ecard.c @@ -40,6 +40,7 @@ #include linux/device.h #include linux/init.h #include linux/mutex.h +#include linux/kthread.h #include asm/dma.h #include asm/ecard.h @@ -263,8 +264,6 @@ static int ecard_init_mm(void) static int ecard_task(void * unused) { - daemonize(kecardd); - /* * Allocate a mm. We're not a lazy-TLB kernel task since we need * to set page table entries where the user space would be. Note @@ -1058,13 +1057,14 @@ ecard_probe(int slot, card_type_t type) */ static int __init ecard_init(void) { - int slot, irqhw, ret; + struct task_struct *task; + int slot, irqhw; - ret = kernel_thread(ecard_task, NULL, CLONE_KERNEL); - if (ret 0) { + task = kthread_run(ecard_task, NULL, kecardd); + if (IS_ERR(task)) { printk(KERN_ERR Ecard: unable to create kernel thread: %d\n, - ret); - return ret; + PTR_ERR(task)); + return PTR_ERR(task); } printk(Probing expansion cards\n); -- 1.5.0.g53756 - To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] powerpc pseries eeh: Convert to kthread API
From: Eric W. Biederman [EMAIL PROTECTED] - unquoted This patch modifies the startup of eehd to use kthread_run not a combination of kernel_thread and daemonize. Making the code slightly simpler and more maintainable. Cc: Paul Mackerras [EMAIL PROTECTED] Signed-off-by: Eric W. Biederman [EMAIL PROTECTED] --- arch/powerpc/platforms/pseries/eeh_event.c |4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/powerpc/platforms/pseries/eeh_event.c b/arch/powerpc/platforms/pseries/eeh_event.c index 221dec8..fe7c2e0 100644 --- a/arch/powerpc/platforms/pseries/eeh_event.c +++ b/arch/powerpc/platforms/pseries/eeh_event.c @@ -23,6 +23,7 @@ #include linux/mutex.h #include linux/pci.h #include linux/workqueue.h +#include linux/kthread.h #include asm/eeh_event.h #include asm/ppc-pci.h @@ -59,7 +60,6 @@ static int eeh_event_handler(void * dummy) struct eeh_event*event; struct pci_dn *pdn; - daemonize (eehd); set_current_state(TASK_INTERRUPTIBLE); spin_lock_irqsave(eeh_eventlist_lock, flags); @@ -105,7 +105,7 @@ static int eeh_event_handler(void * dummy) */ static void eeh_thread_launcher(struct work_struct *dummy) { - if (kernel_thread(eeh_event_handler, NULL, CLONE_KERNEL) 0) + if (IS_ERR(kthread_run(eeh_event_handler, NULL, eehd))) printk(KERN_ERR Failed to start EEH daemon\n); } -- 1.5.0.g53756 - To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] s390 qeth: Convert to use the kthread API
From: Eric W. Biederman [EMAIL PROTECTED] - unquoted This patch modifies the qeth_recover thread to be started with kthread_run not a combination of kernel_thread and daemonize. Resulting in slightly simpler and more maintainable code. Cc: Frank Pavlic [EMAIL PROTECTED] Signed-off-by: Eric W. Biederman [EMAIL PROTECTED] --- drivers/s390/net/qeth_main.c |4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/s390/net/qeth_main.c b/drivers/s390/net/qeth_main.c index ad7792d..8234846 100644 --- a/drivers/s390/net/qeth_main.c +++ b/drivers/s390/net/qeth_main.c @@ -50,6 +50,7 @@ #include linux/mii.h #include linux/rcupdate.h #include linux/ethtool.h +#include linux/kthread.h #include net/arp.h #include net/ip.h @@ -957,7 +958,6 @@ qeth_recover(void *ptr) int rc = 0; card = (struct qeth_card *) ptr; - daemonize(qeth_recover); QETH_DBF_TEXT(trace,2,recover1); QETH_DBF_HEX(trace, 2, card, sizeof(void *)); if (!qeth_do_run_thread(card, QETH_RECOVER_THREAD)) @@ -1014,7 +1014,7 @@ qeth_start_kernel_thread(struct work_struct *work) card-write.state != CH_STATE_UP) return; if (qeth_do_start_thread(card, QETH_RECOVER_THREAD)) - kernel_thread(qeth_recover, (void *) card, SIGCHLD); + kthread_run(qeth_recover, card, qeth_recover); } -- 1.5.0.g53756 - To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] s390/scsi/zfcp_erp: Convert to use the kthread API
From: Eric W. Biederman [EMAIL PROTECTED] - unquoted Modify zfcperp%s to be started with kthread_run not a combination of kernel_thread, daemonize and siginitsetinv making the code slightly simpler and more maintainable. Cc: Swen Schillig [EMAIL PROTECTED] Signed-off-by: Eric W. Biederman [EMAIL PROTECTED] --- drivers/s390/scsi/zfcp_erp.c | 13 ++--- 1 files changed, 6 insertions(+), 7 deletions(-) diff --git a/drivers/s390/scsi/zfcp_erp.c b/drivers/s390/scsi/zfcp_erp.c index 66c0b09..f26536d 100644 --- a/drivers/s390/scsi/zfcp_erp.c +++ b/drivers/s390/scsi/zfcp_erp.c @@ -21,6 +21,7 @@ #define ZFCP_LOG_AREA ZFCP_LOG_AREA_ERP +#include linux/kthread.h #include zfcp_ext.h static int zfcp_erp_adisc(struct zfcp_port *); @@ -985,12 +986,13 @@ static void zfcp_erp_action_dismiss(struct zfcp_erp_action *erp_action) int zfcp_erp_thread_setup(struct zfcp_adapter *adapter) { - int retval = 0; + struct task_struct *task; atomic_clear_mask(ZFCP_STATUS_ADAPTER_ERP_THREAD_UP, adapter-status); - retval = kernel_thread(zfcp_erp_thread, adapter, SIGCHLD); - if (retval 0) { + task = kthread_run(zfcp_erp_thread, adapter, + zfcperp%s, zfcp_get_busid_by_adapter(adapter)); + if (IS_ERR(task)) { ZFCP_LOG_NORMAL(error: creation of erp thread failed for adapter %s\n, zfcp_get_busid_by_adapter(adapter)); @@ -1002,7 +1004,7 @@ zfcp_erp_thread_setup(struct zfcp_adapter *adapter) debug_text_event(adapter-erp_dbf, 5, a_thset_ok); } - return (retval 0); + return IS_ERR(task); } /* @@ -1054,9 +1056,6 @@ zfcp_erp_thread(void *data) struct zfcp_erp_action *erp_action; unsigned long flags; - daemonize(zfcperp%s, zfcp_get_busid_by_adapter(adapter)); - /* Block all signals */ - siginitsetinv(current-blocked, 0); atomic_set_mask(ZFCP_STATUS_ADAPTER_ERP_THREAD_UP, adapter-status); debug_text_event(adapter-erp_dbf, 5, a_th_run); wake_up(adapter-erp_thread_wqh); -- 1.5.0.g53756 - To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] net/rxrpc: Convert to kthread API.
From: Eric W. Biederman [EMAIL PROTECTED] - unquoted This patch modifies the startup of krxtimod, krxiod, and krxsecd to use kthread_run instead of a combination of kernel_thread and daemonize making the code slightly simpler and more maintainable. In addition since by default all signals are ignored when delivered to a kernel thread the code to flush signals has been removed. Cc: David Howells [EMAIL PROTECTED] Signed-off-by: Eric W. Biederman [EMAIL PROTECTED] --- net/rxrpc/internal.h | 11 --- net/rxrpc/krxiod.c | 16 net/rxrpc/krxsecd.c | 16 net/rxrpc/krxtimod.c | 15 ++- 4 files changed, 22 insertions(+), 36 deletions(-) diff --git a/net/rxrpc/internal.h b/net/rxrpc/internal.h index cc0c579..1dd69aa 100644 --- a/net/rxrpc/internal.h +++ b/net/rxrpc/internal.h @@ -49,17 +49,6 @@ __RXACCT_DECL(extern atomic_t rxrpc_message_count); #define _net(FMT, a...)do { if (rxrpc_knet) knet (FMT , ##a); } while(0) #endif -static inline void rxrpc_discard_my_signals(void) -{ - while (signal_pending(current)) { - siginfo_t sinfo; - - spin_lock_irq(current-sighand-siglock); - dequeue_signal(current, current-blocked, sinfo); - spin_unlock_irq(current-sighand-siglock); - } -} - /* * call.c */ diff --git a/net/rxrpc/krxiod.c b/net/rxrpc/krxiod.c index bbbcd6c..c590ccd 100644 --- a/net/rxrpc/krxiod.c +++ b/net/rxrpc/krxiod.c @@ -14,6 +14,7 @@ #include linux/spinlock.h #include linux/init.h #include linux/freezer.h +#include linux/kthread.h #include rxrpc/krxiod.h #include rxrpc/transport.h #include rxrpc/peer.h @@ -43,8 +44,6 @@ static int rxrpc_krxiod(void *arg) printk(Started krxiod %d\n,current-pid); - daemonize(krxiod); - /* loop around waiting for work to do */ do { /* wait for work or to be told to exit */ @@ -57,8 +56,7 @@ static int rxrpc_krxiod(void *arg) for (;;) { set_current_state(TASK_INTERRUPTIBLE); if (atomic_read(rxrpc_krxiod_qcount) || - rxrpc_krxiod_die || - signal_pending(current)) + rxrpc_krxiod_die) break; schedule(); @@ -141,9 +139,6 @@ static int rxrpc_krxiod(void *arg) try_to_freeze(); - /* discard pending signals */ - rxrpc_discard_my_signals(); - } while (!rxrpc_krxiod_die); /* and that's all */ @@ -157,7 +152,12 @@ static int rxrpc_krxiod(void *arg) */ int __init rxrpc_krxiod_init(void) { - return kernel_thread(rxrpc_krxiod, NULL, 0); + struct task_struct *task; + int ret = 0; + task = kthread_run(rxrpc_krxiod, NULL, krxiod); + if (IS_ERR(task)) + ret = PTR_ERR(task); + return ret; } /* end rxrpc_krxiod_init() */ diff --git a/net/rxrpc/krxsecd.c b/net/rxrpc/krxsecd.c index 9a1e7f5..150cd39 100644 --- a/net/rxrpc/krxsecd.c +++ b/net/rxrpc/krxsecd.c @@ -19,6 +19,7 @@ #include linux/completion.h #include linux/spinlock.h #include linux/init.h +#include linux/kthread.h #include rxrpc/krxsecd.h #include rxrpc/transport.h #include rxrpc/connection.h @@ -56,8 +57,6 @@ static int rxrpc_krxsecd(void *arg) printk(Started krxsecd %d\n, current-pid); - daemonize(krxsecd); - /* loop around waiting for work to do */ do { /* wait for work or to be told to exit */ @@ -70,8 +69,7 @@ static int rxrpc_krxsecd(void *arg) for (;;) { set_current_state(TASK_INTERRUPTIBLE); if (atomic_read(rxrpc_krxsecd_qcount) || - rxrpc_krxsecd_die || - signal_pending(current)) + rxrpc_krxsecd_die) break; schedule(); @@ -110,9 +108,6 @@ static int rxrpc_krxsecd(void *arg) try_to_freeze(); - /* discard pending signals */ - rxrpc_discard_my_signals(); - } while (!die); /* and that's all */ @@ -126,7 +121,12 @@ static int rxrpc_krxsecd(void *arg) */ int __init rxrpc_krxsecd_init(void) { - return kernel_thread(rxrpc_krxsecd, NULL, 0); + struct task_struct *task; + int ret = 0; + task = kthread_run(rxrpc_krxsecd, NULL, krxsecd); + if (IS_ERR(task)) + ret = PTR_ERR(task); + return ret; } /* end rxrpc_krxsecd_init() */ diff --git a/net/rxrpc/krxtimod.c b/net/rxrpc/krxtimod.c index 9a9b613..3b5f062 100644 --- a/net/rxrpc/krxtimod.c +++ b/net/rxrpc/krxtimod.c @@ -14,6 +14,7 @@ #include linux/sched.h
[PATCH] bluetooth bnep: Convert to kthread API.
From: Eric W. Biederman [EMAIL PROTECTED] - unquoted This patch starts kbenpd using kthread_run replacing a combination of kernel_thread and daemonize. Making the code a little simpler and more maintainable. Cc: Marcel Holtmann [EMAIL PROTECTED] Signed-off-by: Eric W. Biederman [EMAIL PROTECTED] --- net/bluetooth/bnep/core.c |8 +--- 1 files changed, 5 insertions(+), 3 deletions(-) diff --git a/net/bluetooth/bnep/core.c b/net/bluetooth/bnep/core.c index a9f1e88..de3caed 100644 --- a/net/bluetooth/bnep/core.c +++ b/net/bluetooth/bnep/core.c @@ -32,6 +32,7 @@ #include linux/module.h #include linux/kernel.h +#include linux/kthread.h #include linux/sched.h #include linux/signal.h #include linux/init.h @@ -473,7 +474,6 @@ static int bnep_session(void *arg) BT_DBG(); - daemonize(kbnepd %s, dev-name); set_user_nice(current, -15); init_waitqueue_entry(wait, current); @@ -539,6 +539,7 @@ static struct device *bnep_get_device(struct bnep_session *session) int bnep_add_connection(struct bnep_connadd_req *req, struct socket *sock) { + struct task_struct *task; struct net_device *dev; struct bnep_session *s, *ss; u8 dst[ETH_ALEN], src[ETH_ALEN]; @@ -598,9 +599,10 @@ int bnep_add_connection(struct bnep_connadd_req *req, struct socket *sock) __bnep_link_session(s); - err = kernel_thread(bnep_session, s, CLONE_KERNEL); - if (err 0) { + task = kthread_run(bnep_session, s, kbnepd %s, dev-name); + if (IS_ERR(task)) { /* Session thread start failed, gotta cleanup. */ + err = PTR_ERR(task); unregister_netdev(dev); __bnep_unlink_session(s); goto failed; -- 1.5.0.g53756 - To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] bluetooth cmtp: Convert to use kthread API.
From: Eric W. Biederman [EMAIL PROTECTED] - unquoted This patch modifies the kcmptd_ctr_%d daemon using kthread_run instead of a combination of kernel_thread and daemonize making the code a little simpler and more maintainable. Cc: Marcel Holtmann [EMAIL PROTECTED] Signed-off-by: Eric W. Biederman [EMAIL PROTECTED] --- net/bluetooth/cmtp/core.c |8 +--- 1 files changed, 5 insertions(+), 3 deletions(-) diff --git a/net/bluetooth/cmtp/core.c b/net/bluetooth/cmtp/core.c index e1b9db9..993303f 100644 --- a/net/bluetooth/cmtp/core.c +++ b/net/bluetooth/cmtp/core.c @@ -35,6 +35,7 @@ #include linux/file.h #include linux/init.h #include linux/freezer.h +#include linux/kthread.h #include net/sock.h #include linux/isdn/capilli.h @@ -286,7 +287,6 @@ static int cmtp_session(void *arg) BT_DBG(session %p, session); - daemonize(kcmtpd_ctr_%d, session-num); set_user_nice(current, -15); init_waitqueue_entry(wait, current); @@ -329,6 +329,7 @@ static int cmtp_session(void *arg) int cmtp_add_connection(struct cmtp_connadd_req *req, struct socket *sock) { struct cmtp_session *session, *s; + struct task_struct *task; bdaddr_t src, dst; int i, err; @@ -375,8 +376,9 @@ int cmtp_add_connection(struct cmtp_connadd_req *req, struct socket *sock) __cmtp_link_session(session); - err = kernel_thread(cmtp_session, session, CLONE_KERNEL); - if (err 0) + task = kthread_run(cmtp_session, session, kcmtpd_ctr_%d, session-num); + err = PTR_ERR(task); + if (IS_ERR(task)) goto unlink; if (!(session-flags (1 CMTP_LOOPBACK))) { -- 1.5.0.g53756 - To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] macintosh/mediabay: Convert to kthread API.
From: Eric W. Biederman [EMAIL PROTECTED] - unquoted This patch modifies the startup of the media_bay_task to use kthread_run and not a combination of kernel_thread, deamonize and sigfillset. In addition since we now always want to ignore signals the MB_IGNORE_SIGNALS define is removed along with the test for signal_pending. The result is slightly simpler code that is more maintainable. Cc: Benjamin Herrenschmidt [EMAIL PROTECTED] Cc: Paul Mackerras [EMAIL PROTECTED] Signed-off-by: Eric W. Biederman [EMAIL PROTECTED] --- drivers/macintosh/mediabay.c | 11 ++- 1 files changed, 2 insertions(+), 9 deletions(-) diff --git a/drivers/macintosh/mediabay.c b/drivers/macintosh/mediabay.c index c803d2b..90c853e 100644 --- a/drivers/macintosh/mediabay.c +++ b/drivers/macintosh/mediabay.c @@ -20,6 +20,7 @@ #include linux/stddef.h #include linux/init.h #include linux/ide.h +#include linux/kthread.h #include asm/prom.h #include asm/pgtable.h #include asm/io.h @@ -35,7 +36,6 @@ #define MB_DEBUG -#define MB_IGNORE_SIGNALS #ifdef MB_DEBUG #define MBDBG(fmt, arg...) printk(KERN_INFO fmt , ## arg) @@ -622,11 +622,6 @@ static int media_bay_task(void *x) { int i; - strcpy(current-comm, media-bay); -#ifdef MB_IGNORE_SIGNALS - sigfillset(current-blocked); -#endif - for (;;) { for (i = 0; i media_bay_count; ++i) { down(media_bays[i].lock); @@ -636,8 +631,6 @@ static int media_bay_task(void *x) } msleep_interruptible(MB_POLL_DELAY); - if (signal_pending(current)) - return 0; } } @@ -699,7 +692,7 @@ static int __devinit media_bay_attach(struct macio_dev *mdev, const struct of_de /* Startup kernel thread */ if (i == 0) - kernel_thread(media_bay_task, NULL, CLONE_KERNEL); + kthread_run(media_bay_task, NULL, media-bay); return 0; -- 1.5.0.g53756 - To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] md: Remove broken SIGKILL support
From: Eric W. Biederman [EMAIL PROTECTED] - unquoted Currently md_thread calls allow_signal so it can receive a SIGKILL but then does nothing with it except flush the sigkill so that it not can use an interruptible sleep. This whole dance is silly so remove the unnecessary and broken signal handling logic. Cc: Neil Brown [EMAIL PROTECTED] Signed-off-by: Eric W. Biederman [EMAIL PROTECTED] --- drivers/md/md.c |6 -- 1 files changed, 0 insertions(+), 6 deletions(-) diff --git a/drivers/md/md.c b/drivers/md/md.c index 1299c23..dfd0cb9 100644 --- a/drivers/md/md.c +++ b/drivers/md/md.c @@ -4542,17 +4542,11 @@ static int md_thread(void * arg) */ current-flags |= PF_NOFREEZE; - allow_signal(SIGKILL); while (!kthread_should_stop()) { /* We need to wait INTERRUPTIBLE so that * we don't add to the load-average. -* That means we need to be sure no signals are -* pending */ - if (signal_pending(current)) - flush_signals(current); - wait_event_interruptible_timeout (thread-wqueue, test_bit(THREAD_WAKEUP, thread-flags) -- 1.5.0.g53756 - To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] macintosh/therm_pm72.c: Convert to kthread API.
From: Eric W. Biederman [EMAIL PROTECTED] - unquoted This patch modifies startup of the kfand to use kthread_run not a combination of kernel_thread and daemonize, making the code a little simpler and more maintaintable. Cc: Benjamin Herrenschmidt [EMAIL PROTECTED] Signed-off-by: Eric W. Biederman [EMAIL PROTECTED] --- drivers/macintosh/therm_pm72.c | 11 ++- 1 files changed, 6 insertions(+), 5 deletions(-) diff --git a/drivers/macintosh/therm_pm72.c b/drivers/macintosh/therm_pm72.c index b002a4b..7e9cbb7 100644 --- a/drivers/macintosh/therm_pm72.c +++ b/drivers/macintosh/therm_pm72.c @@ -121,6 +121,7 @@ #include linux/reboot.h #include linux/kmod.h #include linux/i2c.h +#include linux/kthread.h #include asm/prom.h #include asm/machdep.h #include asm/io.h @@ -161,7 +162,7 @@ static struct slots_pid_state slots_state; static int state; static int cpu_count; static int cpu_pid_type; -static pid_t ctrl_task; +static int ctrl_task; static struct completion ctrl_complete; static int critical_state; static int rackmac; @@ -1779,8 +1780,6 @@ static int call_critical_overtemp(void) */ static int main_control_loop(void *x) { - daemonize(kfand); - DBG(main_control_loop started\n); down(driver_lock); @@ -1859,7 +1858,6 @@ static int main_control_loop(void *x) machine_power_off(); } - // FIXME: Deal with signals elapsed = jiffies - start; if (elapsed HZ) schedule_timeout_interruptible(HZ - elapsed); @@ -1954,9 +1952,12 @@ static int create_control_loops(void) */ static void start_control_loops(void) { + struct task_struct *task; init_completion(ctrl_complete); - ctrl_task = kernel_thread(main_control_loop, NULL, SIGCHLD | CLONE_KERNEL); + task = kthread_run(main_control_loop, NULL, kfand); + if (!IS_ERR(task)) + ctrl_task = 1; } /* -- 1.5.0.g53756 - To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [Announce] [patch] Modular Scheduler Core and Completely Fair Scheduler [CFS]
* Mike Galbraith [EMAIL PROTECTED] wrote: With a heavily reniced X (perfectly fine), that should indeed solve my daily usage pattern nicely (always need godmode for shells, but not for mozilla and ilk. 50/50 split automatic without renice of entire gui) how about the first-approximation solution i suggested in the previous mail: to add a per UID default nice level? (With this default defaulting to '-10' for all root-owned processes, and defaulting to '0' for everything else.) That would solve most of the current CFS regressions at hand. Ingo - To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] dvb_en_50221: Convert to kthread API
From: Eric W. Biederman [EMAIL PROTECTED] - unquoted This patch is a minimal transformation to use the kthread API doing it's best to preserve the existing logic. Instead of starting kdvb-ca by calling kernel_thread, daemonize and sigfillset we kthread_run is used. Instead of tracking the pid of the running thread we instead simply keep a flag to indicate that the current thread is running, as that is all the pid is really used for. And finally the kill_proc sending signal 0 to the kernel thread to ensure it is alive before we wait for it to shutdown is removed. The kthread API does not provide the pid so we don't have that information readily available and the test is just silly. If there is no shutdown race the test is a useless confirmation of that the thread is running. If there is a race the test doesn't fix it and we should fix the race properly. Cc: Andrew de Quincey [EMAIL PROTECTED] Cc: Mauro Carvalho Chehab [EMAIL PROTECTED] Signed-off-by: Eric W. Biederman [EMAIL PROTECTED] --- drivers/media/dvb/dvb-core/dvb_ca_en50221.c | 46 ++ 1 files changed, 18 insertions(+), 28 deletions(-) diff --git a/drivers/media/dvb/dvb-core/dvb_ca_en50221.c b/drivers/media/dvb/dvb-core/dvb_ca_en50221.c index 2a03bf5..b28bc15 100644 --- a/drivers/media/dvb/dvb-core/dvb_ca_en50221.c +++ b/drivers/media/dvb/dvb-core/dvb_ca_en50221.c @@ -37,6 +37,7 @@ #include linux/delay.h #include linux/spinlock.h #include linux/sched.h +#include linux/kthread.h #include dvb_ca_en50221.h #include dvb_ringbuffer.h @@ -139,8 +140,8 @@ struct dvb_ca_private { /* wait queues for read() and write() operations */ wait_queue_head_t wait_queue; - /* PID of the monitoring thread */ - pid_t thread_pid; + /* Flag indicating the monitoring thread is running */ + int thread_running; /* Wait queue used when shutting thread down */ wait_queue_head_t thread_queue; @@ -982,7 +983,6 @@ static void dvb_ca_en50221_thread_update_delay(struct dvb_ca_private *ca) static int dvb_ca_en50221_thread(void *data) { struct dvb_ca_private *ca = data; - char name[15]; int slot; int flags; int status; @@ -991,14 +991,6 @@ static int dvb_ca_en50221_thread(void *data) dprintk(%s\n, __FUNCTION__); - /* setup kernel thread */ - snprintf(name, sizeof(name), kdvb-ca-%i:%i, ca-dvbdev-adapter-num, ca-dvbdev-id); - - lock_kernel(); - daemonize(name); - sigfillset(current-blocked); - unlock_kernel(); - /* choose the correct initial delay */ dvb_ca_en50221_thread_update_delay(ca); @@ -1182,7 +1174,7 @@ static int dvb_ca_en50221_thread(void *data) } /* completed */ - ca-thread_pid = 0; + ca-thread_running = 0; mb(); wake_up_interruptible(ca-thread_queue); return 0; @@ -1660,6 +1652,7 @@ static struct dvb_device dvbdev_ca = { int dvb_ca_en50221_init(struct dvb_adapter *dvb_adapter, struct dvb_ca_en50221 *pubca, int flags, int slot_count) { + struct task_struct *task; int ret; struct dvb_ca_private *ca = NULL; int i; @@ -1682,7 +1675,7 @@ int dvb_ca_en50221_init(struct dvb_adapter *dvb_adapter, goto error; } init_waitqueue_head(ca-wait_queue); - ca-thread_pid = 0; + ca-thread_running = 0; init_waitqueue_head(ca-thread_queue); ca-exit = 0; ca-open = 0; @@ -1711,13 +1704,15 @@ int dvb_ca_en50221_init(struct dvb_adapter *dvb_adapter, /* create a kthread for monitoring this CA device */ - ret = kernel_thread(dvb_ca_en50221_thread, ca, 0); - - if (ret 0) { - printk(dvb_ca_init: failed to start kernel_thread (%d)\n, ret); + task = kthread_run(dvb_ca_en50221_thread, ca, + kdvb-ca-%i:%i, + ca-dvbdev-adapter-num, ca-dvbdev-id); + if (IS_ERR(task)) { + ret = PTR_ERR(task); + printk(dvb_ca_init: failed to start kthread (%d)\n, ret); goto error; } - ca-thread_pid = ret; + ca-thread_running = 1; return 0; error: @@ -1748,16 +1743,11 @@ void dvb_ca_en50221_release(struct dvb_ca_en50221 *pubca) dprintk(%s\n, __FUNCTION__); /* shutdown the thread if there was one */ - if (ca-thread_pid) { - if (kill_proc(ca-thread_pid, 0, 1) == -ESRCH) { - printk(dvb_ca_release adapter %d: thread PID %d already died\n, - ca-dvbdev-adapter-num, ca-thread_pid); - } else { - ca-exit = 1; - mb(); - dvb_ca_en50221_thread_wakeup(ca); - wait_event_interruptible(ca-thread_queue, ca-thread_pid == 0); - } + if (ca-thread_running) { + ca-exit =
[PATCH] macintosh/adb: Convert to the kthread API
From: Eric W. Biederman [EMAIL PROTECTED] - unquoted This patch modifies the startup of kadbprobe to use kthread_run instead of scheduling a work event which later calls kernel_thread and in the thread calls daemonize and blocks signals. kthread_run is simpler and more maintainable. The variable pid_t adb_probe_task_pid is replaced by a struct task_struct variable named adb_probe_task. Which works equally well with for testing if the current process is the adb_probe thread, does not get confused in the presence of a pid namespace and is easier to compare against current as it is the same type. The result is code that is slightly simpler and easier to maintain. Cc: Benjamin Herrenschmidt [EMAIL PROTECTED] Cc: Paul Mackerras [EMAIL PROTECTED] Signed-off-by: Eric W. Biederman [EMAIL PROTECTED] --- drivers/macintosh/adb.c | 32 +++- 1 files changed, 7 insertions(+), 25 deletions(-) diff --git a/drivers/macintosh/adb.c b/drivers/macintosh/adb.c index adfea3c..09c5261 100644 --- a/drivers/macintosh/adb.c +++ b/drivers/macintosh/adb.c @@ -35,6 +35,7 @@ #include linux/spinlock.h #include linux/completion.h #include linux/device.h +#include linux/kthread.h #include asm/uaccess.h #include asm/semaphore.h @@ -82,7 +83,7 @@ struct adb_driver *adb_controller; BLOCKING_NOTIFIER_HEAD(adb_client_list); static int adb_got_sleep; static int adb_inited; -static pid_t adb_probe_task_pid; +static struct task_struct *adb_probe_task; static DECLARE_MUTEX(adb_probe_mutex); static struct completion adb_probe_task_comp; static int sleepy_trackpad; @@ -137,8 +138,7 @@ static void printADBreply(struct adb_request *req) static __inline__ void adb_wait_ms(unsigned int ms) { - if (current-pid adb_probe_task_pid - adb_probe_task_pid == current-pid) + if (adb_probe_task == current) msleep(ms); else mdelay(ms); @@ -245,35 +245,19 @@ static int adb_scan_bus(void) * This kernel task handles ADB probing. It dies once probing is * completed. */ -static int -adb_probe_task(void *x) +static int adb_probe(void *x) { - sigset_t blocked; - - strcpy(current-comm, kadbprobe); - - sigfillset(blocked); - sigprocmask(SIG_BLOCK, blocked, NULL); - flush_signals(current); printk(KERN_INFO adb: starting probe task...\n); do_adb_reset_bus(); printk(KERN_INFO adb: finished probe task...\n); - adb_probe_task_pid = 0; + adb_probe_task = NULL; up(adb_probe_mutex); return 0; } -static void -__adb_probe_task(struct work_struct *bullshit) -{ - adb_probe_task_pid = kernel_thread(adb_probe_task, NULL, SIGCHLD | CLONE_KERNEL); -} - -static DECLARE_WORK(adb_reset_work, __adb_probe_task); - int adb_reset_bus(void) { @@ -283,7 +267,7 @@ adb_reset_bus(void) } down(adb_probe_mutex); - schedule_work(adb_reset_work); + adb_probe_task = kthread_run(adb_probe, NULL, kadbprobe); return 0; } @@ -469,9 +453,7 @@ adb_request(struct adb_request *req, void (*done)(struct adb_request *), /* Synchronous requests send from the probe thread cause it to * block. Beware that the done callback will be overriden ! */ - if ((flags ADBREQ_SYNC) - (current-pid adb_probe_task_pid - adb_probe_task_pid == current-pid)) { + if ((flags ADBREQ_SYNC) (current == adb_probe_task)) { req-done = adb_probe_wakeup; rc = adb_controller-send_request(req, 0); if (rc || req-complete) -- 1.5.0.g53756 - To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] powerpc pseries rtasd: Convert to kthread API.
From: Eric W. Biederman [EMAIL PROTECTED] - unquoted This patch modifies the startup of rtasd to use kthread_run instaed of a combination of kernel_thread and daemonize. Making the code a little simpler and more maintainble. Cc: Paul Mackerras [EMAIL PROTECTED] Signed-off-by: Eric W. Biederman [EMAIL PROTECTED] --- arch/powerpc/platforms/pseries/rtasd.c |5 ++--- 1 files changed, 2 insertions(+), 3 deletions(-) diff --git a/arch/powerpc/platforms/pseries/rtasd.c b/arch/powerpc/platforms/pseries/rtasd.c index 77d0937..919a374 100644 --- a/arch/powerpc/platforms/pseries/rtasd.c +++ b/arch/powerpc/platforms/pseries/rtasd.c @@ -20,6 +20,7 @@ #include linux/spinlock.h #include linux/cpu.h #include linux/delay.h +#include linux/kthread.h #include asm/uaccess.h #include asm/io.h @@ -429,8 +430,6 @@ static int rtasd(void *unused) int event_scan = rtas_token(event-scan); int rc; - daemonize(rtasd); - if (event_scan == RTAS_UNKNOWN_SERVICE || get_eventscan_parms() == -1) goto error; @@ -497,7 +496,7 @@ static int __init rtas_init(void) else printk(KERN_ERR Failed to create error_log proc entry\n); - if (kernel_thread(rtasd, NULL, CLONE_FS) 0) + if (IS_ERR(kthread_run(rtasd, NULL, rtasd))) printk(KERN_ERR Failed to start RTAS daemon\n); return 0; -- 1.5.0.g53756 - To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] macintosh/therm_windtunnel.c: Convert to kthread API.
From: Eric W. Biederman [EMAIL PROTECTED] - unquoted Start the g4fand using kthread_run not a combination of kernel_thread and deamonize. This makes the code a little simpler and more maintainable. Cc: Benjamin Herrenschmidt [EMAIL PROTECTED] Signed-off-by: Eric W. Biederman [EMAIL PROTECTED] --- drivers/macintosh/therm_windtunnel.c |5 ++--- 1 files changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/macintosh/therm_windtunnel.c b/drivers/macintosh/therm_windtunnel.c index a1d3a98..5d888e7 100644 --- a/drivers/macintosh/therm_windtunnel.c +++ b/drivers/macintosh/therm_windtunnel.c @@ -36,6 +36,7 @@ #include linux/i2c.h #include linux/slab.h #include linux/init.h +#include linux/kthread.h #include asm/prom.h #include asm/machdep.h @@ -62,7 +63,6 @@ I2C_CLIENT_INSMOD; static struct { volatile intrunning; struct completion completion; - pid_t poll_task; struct semaphorelock; struct of_device*of_dev; @@ -285,7 +285,6 @@ restore_regs( void ) static int control_loop( void *dummy ) { - daemonize(g4fand); down( x.lock ); setup_hardware(); @@ -323,7 +322,7 @@ do_attach( struct i2c_adapter *adapter ) if( x.thermostat x.fan ) { x.running = 1; init_completion( x.completion ); - x.poll_task = kernel_thread( control_loop, NULL, SIGCHLD | CLONE_KERNEL ); + kthread_run( control_loop, NULL, g4fand); } } return ret; -- 1.5.0.g53756 - To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] [RFC] Throttle swappiness for interactive tasks
Abhijit Bhopatkar wrote: In my mind i find it fundamentally wrong to separate anon pages from page cache. It should rather be lot more dependent on which task accessed them last. Although it seems due to some twisted relationships bet anon pages and interactive tasks separating them improves it. Am i missing something here? The IO cost for anonymous (and other swap backed) pages is completely different from the IO cost of file system backed pages. On file systems, data is typically grouped together on disk by related content. Programs often access data linearly, meaning that with readahead we can load a lot of pages into memory with only a few disk seeks. Anonymous memory does not have this benefit. For one, memory tends to get written to swap by LRU order, not by related content. To make things worse, repeated malloc/free cycles can cause the memory adjacant to each other inside a process to be completely unrelated, making virtual address based swap clustering less useful. The goal of page replacement is to minimize the total time spent waiting on page faults. This is not exactly the same as minimizing the total number of page faults. Can you send me those patches please or point me to where i can find those? You can get the latest one here: http://surriel.com/patches/2.6/vm-split/linux-2.6-vm-split.patch -- Politics is the struggle between those who want to make their country the best in the world, and those who believe it already is. Each group calls the other unpatriotic. - To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] nfs4state reclaimer: Remove unnecessary allow_signal
From: Eric W. Biederman [EMAIL PROTECTED] - unquoted Cc: Neil Brown [EMAIL PROTECTED] Cc: Trond Myklebust [EMAIL PROTECTED] Signed-off-by: Eric W. Biederman [EMAIL PROTECTED] --- fs/nfs/nfs4state.c |2 -- 1 files changed, 0 insertions(+), 2 deletions(-) diff --git a/fs/nfs/nfs4state.c b/fs/nfs/nfs4state.c index 5fffbdf..d16393f 100644 --- a/fs/nfs/nfs4state.c +++ b/fs/nfs/nfs4state.c @@ -775,8 +775,6 @@ static int reclaimer(void *ptr) struct rpc_cred *cred; int status = 0; - allow_signal(SIGKILL); - /* Ensure exclusive access to NFSv4 state */ lock_kernel(); down_write(clp-cl_sem); -- 1.5.0.g53756 - To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] synchro_test: Convert to the kthread API.
From: Eric W. Biederman [EMAIL PROTECTED] - unquoted Cc: David Howells [EMAIL PROTECTED] Signed-off-by: Eric W. Biederman [EMAIL PROTECTED] --- kernel/synchro-test.c | 16 ++-- 1 files changed, 6 insertions(+), 10 deletions(-) diff --git a/kernel/synchro-test.c b/kernel/synchro-test.c index a4747a6..b1d7fd6 100644 --- a/kernel/synchro-test.c +++ b/kernel/synchro-test.c @@ -30,6 +30,7 @@ #include linux/timer.h #include linux/completion.h #include linux/mutex.h +#include linux/kthread.h #define MAX_THREADS 64 @@ -224,7 +225,6 @@ static int mutexer(void *arg) { unsigned int N = (unsigned long) arg; - daemonize(Mutex%u, N); set_user_nice(current, 19); while (atomic_read(do_stuff)) { @@ -246,7 +246,6 @@ static int semaphorer(void *arg) { unsigned int N = (unsigned long) arg; - daemonize(Sem%u, N); set_user_nice(current, 19); while (atomic_read(do_stuff)) { @@ -268,7 +267,6 @@ static int reader(void *arg) { unsigned int N = (unsigned long) arg; - daemonize(Read%u, N); set_user_nice(current, 19); while (atomic_read(do_stuff)) { @@ -292,7 +290,6 @@ static int writer(void *arg) { unsigned int N = (unsigned long) arg; - daemonize(Write%u, N); set_user_nice(current, 19); while (atomic_read(do_stuff)) { @@ -316,7 +313,6 @@ static int downgrader(void *arg) { unsigned int N = (unsigned long) arg; - daemonize(Down%u, N); set_user_nice(current, 19); while (atomic_read(do_stuff)) { @@ -433,27 +429,27 @@ static int __init do_tests(void) for (loop = 0; loop MAX_THREADS; loop++) { if (loop nummx) { init_completion(mx_comp[loop]); - kernel_thread(mutexer, (void *) loop, 0); + kthread_run(mutexer, (void *) loop, Mutex%u, loop); } if (loop numsm) { init_completion(sm_comp[loop]); - kernel_thread(semaphorer, (void *) loop, 0); + kthread_run(semaphorer, (void *) loop, Sem%u, loop); } if (loop numrd) { init_completion(rd_comp[loop]); - kernel_thread(reader, (void *) loop, 0); + kthread_run(reader, (void *) loop, Read%u, loop); } if (loop numwr) { init_completion(wr_comp[loop]); - kernel_thread(writer, (void *) loop, 0); + kthread_run(writer, (void *) loop, Write%u, loop); } if (loop numdg) { init_completion(dg_comp[loop]); - kernel_thread(downgrader, (void *) loop, 0); + kthread_run(downgrader, (void *) loop, Down%u, loop); } } -- 1.5.0.g53756 - To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] smbfs: Remove unnecessary allow_signal
From: Eric W. Biederman [EMAIL PROTECTED] - unquoted Signed-off-by: Eric W. Biederman [EMAIL PROTECTED] --- fs/smbfs/smbiod.c |2 -- 1 files changed, 0 insertions(+), 2 deletions(-) diff --git a/fs/smbfs/smbiod.c b/fs/smbfs/smbiod.c index 3e61b44..67176af 100644 --- a/fs/smbfs/smbiod.c +++ b/fs/smbfs/smbiod.c @@ -298,8 +298,6 @@ out: */ static int smbiod(void *unused) { - allow_signal(SIGKILL); - VERBOSE(SMB Kernel thread starting (%d) ...\n, current-pid); for (;;) { -- 1.5.0.g53756 - To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [Announce] [patch] Modular Scheduler Core and Completely Fair Scheduler [CFS]
On Thu, 2007-04-19 at 08:52 +0200, Mike Galbraith wrote: On Wed, 2007-04-18 at 23:48 +0200, Ingo Molnar wrote: so my current impression is that we want per UID accounting to solve the X problem, the kernel threads problem and the many-users problem, but i'd not want to do it for threads just yet because for them there's not really any apparent problem to be solved. If you really mean UID vs EUID as Linus mentioned, I suppose I could learn to login as !root, and set KDE up to always give me root shells. With a heavily reniced X (perfectly fine), that should indeed solve my daily usage pattern nicely (always need godmode for shells, but not for mozilla and ilk. 50/50 split automatic without renice of entire gui) Backward, needs to be EUID as Linus suggested. Kernel builds etc along with reniced X in root's bucket, surfing and whatnot in Joe-User's bucket. -Mike - To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCHv2] [KERNEL-DOC] kill warnings when building mandocs
A fixed version of the patch shutting up missing version warnings when building mandocs. Signed-off-by: Borislav Petkov [EMAIL PROTECTED] Index: 21-rc7/scripts/kernel-doc === --- 21-rc7.orig/scripts/kernel-doc +++ 21-rc7/scripts/kernel-doc @@ -326,6 +326,32 @@ while ($ARGV[0] =~ m/^-(.*)/) { } } +# get kernel version +sub get_kernel_version() { +my $version; +open (FILE, $ENV{SRCTREE}.Makefile) || die Can't open main kernel Makefile: $!; + +EOF: while (my $line = FILE) +{ + if ($line =~ /VERSION\s+=\s+(\d+)/) { +$version .= $1; +next; + } + if ($line =~ /PATCHLEVEL\s+=\s+(\d+)/) { +$version .= .$1; +next; + } + if ($line =~ /SUBLEVEL\s+=\s+(\d+)/) { +$version .= .$1; +next; + } + if ($line =~ /EXTRAVERSION\s+=\s+(.*)$/) { +$version .= $1; +last EOF; + } +} +return $version; +} # generate a sequence of code that will splice in highlighting information # using the s// operator. @@ -592,6 +618,7 @@ sub output_function_xml(%) { print refmeta\n; print refentrytitlephrase.$args{'function'}./phrase/refentrytitle\n; print manvolnum9/manvolnum\n; +print refmiscinfo class=\version\ . get_kernel_version() . /refmiscinfo\n; print /refmeta\n; print refnamediv\n; print refname.$args{'function'}./refname\n; @@ -668,6 +695,7 @@ sub output_struct_xml(%) { print refmeta\n; print refentrytitlephrase.$args{'type'}. .$args{'struct'}./phrase/refentrytitle\n; print manvolnum9/manvolnum\n; +print refmiscinfo class=\version\ . get_kernel_version() . /refmiscinfo\n; print /refmeta\n; print refnamediv\n; print refname.$args{'type'}. .$args{'struct'}./refname\n; @@ -752,6 +780,7 @@ sub output_enum_xml(%) { print refmeta\n; print refentrytitlephraseenum .$args{'enum'}./phrase/refentrytitle\n; print manvolnum9/manvolnum\n; +print refmiscinfo class=\version\ . get_kernel_version() . /refmiscinfo\n; print /refmeta\n; print refnamediv\n; print refnameenum .$args{'enum'}./refname\n; -- Regards/Gruß, Boris. - To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: Loud pop coming from hard drive on reboot
On Apr 18 2007 09:39, Stephen Clark wrote: So this is the pop I hear on my new laptop that is using libata=combined_mode when I shut my system down. I didn't get the pop with the same disk drive in an older laptop that was only ide. It sounds like a relay closing or opening, but is really my drive head doing an emergency retract/park? Most(?) disks' heads are spring-/power-based so that whenever they lose power, the spring retracts the head back to the park zone. Whether it is the disk head or something else.. take out the disk, and retry. Might not be that easy with laptops, though. Jan -- - To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [Announce] [patch] Modular Scheduler Core and Completely Fair Scheduler [CFS]
On Thu, 2007-04-19 at 09:09 +0200, Ingo Molnar wrote: * Mike Galbraith [EMAIL PROTECTED] wrote: With a heavily reniced X (perfectly fine), that should indeed solve my daily usage pattern nicely (always need godmode for shells, but not for mozilla and ilk. 50/50 split automatic without renice of entire gui) how about the first-approximation solution i suggested in the previous mail: to add a per UID default nice level? (With this default defaulting to '-10' for all root-owned processes, and defaulting to '0' for everything else.) That would solve most of the current CFS regressions at hand. That would make my kernel builds etc interfere with my other self's surfing and whatnot. With it by EUID, when I'm surfing or whatnot, the X portion of my Joe-User activity pushes the compile portion of root down in bandwidth utilization automagically, which is exactly the right thing, because the root me in not as important as the Joe-User me using the GUI at that time. If the idea of X disturbing root upsets some, they can move X to another UID. Generally, it seems perfect for here. -Mike - To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH -mm] workqueue: debug possible endless loop in cancel_rearming_delayed_work
* Jarek Poplawski [EMAIL PROTECTED] wrote: + int i = 1000; - while (!cancel_delayed_work(dwork)) + while (!cancel_delayed_work(dwork)) { flush_workqueue(wq); + BUG_ON(!i--); + } if then make it a WARN_ON(). But ... dont we have the softlockup detector for such cases? Does CONFIG_DETECT_SOFTLOCKUP=y give you enough information? Ingo - To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: built 2.6.20.7 on suse 10.0, boots fine, no mouse, network or keyboard
On Apr 18 2007 10:45, david rankin wrote: Mates, First post and I am having heck building the vanilla 2.6.20.7 kernel on Suse 10.0. Basically I put 2.6.20.7 in /usr/src, then I did [...] All current minimal requierments are met *except* udev which is version 068. Everything compiled and installed properly and initrd did what it was supposed to: Minimum requirement is something like udev = 081. Jan -- - To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [KJ][PATCH] i2c: SPIN_LOCK_UNLOCKED cleanup
On Thu, 19 Apr 2007 09:35:58 +0530, Milind Arun Choudhary wrote: SPIN_LOCK_UNLOCKED cleanup,use __SPIN_LOCK_UNLOCKED instead Signed-off-by: Milind Arun Choudhary [EMAIL PROTECTED] --- i2c-pxa.c |2 +- i2c-s3c2410.c |2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/i2c/busses/i2c-pxa.c b/drivers/i2c/busses/i2c-pxa.c index 14e83d0..d5d44ed 100644 --- a/drivers/i2c/busses/i2c-pxa.c +++ b/drivers/i2c/busses/i2c-pxa.c @@ -825,7 +825,7 @@ static const struct i2c_algorithm i2c_pxa_algorithm = { }; static struct pxa_i2c i2c_pxa = { - .lock = SPIN_LOCK_UNLOCKED, + .lock = __SPIN_LOCK_UNLOCKED(i2c_pxa.lock), .adap = { .owner = THIS_MODULE, .algo = i2c_pxa_algorithm, diff --git a/drivers/i2c/busses/i2c-s3c2410.c b/drivers/i2c/busses/i2c-s3c2410.c index 556f244..3eb5958 100644 --- a/drivers/i2c/busses/i2c-s3c2410.c +++ b/drivers/i2c/busses/i2c-s3c2410.c @@ -570,7 +570,7 @@ static const struct i2c_algorithm s3c24xx_i2c_algorithm = { }; static struct s3c24xx_i2c s3c24xx_i2c = { - .lock = SPIN_LOCK_UNLOCKED, + .lock = __SPIN_LOCK_UNLOCKED(s3c24xx_i2c.lock), .wait = __WAIT_QUEUE_HEAD_INITIALIZER(s3c24xx_i2c.wait), .adap = { .name = s3c2410-i2c, Applied, thanks. -- Jean Delvare - To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
dio_get_page() lockdep complaints
Hi, Doing some testing on CFQ, I ran into this 100% reproducible report: === [ INFO: possible circular locking dependency detected ] 2.6.21-rc7 #5 --- fio/9741 is trying to acquire lock: (mm-mmap_sem){}, at: [b018cb34] dio_get_page+0x54/0x161 but task is already holding lock: (inode-i_mutex){--..}, at: [b038c6e5] mutex_lock+0x1c/0x1f which lock already depends on the new lock. the existing dependency chain (in reverse order) is: - #1 (inode-i_mutex){--..}: [b013e3fb] __lock_acquire+0xdee/0xf9c [b013e600] lock_acquire+0x57/0x70 [b038c4a5] __mutex_lock_slowpath+0x73/0x297 [b038c6e5] mutex_lock+0x1c/0x1f [b01b17e9] reiserfs_file_release+0x54/0x447 [b016afe7] __fput+0x53/0x101 [b016b0ee] fput+0x19/0x1c [b015bcd5] remove_vma+0x3b/0x4d [b015c659] do_munmap+0x17f/0x1cf [b015c6db] sys_munmap+0x32/0x42 [b0103f04] sysenter_past_esp+0x5d/0x99 [] 0x - #0 (mm-mmap_sem){}: [b013e259] __lock_acquire+0xc4c/0xf9c [b013e600] lock_acquire+0x57/0x70 [b0137b92] down_read+0x3a/0x4c [b018cb34] dio_get_page+0x54/0x161 [b018d7a9] __blockdev_direct_IO+0x514/0xe2a [b01cf449] ext3_direct_IO+0x98/0x1e5 [b014e8df] generic_file_direct_IO+0x63/0x133 [b01500e9] generic_file_aio_read+0x16b/0x222 [b017f8b6] aio_rw_vect_retry+0x5a/0x116 [b0180147] aio_run_iocb+0x69/0x129 [b0180a78] io_submit_one+0x194/0x2eb [b0181331] sys_io_submit+0x92/0xe7 [b0103f90] syscall_call+0x7/0xb [] 0x other info that might help us debug this: 1 lock held by fio/9741: #0: (inode-i_mutex){--..}, at: [b038c6e5] mutex_lock+0x1c/0x1f stack backtrace: [b0104f54] show_trace_log_lvl+0x1a/0x30 [b0105626] show_trace+0x12/0x14 [b01056ad] dump_stack+0x16/0x18 [b013c48d] print_circular_bug_tail+0x68/0x71 [b013e259] __lock_acquire+0xc4c/0xf9c [b013e600] lock_acquire+0x57/0x70 [b0137b92] down_read+0x3a/0x4c [b018cb34] dio_get_page+0x54/0x161 [b018d7a9] __blockdev_direct_IO+0x514/0xe2a [b01cf449] ext3_direct_IO+0x98/0x1e5 [b014e8df] generic_file_direct_IO+0x63/0x133 [b01500e9] generic_file_aio_read+0x16b/0x222 [b017f8b6] aio_rw_vect_retry+0x5a/0x116 [b0180147] aio_run_iocb+0x69/0x129 [b0180a78] io_submit_one+0x194/0x2eb [b0181331] sys_io_submit+0x92/0xe7 [b0103f90] syscall_call+0x7/0xb === The test run was fio, the job file used is: # fio job file snip below [global] bs=4k buffered=0 ioengine=libaio iodepth=4 thread [readers] numjobs=8 size=128m rw=read # fio job file snip above Filesystem was ext3, default mkfs and mount options. Kernel was 2.6.21-rc7 as of this morning, with some CFQ patches applied. -- Jens Axboe - To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
How to structure an SPI UART driver?
I'm looking for a little advice on writing a driver for the Phillips sc16is752 SPI UART chip. I've written drivers before but I'm having a problem with this one. Since this driver is both an SPI driver and a UART driver I'm unclear on whether it should register with spi_register_driver() or uart_register_driver(), or both, or do something completely different. I'm not clear on how to play nicely with both subsystems. Any hints? Cheers, Zik - To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [RFC 0/8] Cpuset aware writeback
Christoph Lameter wrote: On Wed, 18 Apr 2007, Ethan Solomita wrote: Any new ETA? I'm trying to decide whether to go back to your original patches or wait for the new set. Adding new knobs isn't as important to me as having something that fixes the core problem, so hopefully this isn't waiting on them. They could always be patches on top of your core patches. -- Ethan H Sorry. I got distracted and I have sent them to Kame-san who was interested in working on them. I have placed the most recent version at http://ftp.kernel.org/pub/linux/kernel/people/christoph/cpuset_dirty Do you expect any conflicts with the per-bdi dirty throttling patches? -- Ethan - To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [Announce] [patch] Modular Scheduler Core and Completely Fair Scheduler [CFS]
* Andrew Morton [EMAIL PROTECTED] wrote: Yes, there are potential compatibility problems. Example: a machine with 100 busy httpd processes and suddenly a big gzip starts up from console or cron. [...] On Thu, Apr 19, 2007 at 08:38:10AM +0200, Ingo Molnar wrote: h. How about the following then: default to nice -10 for all (SCHED_NORMAL) kernel threads and all root-owned tasks. Root _is_ special: root already has disk space reserved to it, root has special memory allocation allowances, etc. I dont see a reason why we couldnt by default make all root tasks have nice -10. This would be instantly loved by sysadmins i suspect ;-) (distros that go the extra mile of making Xorg run under non-root could also go another extra one foot to renice that X server to -10.) I'd further recommend making priority levels accessible to kernel threads that are not otherwise accessible to processes, both above and below user-available priority levels. Basically, if you can get SCHED_RR and SCHED_FIFO to coexist as intimate scheduler classes, then a SCHED_KERN scheduler class can coexist with SCHED_OTHER in like fashion, but with availability of higher and lower priorities than any userspace process is allowed, and potentially some differing scheduling semantics. In such a manner nonessential background processing intended not to ever disturb userspace can be given priorities appropriate to it (perhaps even con's SCHED_IDLEPRIO would make sense), and other, urgent processing can be given priority over userspace altogether. I believe root's default priority can be adjusted in userspace as things now stand somewhere in /etc/ but I'm not sure of the specifics. Word is somewhere in /etc/security/limits.conf -- wli - To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [Announce] [patch] Modular Scheduler Core and Completely Fair Scheduler [CFS]
* Davide Libenzi [EMAIL PROTECTED] wrote: That's one reason why i dont think it's necessarily a good idea to group-schedule threads, we dont really want to do a per thread group percpu_alloc(). I still do not have clear how much overhead this will bring into the table, but I think (like Linus was pointing out) the hierarchy should look like: Top (VCPU maybe?) User Process Thread The run_queue concept (and data) that now is bound to a CPU, need to be replicated in: ROOT - VCPUs add themselves here VCPU - USERs add themselves here USER - PROCs add themselves here PROC - THREADs add themselves here THREAD (ultimate fine grained scheduling unit) So ROOT, VCPU, USER and PROC will have their own run_queue. Picking up a new task would mean: VCPU = ROOT-lookup(); USER = VCPU-lookup(); PROC = USER-lookup(); THREAD = PROC-lookup(); Run-time statistics should propagate back the other way around. yeah, but this looks quite bad from an overhead POV ... i think we can do alot simpler to solve X and kernel threads prioritization. In fact for threads the _reverse_ problem exists, threaded apps tend to _strive_ for more performance - hence their desperation of using the threaded programming model to begin with ;) (just think of media playback apps which are typically multithreaded) The same user nicing two different multi-threaded processes would expect a predictable CPU distribution too. [...] i disagree that the user 'would expect' this. Some users might. Others would say: 'my 10-thread rendering engine is more important than a 1-thread job because it's using 10 threads for a reason'. And the CFS feedback so far strengthens this point: the default behavior of treating the thread as a single scheduling (and CPU time accounting) unit works pretty well on the desktop. think about it in another, 'kernel policy' way as well: we'd like to _encourage_ more parallel user applications. Hurting them by accounting all threads together sends the exact opposite message. [...] Doing that efficently (the old per-cpu run-queue is pretty nice from many POVs) is the real challenge. yeah. Ingo - To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: dio_get_page() lockdep complaints
On Thu, 19 Apr 2007 09:38:30 +0200 Jens Axboe [EMAIL PROTECTED] wrote: Hi, Doing some testing on CFQ, I ran into this 100% reproducible report: === [ INFO: possible circular locking dependency detected ] 2.6.21-rc7 #5 --- fio/9741 is trying to acquire lock: (mm-mmap_sem){}, at: [b018cb34] dio_get_page+0x54/0x161 but task is already holding lock: (inode-i_mutex){--..}, at: [b038c6e5] mutex_lock+0x1c/0x1f which lock already depends on the new lock. This is the correct ranking: i_mutex outside mmap_sem. the existing dependency chain (in reverse order) is: - #1 (inode-i_mutex){--..}: [b013e3fb] __lock_acquire+0xdee/0xf9c [b013e600] lock_acquire+0x57/0x70 [b038c4a5] __mutex_lock_slowpath+0x73/0x297 [b038c6e5] mutex_lock+0x1c/0x1f [b01b17e9] reiserfs_file_release+0x54/0x447 [b016afe7] __fput+0x53/0x101 [b016b0ee] fput+0x19/0x1c [b015bcd5] remove_vma+0x3b/0x4d [b015c659] do_munmap+0x17f/0x1cf [b015c6db] sys_munmap+0x32/0x42 [b0103f04] sysenter_past_esp+0x5d/0x99 [] 0x - #0 (mm-mmap_sem){}: [b013e259] __lock_acquire+0xc4c/0xf9c [b013e600] lock_acquire+0x57/0x70 [b0137b92] down_read+0x3a/0x4c [b018cb34] dio_get_page+0x54/0x161 [b018d7a9] __blockdev_direct_IO+0x514/0xe2a [b01cf449] ext3_direct_IO+0x98/0x1e5 [b014e8df] generic_file_direct_IO+0x63/0x133 [b01500e9] generic_file_aio_read+0x16b/0x222 [b017f8b6] aio_rw_vect_retry+0x5a/0x116 [b0180147] aio_run_iocb+0x69/0x129 [b0180a78] io_submit_one+0x194/0x2eb [b0181331] sys_io_submit+0x92/0xe7 [b0103f90] syscall_call+0x7/0xb [] 0x But here reiserfs is taking i_mutex in its file_operations.release(), which can be called under mmap_sem. Vladimir's recent de14569f94513279e3d44d9571a421e9da1759ae. resierfs: avoid tail packing if an inode was ever mmapped comes real close to this code, but afaict it did not cause this bug. I can't think of anything which we've done in the 2.6.21 cycle which would have caused this to start happening. Odd. The test run was fio, the job file used is: # fio job file snip below [global] bs=4k buffered=0 ioengine=libaio iodepth=4 thread [readers] numjobs=8 size=128m rw=read # fio job file snip above Filesystem was ext3, default mkfs and mount options. Kernel was 2.6.21-rc7 as of this morning, with some CFQ patches applied. It's interesting that lockdep learned the (wrong) ranking from a reiserfs operation then later detected it being violated by ext3. - To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] i386 voyager: Convert the monitor thread to use the kthread API
From: Eric W. Biederman [EMAIL PROTECTED] This patch just trivially replaces kernel_thread and daemonize with a single call to kthread_run. CC: James Bottomley [EMAIL PROTECTED] Signed-off-by: Eric W. Biederman [EMAIL PROTECTED] --- arch/i386/mach-voyager/voyager_thread.c |5 ++--- 1 files changed, 2 insertions(+), 3 deletions(-) diff --git a/arch/i386/mach-voyager/voyager_thread.c b/arch/i386/mach-voyager/voyager_thread.c index ebfd913..ee23d9b 100644 --- a/arch/i386/mach-voyager/voyager_thread.c +++ b/arch/i386/mach-voyager/voyager_thread.c @@ -23,6 +23,7 @@ #include linux/kmod.h #include linux/completion.h #include linux/sched.h +#include linux/kthread.h #include asm/desc.h #include asm/voyager.h #include asm/vic.h @@ -43,7 +44,7 @@ static __u8 set_timeout = 0; static int __init voyager_thread_start(void) { - if(kernel_thread(thread, NULL, CLONE_KERNEL) 0) { + if (IS_ERR(kthread_run(thread, NULL, %s, THREAD_NAME))) { /* This is serious, but not fatal */ printk(KERN_ERR Voyager: Failed to create system monitor thread!!!\n); return 1; @@ -122,8 +123,6 @@ thread(void *unused) kvoyagerd_running = 1; - daemonize(THREAD_NAME); - set_timeout = 0; init_timer(wakeup_timer); -- 1.5.0.g53756 - To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] ibmphp: Convert to use the kthreads API
From: Eric W. Biederman [EMAIL PROTECTED] kthread_run replaces kernel_thread and dameonize. allow_signal is unnecessary and has been removed. tid_poll was unused and has been removed. Cc: Jyoti Shah [EMAIL PROTECTED] Cc: Greg Kroah-Hartman [EMAIL PROTECTED] Signed-off-by: Eric W. Biederman [EMAIL PROTECTED] --- drivers/pci/hotplug/ibmphp_hpc.c | 14 +- 1 files changed, 5 insertions(+), 9 deletions(-) diff --git a/drivers/pci/hotplug/ibmphp_hpc.c b/drivers/pci/hotplug/ibmphp_hpc.c index 46abaa8..27e12f1 100644 --- a/drivers/pci/hotplug/ibmphp_hpc.c +++ b/drivers/pci/hotplug/ibmphp_hpc.c @@ -34,6 +34,7 @@ #include linux/pci.h #include linux/init.h #include linux/mutex.h +#include linux/kthread.h #include ibmphp.h @@ -101,7 +102,6 @@ static int to_debug = 0; // global variables // static int ibmphp_shutdown; -static int tid_poll; static struct mutex sem_hpcaccess; // lock access to HPC static struct semaphore semOperations; // lock all operations and // access to data structures @@ -137,7 +137,6 @@ void __init ibmphp_hpc_initvars (void) init_MUTEX_LOCKED (sem_exit); to_debug = 0; ibmphp_shutdown = 0; - tid_poll = 0; debug (%s - Exit\n, __FUNCTION__); } @@ -1060,12 +1059,8 @@ static int hpc_poll_thread (void *data) { debug (%s - Entry\n, __FUNCTION__); - daemonize(hpc_poll); - allow_signal(SIGKILL); - poll_hpc (); - tid_poll = 0; debug (%s - Exit\n, __FUNCTION__); return 0; } @@ -1078,17 +1073,18 @@ static int hpc_poll_thread (void *data) *-*/ int __init ibmphp_hpc_start_poll_thread (void) { + struct task_struct *task; int rc = 0; debug (%s - Entry\n, __FUNCTION__); - tid_poll = kernel_thread (hpc_poll_thread, NULL, 0); - if (tid_poll 0) { + task = kthread_run(hpc_poll_thread, NULL, hpc_poll); + if (IS_ERR(task)) { err (%s - Error, thread not started\n, __FUNCTION__); rc = -1; } - debug (%s - Exit tid_poll[%d] rc[%d]\n, __FUNCTION__, tid_poll, rc); + debug (%s - Exit rc[%d]\n, __FUNCTION__, rc); return rc; } -- 1.5.0.g53756 - To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] pnpbios: Conert to use the kthread API.
From: Eric W. Biederman [EMAIL PROTECTED] This patches modifies the pnpbios kernel thread to start with ktrhead_run not kernel_thread and deamonize. Doing this makes the code a little simpler and easier to maintain. Signed-off-by: Eric W. Biederman [EMAIL PROTECTED] --- drivers/pnp/pnpbios/core.c | 16 +++- 1 files changed, 7 insertions(+), 9 deletions(-) diff --git a/drivers/pnp/pnpbios/core.c b/drivers/pnp/pnpbios/core.c index c2ed53f..3a201b7 100644 --- a/drivers/pnp/pnpbios/core.c +++ b/drivers/pnp/pnpbios/core.c @@ -62,6 +62,7 @@ #include linux/delay.h #include linux/acpi.h #include linux/freezer.h +#include linux/kthread.h #include asm/page.h #include asm/desc.h @@ -159,9 +160,7 @@ static int pnp_dock_thread(void * unused) { static struct pnp_docking_station_info now; int docked = -1, d = 0; - daemonize(kpnpbiosd); - allow_signal(SIGKILL); - while(!unloading !signal_pending(current)) + while (!unloading) { int status; @@ -170,11 +169,8 @@ static int pnp_dock_thread(void * unused) */ msleep_interruptible(2000); - if(signal_pending(current)) { - if (try_to_freeze()) - continue; - break; - } + if (try_to_freeze()) + continue; status = pnp_bios_dock_station_info(now); @@ -582,6 +578,7 @@ subsys_initcall(pnpbios_init); static int __init pnpbios_thread_init(void) { + struct task_struct *task; #if defined(CONFIG_PPC_MERGE) if (check_legacy_ioport(PNPBIOS_BASE)) return 0; @@ -590,7 +587,8 @@ static int __init pnpbios_thread_init(void) return 0; #ifdef CONFIG_HOTPLUG init_completion(unload_sem); - if (kernel_thread(pnp_dock_thread, NULL, CLONE_KERNEL) 0) + task = kthread_run(pnp_dock_thread, NULL, kpnpbiosd); + if (!IS_ERR(task)) unloading = 0; #endif return 0; -- 1.5.0.g53756 - To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] i386 balance_irq: Convert to the kthread api.
This patch just trivial converts from calling kernel_thread and daemonize to just calling kthread_run. Cc: Andi Kleen [EMAIL PROTECTED] Signed-off-by: Eric W. Biederman [EMAIL PROTECTED] --- arch/i386/kernel/io_apic.c |5 ++--- 1 files changed, 2 insertions(+), 3 deletions(-) diff --git a/arch/i386/kernel/io_apic.c b/arch/i386/kernel/io_apic.c index 24ac67c..84b412a 100644 --- a/arch/i386/kernel/io_apic.c +++ b/arch/i386/kernel/io_apic.c @@ -34,6 +34,7 @@ #include linux/msi.h #include linux/htirq.h #include linux/freezer.h +#include linux/kthread.h #include asm/io.h #include asm/smp.h @@ -660,8 +661,6 @@ static int balanced_irq(void *unused) unsigned long prev_balance_time = jiffies; long time_remaining = balanced_irq_interval; - daemonize(kirqd); - /* push everything to CPU 0 to give us a starting point. */ for (i = 0 ; i NR_IRQS ; i++) { irq_desc[i].pending_mask = cpumask_of_cpu(0); @@ -721,7 +720,7 @@ static int __init balanced_irq_init(void) } printk(KERN_INFO Starting balanced_irq\n); - if (kernel_thread(balanced_irq, NULL, CLONE_KERNEL) = 0) + if (!IS_ERR(kthread_run(balanced_irq, NULL, kirqd))) return 0; else printk(KERN_ERR balanced_irq_init: failed to spawn balanced_irq); -- 1.5.0.g53756 - To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] nfsd/nfs4state: Remove unnecessary daemonize call.
From: Eric W. Biederman [EMAIL PROTECTED] Cc: Neil Brown [EMAIL PROTECTED] Cc: Trond Myklebust [EMAIL PROTECTED] Signed-off-by: Eric W. Biederman [EMAIL PROTECTED] --- fs/nfsd/nfs4state.c |2 -- 1 files changed, 0 insertions(+), 2 deletions(-) diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c index 678f3be..3cc8ce4 100644 --- a/fs/nfsd/nfs4state.c +++ b/fs/nfsd/nfs4state.c @@ -1326,8 +1326,6 @@ do_recall(void *__dp) { struct nfs4_delegation *dp = __dp; - daemonize(nfsv4-recall); - nfsd4_cb_recall(dp); return 0; } -- 1.5.0.g53756 - To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] bluetooth hidp: Convert to kthread API.
From: Eric W. Biederman [EMAIL PROTECTED] This patch starts up khidp using kthread_run instead of kernel_thread and daemonize, resulting is slightly simpler and more maintainable code. Cc: Marcel Holtmann [EMAIL PROTECTED] Signed-off-by: Eric W. Biederman [EMAIL PROTECTED] --- net/bluetooth/hidp/core.c | 29 - 1 files changed, 16 insertions(+), 13 deletions(-) diff --git a/net/bluetooth/hidp/core.c b/net/bluetooth/hidp/core.c index df2c471..1c9b202 100644 --- a/net/bluetooth/hidp/core.c +++ b/net/bluetooth/hidp/core.c @@ -36,6 +36,7 @@ #include linux/init.h #include linux/wait.h #include linux/freezer.h +#include linux/kthread.h #include net/sock.h #include linux/input.h @@ -531,22 +532,11 @@ static int hidp_session(void *arg) struct sock *ctrl_sk = session-ctrl_sock-sk; struct sock *intr_sk = session-intr_sock-sk; struct sk_buff *skb; - int vendor = 0x, product = 0x; wait_queue_t ctrl_wait, intr_wait; BT_DBG(session %p, session); - if (session-input) { - vendor = session-input-id.vendor; - product = session-input-id.product; - } - - if (session-hid) { - vendor = session-hid-vendor; - product = session-hid-product; - } - daemonize(khidpd_%04x%04x, vendor, product); set_user_nice(current, -15); init_waitqueue_entry(ctrl_wait, current); @@ -747,7 +737,9 @@ static inline void hidp_setup_hid(struct hidp_session *session, struct hidp_conn int hidp_add_connection(struct hidp_connadd_req *req, struct socket *ctrl_sock, struct socket *intr_sock) { + int vendor = 0x, product = 0x; struct hidp_session *session, *s; + struct task_struct *task; int err; BT_DBG(); @@ -834,8 +826,19 @@ int hidp_add_connection(struct hidp_connadd_req *req, struct socket *ctrl_sock, hidp_set_timer(session); - err = kernel_thread(hidp_session, session, CLONE_KERNEL); - if (err 0) + if (session-input) { + vendor = session-input-id.vendor; + product = session-input-id.product; + } + + if (session-hid) { + vendor = session-hid-vendor; + product = session-hid-product; + } + task = kthread_run(hidp_session, session, + khidpd_%04x%04x, vendor, product); + err = PTR_ERR(task); + if (IS_ERR(task)) goto unlink; if (session-input) { -- 1.5.0.g53756 - To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] bluetooth rfcomm: Convert to kthread API.
From: Eric W. Biederman [EMAIL PROTECTED] This patch starts krfcommd using kthread_run instead of a combination of kernel_thread and daemonize making the code slightly simpler and more maintainable. Cc: Marcel Holtmann [EMAIL PROTECTED] Signed-off-by: Eric W. Biederman [EMAIL PROTECTED] --- net/bluetooth/rfcomm/core.c |4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/net/bluetooth/rfcomm/core.c b/net/bluetooth/rfcomm/core.c index 34f993a..baaad49 100644 --- a/net/bluetooth/rfcomm/core.c +++ b/net/bluetooth/rfcomm/core.c @@ -38,6 +38,7 @@ #include linux/net.h #include linux/mutex.h #include linux/freezer.h +#include linux/kthread.h #include net/sock.h #include asm/uaccess.h @@ -1938,7 +1939,6 @@ static int rfcomm_run(void *unused) atomic_inc(running); - daemonize(krfcommd); set_user_nice(current, -10); BT_DBG(); @@ -2058,7 +2058,7 @@ static int __init rfcomm_init(void) hci_register_cb(rfcomm_cb); - kernel_thread(rfcomm_run, NULL, CLONE_KERNEL); + kthread_run(rfcomm_run, NULL, krfcommd); if (class_create_file(bt_class, class_attr_rfcomm_dlc) 0) BT_ERR(Failed to create RFCOMM info file); -- 1.5.0.g53756 - To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] s390 qeth: Convert to use the kthread API
From: Eric W. Biederman [EMAIL PROTECTED] This patch modifies the qeth_recover thread to be started with kthread_run not a combination of kernel_thread and daemonize. Resulting in slightly simpler and more maintainable code. Cc: Frank Pavlic [EMAIL PROTECTED] Signed-off-by: Eric W. Biederman [EMAIL PROTECTED] --- drivers/s390/net/qeth_main.c |4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/s390/net/qeth_main.c b/drivers/s390/net/qeth_main.c index ad7792d..8234846 100644 --- a/drivers/s390/net/qeth_main.c +++ b/drivers/s390/net/qeth_main.c @@ -50,6 +50,7 @@ #include linux/mii.h #include linux/rcupdate.h #include linux/ethtool.h +#include linux/kthread.h #include net/arp.h #include net/ip.h @@ -957,7 +958,6 @@ qeth_recover(void *ptr) int rc = 0; card = (struct qeth_card *) ptr; - daemonize(qeth_recover); QETH_DBF_TEXT(trace,2,recover1); QETH_DBF_HEX(trace, 2, card, sizeof(void *)); if (!qeth_do_run_thread(card, QETH_RECOVER_THREAD)) @@ -1014,7 +1014,7 @@ qeth_start_kernel_thread(struct work_struct *work) card-write.state != CH_STATE_UP) return; if (qeth_do_start_thread(card, QETH_RECOVER_THREAD)) - kernel_thread(qeth_recover, (void *) card, SIGCHLD); + kthread_run(qeth_recover, card, qeth_recover); } -- 1.5.0.g53756 - To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] synchro_test: Convert to the kthread API.
From: Eric W. Biederman [EMAIL PROTECTED] Cc: David Howells [EMAIL PROTECTED] Signed-off-by: Eric W. Biederman [EMAIL PROTECTED] --- kernel/synchro-test.c | 16 ++-- 1 files changed, 6 insertions(+), 10 deletions(-) diff --git a/kernel/synchro-test.c b/kernel/synchro-test.c index a4747a6..b1d7fd6 100644 --- a/kernel/synchro-test.c +++ b/kernel/synchro-test.c @@ -30,6 +30,7 @@ #include linux/timer.h #include linux/completion.h #include linux/mutex.h +#include linux/kthread.h #define MAX_THREADS 64 @@ -224,7 +225,6 @@ static int mutexer(void *arg) { unsigned int N = (unsigned long) arg; - daemonize(Mutex%u, N); set_user_nice(current, 19); while (atomic_read(do_stuff)) { @@ -246,7 +246,6 @@ static int semaphorer(void *arg) { unsigned int N = (unsigned long) arg; - daemonize(Sem%u, N); set_user_nice(current, 19); while (atomic_read(do_stuff)) { @@ -268,7 +267,6 @@ static int reader(void *arg) { unsigned int N = (unsigned long) arg; - daemonize(Read%u, N); set_user_nice(current, 19); while (atomic_read(do_stuff)) { @@ -292,7 +290,6 @@ static int writer(void *arg) { unsigned int N = (unsigned long) arg; - daemonize(Write%u, N); set_user_nice(current, 19); while (atomic_read(do_stuff)) { @@ -316,7 +313,6 @@ static int downgrader(void *arg) { unsigned int N = (unsigned long) arg; - daemonize(Down%u, N); set_user_nice(current, 19); while (atomic_read(do_stuff)) { @@ -433,27 +429,27 @@ static int __init do_tests(void) for (loop = 0; loop MAX_THREADS; loop++) { if (loop nummx) { init_completion(mx_comp[loop]); - kernel_thread(mutexer, (void *) loop, 0); + kthread_run(mutexer, (void *) loop, Mutex%u, loop); } if (loop numsm) { init_completion(sm_comp[loop]); - kernel_thread(semaphorer, (void *) loop, 0); + kthread_run(semaphorer, (void *) loop, Sem%u, loop); } if (loop numrd) { init_completion(rd_comp[loop]); - kernel_thread(reader, (void *) loop, 0); + kthread_run(reader, (void *) loop, Read%u, loop); } if (loop numwr) { init_completion(wr_comp[loop]); - kernel_thread(writer, (void *) loop, 0); + kthread_run(writer, (void *) loop, Write%u, loop); } if (loop numdg) { init_completion(dg_comp[loop]); - kernel_thread(downgrader, (void *) loop, 0); + kthread_run(downgrader, (void *) loop, Down%u, loop); } } -- 1.5.0.g53756 - To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: question on generic gpio interface
On 4/17/07, David Brownell [EMAIL PROTECTED] wrote: In this case I'm not entirely sure how it'd work. I've seen a few drivers which let userspace peek and poke at GPIO signals -- like one for Gumstix boards -- but generalizing the model isn't simple. Sub-problems include: - Configuring the relevant pins. Especially for SOC cases, GPIO roles are multiplexed with several others. So there are two issues: (a) the platform-specific setup of that multiplexing, plus (b) the board-specific knowledge of what pins are truly available for use as GPIOs, and not otherwise in use. what about create a module user-gpio for example that could request some gpios that the board could have declared using resource subsystem, like this: static struct resource foo_gpio_resource[] = { [0] = { .start = 10, .end = 11, .flags = IORESOURCE_GPIO, }, [1] = { .start = 26, .end = 31, .flags = IORESOURCE_GPIO, }, }; struct platform_device foo_device_usergpio = { .name = user-gpio, .id = -1, .num_resources = ARRAY_SIZE(foo_gpio_resource), .resource = foo_gpio_resource, }; This way user-gpio module knows which pins are avalaible to userspace. - Enumerating those GPIOs to userspace. One SOC might have just a few dozen, another might have a few hundred; and then there are all the board-specific ones, on FPGA or I2C chips etc. This point is actully the one where I'm really not sure... Enumerating user GPIOs would always start from 0 to GPIO_USER_NR - 1 and an application that need to be portable should use a config file to specify which GPIO num to use... - Exposing those pins to userspace. It'd be unsafe to let pins claimed by drivers be managed by userspace; the default should be that only unclaimed GPIOs can be accessed. Well an extreme solution would be to test in gpio_request(), if the passed gpio nr is a user one then gpio_request() would return an error. We could use is_user_gpio() function implemented by user-gpio module Thanks -- Francis - To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] sparc64/power.c: Convert to use the kthread API
From: Eric W. Biederman [EMAIL PROTECTED] This starts the sparc64 powerd using kthread_run instead of kernel_thread and daemonize. Making the code slightly simpler and more maintainable. In addition the unnecessary flush_signals is removed. Cc: David S. Miller [EMAIL PROTECTED] Signed-off-by: Eric W. Biederman [EMAIL PROTECTED] --- arch/sparc64/kernel/power.c |8 1 files changed, 4 insertions(+), 4 deletions(-) diff --git a/arch/sparc64/kernel/power.c b/arch/sparc64/kernel/power.c index 699b24b..03feb8b 100644 --- a/arch/sparc64/kernel/power.c +++ b/arch/sparc64/kernel/power.c @@ -13,6 +13,7 @@ #include linux/interrupt.h #include linux/pm.h #include linux/syscalls.h +#include linux/kthread.h #include asm/system.h #include asm/auxio.h @@ -81,15 +82,12 @@ static int powerd(void *__unused) char *argv[] = { /sbin/shutdown, -h, now, NULL }; DECLARE_WAITQUEUE(wait, current); - daemonize(powerd); - add_wait_queue(powerd_wait, wait); again: for (;;) { set_task_state(current, TASK_INTERRUPTIBLE); if (button_pressed) break; - flush_signals(current); schedule(); } __set_current_state(TASK_RUNNING); @@ -128,7 +126,9 @@ static int __devinit power_probe(struct of_device *op, const struct of_device_id poweroff_method = machine_halt; /* able to use the standard halt */ if (has_button_interrupt(irq, op-node)) { - if (kernel_thread(powerd, NULL, CLONE_FS) 0) { + struct task_struct *task; + task = kthread_urn(powerd, NULL, powerd); + if (IS_ERR(task)) { printk(Failed to start power daemon.\n); return 0; } -- 1.5.0.g53756 - To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] s390/scsi/zfcp_erp: Convert to use the kthread API
From: Eric W. Biederman [EMAIL PROTECTED] Modify zfcperp%s to be started with kthread_run not a combination of kernel_thread, daemonize and siginitsetinv making the code slightly simpler and more maintainable. Cc: Swen Schillig [EMAIL PROTECTED] Signed-off-by: Eric W. Biederman [EMAIL PROTECTED] --- drivers/s390/scsi/zfcp_erp.c | 13 ++--- 1 files changed, 6 insertions(+), 7 deletions(-) diff --git a/drivers/s390/scsi/zfcp_erp.c b/drivers/s390/scsi/zfcp_erp.c index 66c0b09..f26536d 100644 --- a/drivers/s390/scsi/zfcp_erp.c +++ b/drivers/s390/scsi/zfcp_erp.c @@ -21,6 +21,7 @@ #define ZFCP_LOG_AREA ZFCP_LOG_AREA_ERP +#include linux/kthread.h #include zfcp_ext.h static int zfcp_erp_adisc(struct zfcp_port *); @@ -985,12 +986,13 @@ static void zfcp_erp_action_dismiss(struct zfcp_erp_action *erp_action) int zfcp_erp_thread_setup(struct zfcp_adapter *adapter) { - int retval = 0; + struct task_struct *task; atomic_clear_mask(ZFCP_STATUS_ADAPTER_ERP_THREAD_UP, adapter-status); - retval = kernel_thread(zfcp_erp_thread, adapter, SIGCHLD); - if (retval 0) { + task = kthread_run(zfcp_erp_thread, adapter, + zfcperp%s, zfcp_get_busid_by_adapter(adapter)); + if (IS_ERR(task)) { ZFCP_LOG_NORMAL(error: creation of erp thread failed for adapter %s\n, zfcp_get_busid_by_adapter(adapter)); @@ -1002,7 +1004,7 @@ zfcp_erp_thread_setup(struct zfcp_adapter *adapter) debug_text_event(adapter-erp_dbf, 5, a_thset_ok); } - return (retval 0); + return IS_ERR(task); } /* @@ -1054,9 +1056,6 @@ zfcp_erp_thread(void *data) struct zfcp_erp_action *erp_action; unsigned long flags; - daemonize(zfcperp%s, zfcp_get_busid_by_adapter(adapter)); - /* Block all signals */ - siginitsetinv(current-blocked, 0); atomic_set_mask(ZFCP_STATUS_ADAPTER_ERP_THREAD_UP, adapter-status); debug_text_event(adapter-erp_dbf, 5, a_th_run); wake_up(adapter-erp_thread_wqh); -- 1.5.0.g53756 - To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] cpqphp: Convert to use the kthread API
From: Eric W. Biederman [EMAIL PROTECTED] This patch changes cpqphp to use kthread_run and not kernel_thread and daemonize to startup and setup the cpqphp thread. Cc: Greg Kroah-Hartman [EMAIL PROTECTED] Signed-off-by: Eric W. Biederman [EMAIL PROTECTED] --- drivers/pci/hotplug/cpqphp_ctrl.c | 12 1 files changed, 4 insertions(+), 8 deletions(-) diff --git a/drivers/pci/hotplug/cpqphp_ctrl.c b/drivers/pci/hotplug/cpqphp_ctrl.c index 79ff6b4..c2c06c4 100644 --- a/drivers/pci/hotplug/cpqphp_ctrl.c +++ b/drivers/pci/hotplug/cpqphp_ctrl.c @@ -37,6 +37,7 @@ #include linux/smp_lock.h #include linux/pci.h #include linux/pci_hotplug.h +#include linux/kthread.h #include cpqphp.h static u32 configure_new_device(struct controller* ctrl, struct pci_func *func, @@ -1746,10 +1747,6 @@ static void pushbutton_helper_thread(unsigned long data) static int event_thread(void* data) { struct controller *ctrl; - lock_kernel(); - daemonize(phpd_event); - - unlock_kernel(); while (1) { dbg(event_thread sleeping\n); @@ -1771,7 +1768,7 @@ static int event_thread(void* data) int cpqhp_event_start_thread(void) { - int pid; + struct task_struct *task; /* initialize our semaphores */ init_MUTEX(delay_sem); @@ -1779,12 +1776,11 @@ int cpqhp_event_start_thread(void) init_MUTEX_LOCKED(event_exit); event_finished=0; - pid = kernel_thread(event_thread, NULL, 0); - if (pid 0) { + task = kthread_run(event_thread, NULL, phpd_event); + if (IS_ERR(task)) { err (Can't start up our event thread\n); return -1; } - dbg(Our event thread pid = %d\n, pid); return 0; } -- 1.5.0.g53756 - To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] mtd_blkdevs: Convert to use the kthread API
From: Eric W. Biederman [EMAIL PROTECTED] thread_run is used intead of kernel_thread, daemonize, and mucking around blocking signals directly. CC: David Woodhouse [EMAIL PROTECTED] Signed-off-by: Eric W. Biederman [EMAIL PROTECTED] --- drivers/mtd/mtd_blkdevs.c | 19 +-- 1 files changed, 5 insertions(+), 14 deletions(-) diff --git a/drivers/mtd/mtd_blkdevs.c b/drivers/mtd/mtd_blkdevs.c index db7397c..ed71d5e 100644 --- a/drivers/mtd/mtd_blkdevs.c +++ b/drivers/mtd/mtd_blkdevs.c @@ -21,6 +21,7 @@ #include linux/init.h #include linux/mutex.h #include linux/freezer.h +#include linux/kthread.h #include asm/uaccess.h static LIST_HEAD(blktrans_majors); @@ -84,17 +85,6 @@ static int mtd_blktrans_thread(void *arg) /* we might get involved when memory gets low, so use PF_MEMALLOC */ current-flags |= PF_MEMALLOC | PF_NOFREEZE; - daemonize(%sd, tr-name); - - /* daemonize() doesn't do this for us since some kernel threads - actually want to deal with signals. We can't just call - exit_sighand() since that'll cause an oops when we finally - do exit. */ - spin_lock_irq(current-sighand-siglock); - sigfillset(current-blocked); - recalc_sigpending(); - spin_unlock_irq(current-sighand-siglock); - spin_lock_irq(rq-queue_lock); while (!tr-blkcore_priv-exiting) { @@ -368,6 +358,7 @@ static struct mtd_notifier blktrans_notifier = { int register_mtd_blktrans(struct mtd_blktrans_ops *tr) { + struct task_struct *task; int ret, i; /* Register the notifier if/when the first device type is @@ -406,13 +397,13 @@ int register_mtd_blktrans(struct mtd_blktrans_ops *tr) blk_queue_hardsect_size(tr-blkcore_priv-rq, tr-blksize); tr-blkshift = ffs(tr-blksize) - 1; - ret = kernel_thread(mtd_blktrans_thread, tr, CLONE_KERNEL); - if (ret 0) { + task = kthread_run(mtd_blktrans_thread, tr, %sd, tr-name); + if (IS_ERR(task)) { blk_cleanup_queue(tr-blkcore_priv-rq); unregister_blkdev(tr-major, tr-name); kfree(tr-blkcore_priv); mutex_unlock(mtd_table_mutex); - return ret; + return PTR_ERR(task); } INIT_LIST_HEAD(tr-devs); -- 1.5.0.g53756 - To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [CRYPTO] is it really optimized ?
On 4/17/07, Roland Dreier [EMAIL PROTECTED] wrote: It seems trivial to keep the last key you were given and do a quick memcmp in your setkey method to see if it's different from the last key you pushed to hardware, and set a flag if it is. Then only do your set_key() if you have a new key to pass to hardware. I'm assuming the expense is in the aes_write() calls, and you could avoid them if you know you're not writing something new. that's a wrong assumption. aes_write()/aes_read() are both used to access to the controller and are slow (no cache involved). Sorry, I wasn't clear. I meant that the hardware access is what is slow, and that anything you do on the CPU is relatively cheap compared to that. So my suggestion is just to keep a cache (in CPU memory) of what you have already loaded into the HW, and before reloading the HW just check the cache and don't do the actual HW access if you're not going to change the HW contents. So you avoid any extra aes_write and aes_read calls in the cache hit case. This would have the advantage of making anything that does lots of bulk encryption fast without special casing ecryptfs. I'm not sure how memcmp(key, cache, KEY_SIZE) would impact AES performance. I need to give it a test but can't today. I'll do tomorrow and give you back the result. Thanks -- Francis - To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] saa7134-tvaudio: Convert to kthread API.
From: Eric W. Biederman [EMAIL PROTECTED] It is my goal to replace all kernel code that handles signals from user space, calls kernel_thread or calls daemonize. All of which the kthread_api makes unncessary. Handling signals from user space is a maintenance problem becuase using a kernel thread is an implementation detail and if user space cares it does not allow us to change the implementation. Calling daemonize is a problem because it has to undo a continually changing set of state generated by user space, requiring the implemetation to change continually. kernel_thread is a problem because it returns a pid_t value. Numeric pids are inherently racy and in the presence of a pid namespace they are no longer global making them useless for general use in the kernel. So this patch renames the pid member of struct saa7134_thread started and changes it's type from pid_t to int. All it has ever been used for is to detect if the kernel thread is has been started so this works. allow_signal(SIGTERM) and the calls to signal_pending have been removed they are needed for the driver to operation. The startup of tvaudio_thread and tvaudio_thread_dep have been modified to use kthread_run instead of a combination of kernel_thread and daemonize. The result is code that is slightly simpler and more maintainable. Cc: Hartmut Hackmann [EMAIL PROTECTED] Cc: Mauro Carvalho Chehab [EMAIL PROTECTED] Signed-off-by: Eric W. Biederman [EMAIL PROTECTED] --- drivers/media/video/saa7134/saa7134-tvaudio.c | 27 - drivers/media/video/saa7134/saa7134.h |2 +- 2 files changed, 14 insertions(+), 15 deletions(-) diff --git a/drivers/media/video/saa7134/saa7134-tvaudio.c b/drivers/media/video/saa7134/saa7134-tvaudio.c index 7b56041..b636cb1 100644 --- a/drivers/media/video/saa7134/saa7134-tvaudio.c +++ b/drivers/media/video/saa7134/saa7134-tvaudio.c @@ -27,6 +27,7 @@ #include linux/kernel.h #include linux/slab.h #include linux/delay.h +#include linux/kthread.h #include asm/div64.h #include saa7134-reg.h @@ -505,11 +506,9 @@ static int tvaudio_thread(void *data) unsigned int i, audio, nscan; int max1,max2,carrier,rx,mode,lastmode,default_carrier; - daemonize(%s, dev-name); - allow_signal(SIGTERM); for (;;) { tvaudio_sleep(dev,-1); - if (dev-thread.shutdown || signal_pending(current)) + if (dev-thread.shutdown) goto done; restart: @@ -618,7 +617,7 @@ static int tvaudio_thread(void *data) for (;;) { if (tvaudio_sleep(dev,5000)) goto restart; - if (dev-thread.shutdown || signal_pending(current)) + if (dev-thread.shutdown) break; if (UNSET == dev-thread.mode) { rx = tvaudio_getstereo(dev,tvaudio[i]); @@ -782,9 +781,6 @@ static int tvaudio_thread_ddep(void *data) struct saa7134_dev *dev = data; u32 value, norms, clock; - daemonize(%s, dev-name); - allow_signal(SIGTERM); - clock = saa7134_boards[dev-board].audio_clock; if (UNSET != audio_clock_override) clock = audio_clock_override; @@ -796,7 +792,7 @@ static int tvaudio_thread_ddep(void *data) for (;;) { tvaudio_sleep(dev,-1); - if (dev-thread.shutdown || signal_pending(current)) + if (dev-thread.shutdown) goto done; restart: @@ -986,14 +982,17 @@ int saa7134_tvaudio_init2(struct saa7134_dev *dev) break; } - dev-thread.pid = -1; + dev-thread.started = 0; if (my_thread) { + struct task_struct *task; /* start tvaudio thread */ init_waitqueue_head(dev-thread.wq); init_completion(dev-thread.exit); - dev-thread.pid = kernel_thread(my_thread,dev,0); - if (dev-thread.pid 0) - printk(KERN_WARNING %s: kernel_thread() failed\n, + task = kthread_run(my_thread, dev, %s, dev-name); + if (!IS_ERR(task)) + dev-thread.started = 1; + else + printk(KERN_WARNING %s: kthread_create() failed\n, dev-name); saa7134_tvaudio_do_scan(dev); } @@ -1005,7 +1004,7 @@ int saa7134_tvaudio_init2(struct saa7134_dev *dev) int saa7134_tvaudio_fini(struct saa7134_dev *dev) { /* shutdown tvaudio thread */ - if (dev-thread.pid = 0) { + if (dev-thread.started) { dev-thread.shutdown = 1; wake_up_interruptible(dev-thread.wq); wait_for_completion(dev-thread.exit); @@ -1020,7 +1019,7 @@ int saa7134_tvaudio_do_scan(struct saa7134_dev *dev)
[PATCH] dvb_en_50221: Convert to kthread API
From: Eric W. Biederman [EMAIL PROTECTED] This patch is a minimal transformation to use the kthread API doing it's best to preserve the existing logic. Instead of starting kdvb-ca by calling kernel_thread, daemonize and sigfillset we kthread_run is used. Instead of tracking the pid of the running thread we instead simply keep a flag to indicate that the current thread is running, as that is all the pid is really used for. And finally the kill_proc sending signal 0 to the kernel thread to ensure it is alive before we wait for it to shutdown is removed. The kthread API does not provide the pid so we don't have that information readily available and the test is just silly. If there is no shutdown race the test is a useless confirmation of that the thread is running. If there is a race the test doesn't fix it and we should fix the race properly. Cc: Andrew de Quincey [EMAIL PROTECTED] Cc: Mauro Carvalho Chehab [EMAIL PROTECTED] Signed-off-by: Eric W. Biederman [EMAIL PROTECTED] --- drivers/media/dvb/dvb-core/dvb_ca_en50221.c | 46 ++ 1 files changed, 18 insertions(+), 28 deletions(-) diff --git a/drivers/media/dvb/dvb-core/dvb_ca_en50221.c b/drivers/media/dvb/dvb-core/dvb_ca_en50221.c index 2a03bf5..b28bc15 100644 --- a/drivers/media/dvb/dvb-core/dvb_ca_en50221.c +++ b/drivers/media/dvb/dvb-core/dvb_ca_en50221.c @@ -37,6 +37,7 @@ #include linux/delay.h #include linux/spinlock.h #include linux/sched.h +#include linux/kthread.h #include dvb_ca_en50221.h #include dvb_ringbuffer.h @@ -139,8 +140,8 @@ struct dvb_ca_private { /* wait queues for read() and write() operations */ wait_queue_head_t wait_queue; - /* PID of the monitoring thread */ - pid_t thread_pid; + /* Flag indicating the monitoring thread is running */ + int thread_running; /* Wait queue used when shutting thread down */ wait_queue_head_t thread_queue; @@ -982,7 +983,6 @@ static void dvb_ca_en50221_thread_update_delay(struct dvb_ca_private *ca) static int dvb_ca_en50221_thread(void *data) { struct dvb_ca_private *ca = data; - char name[15]; int slot; int flags; int status; @@ -991,14 +991,6 @@ static int dvb_ca_en50221_thread(void *data) dprintk(%s\n, __FUNCTION__); - /* setup kernel thread */ - snprintf(name, sizeof(name), kdvb-ca-%i:%i, ca-dvbdev-adapter-num, ca-dvbdev-id); - - lock_kernel(); - daemonize(name); - sigfillset(current-blocked); - unlock_kernel(); - /* choose the correct initial delay */ dvb_ca_en50221_thread_update_delay(ca); @@ -1182,7 +1174,7 @@ static int dvb_ca_en50221_thread(void *data) } /* completed */ - ca-thread_pid = 0; + ca-thread_running = 0; mb(); wake_up_interruptible(ca-thread_queue); return 0; @@ -1660,6 +1652,7 @@ static struct dvb_device dvbdev_ca = { int dvb_ca_en50221_init(struct dvb_adapter *dvb_adapter, struct dvb_ca_en50221 *pubca, int flags, int slot_count) { + struct task_struct *task; int ret; struct dvb_ca_private *ca = NULL; int i; @@ -1682,7 +1675,7 @@ int dvb_ca_en50221_init(struct dvb_adapter *dvb_adapter, goto error; } init_waitqueue_head(ca-wait_queue); - ca-thread_pid = 0; + ca-thread_running = 0; init_waitqueue_head(ca-thread_queue); ca-exit = 0; ca-open = 0; @@ -1711,13 +1704,15 @@ int dvb_ca_en50221_init(struct dvb_adapter *dvb_adapter, /* create a kthread for monitoring this CA device */ - ret = kernel_thread(dvb_ca_en50221_thread, ca, 0); - - if (ret 0) { - printk(dvb_ca_init: failed to start kernel_thread (%d)\n, ret); + task = kthread_run(dvb_ca_en50221_thread, ca, + kdvb-ca-%i:%i, + ca-dvbdev-adapter-num, ca-dvbdev-id); + if (IS_ERR(task)) { + ret = PTR_ERR(task); + printk(dvb_ca_init: failed to start kthread (%d)\n, ret); goto error; } - ca-thread_pid = ret; + ca-thread_running = 1; return 0; error: @@ -1748,16 +1743,11 @@ void dvb_ca_en50221_release(struct dvb_ca_en50221 *pubca) dprintk(%s\n, __FUNCTION__); /* shutdown the thread if there was one */ - if (ca-thread_pid) { - if (kill_proc(ca-thread_pid, 0, 1) == -ESRCH) { - printk(dvb_ca_release adapter %d: thread PID %d already died\n, - ca-dvbdev-adapter-num, ca-thread_pid); - } else { - ca-exit = 1; - mb(); - dvb_ca_en50221_thread_wakeup(ca); - wait_event_interruptible(ca-thread_queue, ca-thread_pid == 0); - } + if (ca-thread_running) { + ca-exit = 1; +
[PATCH] s390/net/lcs: Convert to the kthread API
From: Eric W. Biederman [EMAIL PROTECTED] Use kthread_run to start the lcs kernel threads not a combination of kernel_thread and daemonize. This makes the code slightly simpler and more maintainable. Cc: Frank Pavlic [EMAIL PROTECTED] Signed-off-by: Eric W. Biederman [EMAIL PROTECTED] --- drivers/s390/net/lcs.c |8 +++- 1 files changed, 3 insertions(+), 5 deletions(-) diff --git a/drivers/s390/net/lcs.c b/drivers/s390/net/lcs.c index 08a994f..0300d87 100644 --- a/drivers/s390/net/lcs.c +++ b/drivers/s390/net/lcs.c @@ -36,6 +36,7 @@ #include linux/in.h #include linux/igmp.h #include linux/delay.h +#include linux/kthread.h #include net/arp.h #include net/ip.h @@ -1248,7 +1249,6 @@ lcs_register_mc_addresses(void *data) struct in_device *in4_dev; card = (struct lcs_card *) data; - daemonize(regipm); if (!lcs_do_run_thread(card, LCS_SET_MC_THREAD)) return 0; @@ -1728,11 +1728,10 @@ lcs_start_kernel_thread(struct work_struct *work) struct lcs_card *card = container_of(work, struct lcs_card, kernel_thread_starter); LCS_DBF_TEXT(5, trace, krnthrd); if (lcs_do_start_thread(card, LCS_RECOVERY_THREAD)) - kernel_thread(lcs_recovery, (void *) card, SIGCHLD); + kthread_run(lcs_recovery, card, lcs_recover); #ifdef CONFIG_IP_MULTICAST if (lcs_do_start_thread(card, LCS_SET_MC_THREAD)) - kernel_thread(lcs_register_mc_addresses, - (void *) card, SIGCHLD); + kernel_run(lcs_register_mc_addresses, card, regipm); #endif } @@ -2232,7 +2231,6 @@ lcs_recovery(void *ptr) int rc; card = (struct lcs_card *) ptr; - daemonize(lcs_recover); LCS_DBF_TEXT(4, trace, recover1); if (!lcs_do_run_thread(card, LCS_RECOVERY_THREAD)) -- 1.5.0.g53756 - To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] powerpc pseries eeh: Convert to kthread API
From: Eric W. Biederman [EMAIL PROTECTED] This patch modifies the startup of eehd to use kthread_run not a combination of kernel_thread and daemonize. Making the code slightly simpler and more maintainable. Cc: Paul Mackerras [EMAIL PROTECTED] Signed-off-by: Eric W. Biederman [EMAIL PROTECTED] --- arch/powerpc/platforms/pseries/eeh_event.c |4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/powerpc/platforms/pseries/eeh_event.c b/arch/powerpc/platforms/pseries/eeh_event.c index 221dec8..fe7c2e0 100644 --- a/arch/powerpc/platforms/pseries/eeh_event.c +++ b/arch/powerpc/platforms/pseries/eeh_event.c @@ -23,6 +23,7 @@ #include linux/mutex.h #include linux/pci.h #include linux/workqueue.h +#include linux/kthread.h #include asm/eeh_event.h #include asm/ppc-pci.h @@ -59,7 +60,6 @@ static int eeh_event_handler(void * dummy) struct eeh_event*event; struct pci_dn *pdn; - daemonize (eehd); set_current_state(TASK_INTERRUPTIBLE); spin_lock_irqsave(eeh_eventlist_lock, flags); @@ -105,7 +105,7 @@ static int eeh_event_handler(void * dummy) */ static void eeh_thread_launcher(struct work_struct *dummy) { - if (kernel_thread(eeh_event_handler, NULL, CLONE_KERNEL) 0) + if (IS_ERR(kthread_run(eeh_event_handler, NULL, eehd))) printk(KERN_ERR Failed to start EEH daemon\n); } -- 1.5.0.g53756 - To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] macintosh/adb: Convert to the kthread API
From: Eric W. Biederman [EMAIL PROTECTED] This patch modifies the startup of kadbprobe to use kthread_run instead of scheduling a work event which later calls kernel_thread and in the thread calls daemonize and blocks signals. kthread_run is simpler and more maintainable. The variable pid_t adb_probe_task_pid is replaced by a struct task_struct variable named adb_probe_task. Which works equally well with for testing if the current process is the adb_probe thread, does not get confused in the presence of a pid namespace and is easier to compare against current as it is the same type. The result is code that is slightly simpler and easier to maintain. Cc: Benjamin Herrenschmidt [EMAIL PROTECTED] Cc: Paul Mackerras [EMAIL PROTECTED] Signed-off-by: Eric W. Biederman [EMAIL PROTECTED] --- drivers/macintosh/adb.c | 32 +++- 1 files changed, 7 insertions(+), 25 deletions(-) diff --git a/drivers/macintosh/adb.c b/drivers/macintosh/adb.c index adfea3c..09c5261 100644 --- a/drivers/macintosh/adb.c +++ b/drivers/macintosh/adb.c @@ -35,6 +35,7 @@ #include linux/spinlock.h #include linux/completion.h #include linux/device.h +#include linux/kthread.h #include asm/uaccess.h #include asm/semaphore.h @@ -82,7 +83,7 @@ struct adb_driver *adb_controller; BLOCKING_NOTIFIER_HEAD(adb_client_list); static int adb_got_sleep; static int adb_inited; -static pid_t adb_probe_task_pid; +static struct task_struct *adb_probe_task; static DECLARE_MUTEX(adb_probe_mutex); static struct completion adb_probe_task_comp; static int sleepy_trackpad; @@ -137,8 +138,7 @@ static void printADBreply(struct adb_request *req) static __inline__ void adb_wait_ms(unsigned int ms) { - if (current-pid adb_probe_task_pid - adb_probe_task_pid == current-pid) + if (adb_probe_task == current) msleep(ms); else mdelay(ms); @@ -245,35 +245,19 @@ static int adb_scan_bus(void) * This kernel task handles ADB probing. It dies once probing is * completed. */ -static int -adb_probe_task(void *x) +static int adb_probe(void *x) { - sigset_t blocked; - - strcpy(current-comm, kadbprobe); - - sigfillset(blocked); - sigprocmask(SIG_BLOCK, blocked, NULL); - flush_signals(current); printk(KERN_INFO adb: starting probe task...\n); do_adb_reset_bus(); printk(KERN_INFO adb: finished probe task...\n); - adb_probe_task_pid = 0; + adb_probe_task = NULL; up(adb_probe_mutex); return 0; } -static void -__adb_probe_task(struct work_struct *bullshit) -{ - adb_probe_task_pid = kernel_thread(adb_probe_task, NULL, SIGCHLD | CLONE_KERNEL); -} - -static DECLARE_WORK(adb_reset_work, __adb_probe_task); - int adb_reset_bus(void) { @@ -283,7 +267,7 @@ adb_reset_bus(void) } down(adb_probe_mutex); - schedule_work(adb_reset_work); + adb_probe_task = kthread_run(adb_probe, NULL, kadbprobe); return 0; } @@ -469,9 +453,7 @@ adb_request(struct adb_request *req, void (*done)(struct adb_request *), /* Synchronous requests send from the probe thread cause it to * block. Beware that the done callback will be overriden ! */ - if ((flags ADBREQ_SYNC) - (current-pid adb_probe_task_pid - adb_probe_task_pid == current-pid)) { + if ((flags ADBREQ_SYNC) (current == adb_probe_task)) { req-done = adb_probe_wakeup; rc = adb_controller-send_request(req, 0); if (rc || req-complete) -- 1.5.0.g53756 - To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] sas_scsi_host: Convert to use the kthread API
From: Eric W. Biederman [EMAIL PROTECTED] This patch modifies the sas scsi host thread startup to use kthread_run not kernel_thread and deamonize. kthread_run is slightly simpler and more maintainable. Cc: Darrick J. Wong [EMAIL PROTECTED] Cc: James Bottomley [EMAIL PROTECTED] Signed-off-by: Eric W. Biederman [EMAIL PROTECTED] --- drivers/scsi/libsas/sas_scsi_host.c | 11 ++- 1 files changed, 6 insertions(+), 5 deletions(-) diff --git a/drivers/scsi/libsas/sas_scsi_host.c b/drivers/scsi/libsas/sas_scsi_host.c index 46ba3a7..7a38ac5 100644 --- a/drivers/scsi/libsas/sas_scsi_host.c +++ b/drivers/scsi/libsas/sas_scsi_host.c @@ -40,6 +40,7 @@ #include linux/blkdev.h #include linux/scatterlist.h #include linux/freezer.h +#include linux/kthread.h /* -- SCSI Host glue -- */ @@ -870,7 +871,6 @@ static int sas_queue_thread(void *_sas_ha) struct sas_ha_struct *sas_ha = _sas_ha; struct scsi_core *core = sas_ha-core; - daemonize(sas_queue_%d, core-shost-host_no); current-flags |= PF_NOFREEZE; complete(queue_th_comp); @@ -891,19 +891,20 @@ static int sas_queue_thread(void *_sas_ha) int sas_init_queue(struct sas_ha_struct *sas_ha) { - int res; struct scsi_core *core = sas_ha-core; + struct task_struct *task; spin_lock_init(core-task_queue_lock); core-task_queue_size = 0; INIT_LIST_HEAD(core-task_queue); init_MUTEX_LOCKED(core-queue_thread_sema); - res = kernel_thread(sas_queue_thread, sas_ha, 0); - if (res = 0) + task = kthread_run(sas_queue_thread, sas_ha, + sas_queue_%d, core-shost-host_no); + if (!IS_ERR(task)) wait_for_completion(queue_th_comp); - return res 0 ? res : 0; + return IS_ERR(task) ? PTR_ERR(task) : 0; } void sas_shutdown_queue(struct sas_ha_struct *sas_ha) -- 1.5.0.g53756 - To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] cpci_hotplug: Convert to use the kthread API
From: Eric W. Biederman [EMAIL PROTECTED] kthread_run replaces the kernel_thread and daemonize calls during thread startup. Calls to signal_pending were also removed as it is currently impossible for the cpci_hotplug thread to receive signals. CC: Scott Murray [EMAIL PROTECTED] Signed-off-by: Eric W. Biederman [EMAIL PROTECTED] --- drivers/pci/hotplug/cpci_hotplug_core.c | 22 +++--- 1 files changed, 7 insertions(+), 15 deletions(-) diff --git a/drivers/pci/hotplug/cpci_hotplug_core.c b/drivers/pci/hotplug/cpci_hotplug_core.c index 6845515..c620c7e 100644 --- a/drivers/pci/hotplug/cpci_hotplug_core.c +++ b/drivers/pci/hotplug/cpci_hotplug_core.c @@ -33,6 +33,7 @@ #include linux/init.h #include linux/interrupt.h #include linux/smp_lock.h +#include linux/kthread.h #include asm/atomic.h #include linux/delay.h #include cpci_hotplug.h @@ -521,17 +522,13 @@ event_thread(void *data) { int rc; - lock_kernel(); - daemonize(cpci_hp_eventd); - unlock_kernel(); - dbg(%s - event thread started, __FUNCTION__); while (1) { dbg(event thread sleeping); down_interruptible(event_semaphore); dbg(event thread woken, thread_finished = %d, thread_finished); - if (thread_finished || signal_pending(current)) + if (thread_finished) break; do { rc = check_slots(); @@ -562,12 +559,8 @@ poll_thread(void *data) { int rc; - lock_kernel(); - daemonize(cpci_hp_polld); - unlock_kernel(); - while (1) { - if (thread_finished || signal_pending(current)) + if (thread_finished) break; if (controller-ops-query_enum()) { do { @@ -592,7 +585,7 @@ poll_thread(void *data) static int cpci_start_thread(void) { - int pid; + struct task_struct *task; /* initialize our semaphores */ init_MUTEX_LOCKED(event_semaphore); @@ -600,14 +593,13 @@ cpci_start_thread(void) thread_finished = 0; if (controller-irq) - pid = kernel_thread(event_thread, NULL, 0); + task = kthread_run(event_thread, NULL, cpci_hp_eventd); else - pid = kernel_thread(poll_thread, NULL, 0); - if (pid 0) { + task = kthread_run(poll_thread, NULL, cpci_hp_polld); + if (IS_ERR(task)) { err(Can't start up our thread); return -1; } - dbg(Our thread pid = %d, pid); return 0; } -- 1.5.0.g53756 - To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] macintosh/therm_pm72.c: Convert to kthread API.
From: Eric W. Biederman [EMAIL PROTECTED] This patch modifies startup of the kfand to use kthread_run not a combination of kernel_thread and daemonize, making the code a little simpler and more maintaintable. Cc: Benjamin Herrenschmidt [EMAIL PROTECTED] Signed-off-by: Eric W. Biederman [EMAIL PROTECTED] --- drivers/macintosh/therm_pm72.c | 11 ++- 1 files changed, 6 insertions(+), 5 deletions(-) diff --git a/drivers/macintosh/therm_pm72.c b/drivers/macintosh/therm_pm72.c index b002a4b..7e9cbb7 100644 --- a/drivers/macintosh/therm_pm72.c +++ b/drivers/macintosh/therm_pm72.c @@ -121,6 +121,7 @@ #include linux/reboot.h #include linux/kmod.h #include linux/i2c.h +#include linux/kthread.h #include asm/prom.h #include asm/machdep.h #include asm/io.h @@ -161,7 +162,7 @@ static struct slots_pid_state slots_state; static int state; static int cpu_count; static int cpu_pid_type; -static pid_t ctrl_task; +static int ctrl_task; static struct completion ctrl_complete; static int critical_state; static int rackmac; @@ -1779,8 +1780,6 @@ static int call_critical_overtemp(void) */ static int main_control_loop(void *x) { - daemonize(kfand); - DBG(main_control_loop started\n); down(driver_lock); @@ -1859,7 +1858,6 @@ static int main_control_loop(void *x) machine_power_off(); } - // FIXME: Deal with signals elapsed = jiffies - start; if (elapsed HZ) schedule_timeout_interruptible(HZ - elapsed); @@ -1954,9 +1952,12 @@ static int create_control_loops(void) */ static void start_control_loops(void) { + struct task_struct *task; init_completion(ctrl_complete); - ctrl_task = kernel_thread(main_control_loop, NULL, SIGCHLD | CLONE_KERNEL); + task = kthread_run(main_control_loop, NULL, kfand); + if (!IS_ERR(task)) + ctrl_task = 1; } /* -- 1.5.0.g53756 - To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] ia64 sn xpc: Convert to use kthread API.
From: Eric W. Biederman [EMAIL PROTECTED] This patch starts the xpc kernel threads using kthread_run not a combination of kernel_thread and daemonize. Resuling in slightly simpler and more maintainable code. Cc: Jes Sorensen [EMAIL PROTECTED] Cc: Tony Luck [EMAIL PROTECTED] Signed-off-by: Eric W. Biederman [EMAIL PROTECTED] --- arch/ia64/sn/kernel/xpc_main.c | 31 +-- 1 files changed, 13 insertions(+), 18 deletions(-) diff --git a/arch/ia64/sn/kernel/xpc_main.c b/arch/ia64/sn/kernel/xpc_main.c index e336e16..5b53642 100644 --- a/arch/ia64/sn/kernel/xpc_main.c +++ b/arch/ia64/sn/kernel/xpc_main.c @@ -56,6 +56,7 @@ #include linux/reboot.h #include linux/completion.h #include linux/kdebug.h +#include linux/kthread.h #include asm/sn/intr.h #include asm/sn/sn_sal.h #include asm/uaccess.h @@ -253,8 +254,6 @@ xpc_hb_checker(void *ignore) /* this thread was marked active by xpc_hb_init() */ - daemonize(XPC_HB_CHECK_THREAD_NAME); - set_cpus_allowed(current, cpumask_of_cpu(XPC_HB_CHECK_CPU)); xpc_hb_check_timeout = jiffies + (xpc_hb_check_interval * HZ); @@ -324,8 +323,6 @@ xpc_hb_checker(void *ignore) static int xpc_initiate_discovery(void *ignore) { - daemonize(XPC_DISCOVERY_THREAD_NAME); - xpc_discovery(); dev_dbg(xpc_part, discovery thread is exiting\n); @@ -494,8 +491,6 @@ xpc_activating(void *__partid) dev_dbg(xpc_part, bringing partition %d up\n, partid); - daemonize(xpc%02d, partid); - /* * This thread needs to run at a realtime priority to prevent a * significant performance degradation. @@ -559,7 +554,7 @@ xpc_activate_partition(struct xpc_partition *part) { partid_t partid = XPC_PARTID(part); unsigned long irq_flags; - pid_t pid; + struct task_struct *task; spin_lock_irqsave(part-act_lock, irq_flags); @@ -571,9 +566,10 @@ xpc_activate_partition(struct xpc_partition *part) spin_unlock_irqrestore(part-act_lock, irq_flags); - pid = kernel_thread(xpc_activating, (void *) ((u64) partid), 0); + task = kthread_run(xpc_activating, (void *) ((u64) partid), + xpc%02d, partid); - if (unlikely(pid = 0)) { + if (unlikely(IS_ERR(task))) { spin_lock_irqsave(part-act_lock, irq_flags); part-act_state = XPC_P_INACTIVE; XPC_SET_REASON(part, xpcCloneKThreadFailed, __LINE__); @@ -724,8 +720,6 @@ xpc_daemonize_kthread(void *args) unsigned long irq_flags; - daemonize(xpc%02dc%d, partid, ch_number); - dev_dbg(xpc_chan, kthread starting, partid=%d, channel=%d\n, partid, ch_number); @@ -844,8 +838,9 @@ xpc_create_kthreads(struct xpc_channel *ch, int needed, (void) xpc_part_ref(part); xpc_msgqueue_ref(ch); - pid = kernel_thread(xpc_daemonize_kthread, (void *) args, 0); - if (pid 0) { + task = kthread_run(xpc_daemonize_kthread, args, + xpc%02dc%d, partid, ch_number); + if (IS_ERR(task)) { /* the fork failed */ /* @@ -1222,7 +1217,7 @@ xpc_init(void) int ret; partid_t partid; struct xpc_partition *part; - pid_t pid; + struct task_struct *task; size_t buf_size; @@ -1353,8 +1348,8 @@ xpc_init(void) * The real work-horse behind xpc. This processes incoming * interrupts and monitors remote heartbeats. */ - pid = kernel_thread(xpc_hb_checker, NULL, 0); - if (pid 0) { + task = kthread_run(xpc_hb_checker, NULL, XPC_HB_CHECK_THREAD_NAME); + if (IS_ERR(task)) { dev_err(xpc_part, failed while forking hb check thread\n); /* indicate to others that our reserved page is uninitialized */ @@ -1384,8 +1379,8 @@ xpc_init(void) * activate based on info provided by SAL. This new thread is short * lived and will exit once discovery is complete. */ - pid = kernel_thread(xpc_initiate_discovery, NULL, 0); - if (pid 0) { + task = kthread_run(xpc_initiate_discovery, NULL, XPC_DISCOVERY_THREAD_NAME); + if (IS_ERR(task)) { dev_err(xpc_part, failed while forking discovery thread\n); /* mark this new thread as a non-starter */ -- 1.5.0.g53756 - To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] net/rxrpc: Convert to kthread API.
From: Eric W. Biederman [EMAIL PROTECTED] This patch modifies the startup of krxtimod, krxiod, and krxsecd to use kthread_run instead of a combination of kernel_thread and daemonize making the code slightly simpler and more maintainable. In addition since by default all signals are ignored when delivered to a kernel thread the code to flush signals has been removed. Cc: David Howells [EMAIL PROTECTED] Signed-off-by: Eric W. Biederman [EMAIL PROTECTED] --- net/rxrpc/internal.h | 11 --- net/rxrpc/krxiod.c | 16 net/rxrpc/krxsecd.c | 16 net/rxrpc/krxtimod.c | 15 ++- 4 files changed, 22 insertions(+), 36 deletions(-) diff --git a/net/rxrpc/internal.h b/net/rxrpc/internal.h index cc0c579..1dd69aa 100644 --- a/net/rxrpc/internal.h +++ b/net/rxrpc/internal.h @@ -49,17 +49,6 @@ __RXACCT_DECL(extern atomic_t rxrpc_message_count); #define _net(FMT, a...)do { if (rxrpc_knet) knet (FMT , ##a); } while(0) #endif -static inline void rxrpc_discard_my_signals(void) -{ - while (signal_pending(current)) { - siginfo_t sinfo; - - spin_lock_irq(current-sighand-siglock); - dequeue_signal(current, current-blocked, sinfo); - spin_unlock_irq(current-sighand-siglock); - } -} - /* * call.c */ diff --git a/net/rxrpc/krxiod.c b/net/rxrpc/krxiod.c index bbbcd6c..c590ccd 100644 --- a/net/rxrpc/krxiod.c +++ b/net/rxrpc/krxiod.c @@ -14,6 +14,7 @@ #include linux/spinlock.h #include linux/init.h #include linux/freezer.h +#include linux/kthread.h #include rxrpc/krxiod.h #include rxrpc/transport.h #include rxrpc/peer.h @@ -43,8 +44,6 @@ static int rxrpc_krxiod(void *arg) printk(Started krxiod %d\n,current-pid); - daemonize(krxiod); - /* loop around waiting for work to do */ do { /* wait for work or to be told to exit */ @@ -57,8 +56,7 @@ static int rxrpc_krxiod(void *arg) for (;;) { set_current_state(TASK_INTERRUPTIBLE); if (atomic_read(rxrpc_krxiod_qcount) || - rxrpc_krxiod_die || - signal_pending(current)) + rxrpc_krxiod_die) break; schedule(); @@ -141,9 +139,6 @@ static int rxrpc_krxiod(void *arg) try_to_freeze(); - /* discard pending signals */ - rxrpc_discard_my_signals(); - } while (!rxrpc_krxiod_die); /* and that's all */ @@ -157,7 +152,12 @@ static int rxrpc_krxiod(void *arg) */ int __init rxrpc_krxiod_init(void) { - return kernel_thread(rxrpc_krxiod, NULL, 0); + struct task_struct *task; + int ret = 0; + task = kthread_run(rxrpc_krxiod, NULL, krxiod); + if (IS_ERR(task)) + ret = PTR_ERR(task); + return ret; } /* end rxrpc_krxiod_init() */ diff --git a/net/rxrpc/krxsecd.c b/net/rxrpc/krxsecd.c index 9a1e7f5..150cd39 100644 --- a/net/rxrpc/krxsecd.c +++ b/net/rxrpc/krxsecd.c @@ -19,6 +19,7 @@ #include linux/completion.h #include linux/spinlock.h #include linux/init.h +#include linux/kthread.h #include rxrpc/krxsecd.h #include rxrpc/transport.h #include rxrpc/connection.h @@ -56,8 +57,6 @@ static int rxrpc_krxsecd(void *arg) printk(Started krxsecd %d\n, current-pid); - daemonize(krxsecd); - /* loop around waiting for work to do */ do { /* wait for work or to be told to exit */ @@ -70,8 +69,7 @@ static int rxrpc_krxsecd(void *arg) for (;;) { set_current_state(TASK_INTERRUPTIBLE); if (atomic_read(rxrpc_krxsecd_qcount) || - rxrpc_krxsecd_die || - signal_pending(current)) + rxrpc_krxsecd_die) break; schedule(); @@ -110,9 +108,6 @@ static int rxrpc_krxsecd(void *arg) try_to_freeze(); - /* discard pending signals */ - rxrpc_discard_my_signals(); - } while (!die); /* and that's all */ @@ -126,7 +121,12 @@ static int rxrpc_krxsecd(void *arg) */ int __init rxrpc_krxsecd_init(void) { - return kernel_thread(rxrpc_krxsecd, NULL, 0); + struct task_struct *task; + int ret = 0; + task = kthread_run(rxrpc_krxsecd, NULL, krxsecd); + if (IS_ERR(task)) + ret = PTR_ERR(task); + return ret; } /* end rxrpc_krxsecd_init() */ diff --git a/net/rxrpc/krxtimod.c b/net/rxrpc/krxtimod.c index 9a9b613..3b5f062 100644 --- a/net/rxrpc/krxtimod.c +++ b/net/rxrpc/krxtimod.c @@ -14,6 +14,7 @@ #include linux/sched.h #include
[PATCH] fs/afs: Convert to kthread API.
From: Eric W. Biederman [EMAIL PROTECTED] This patch modifies the startup of kafscmd, kafsasyncd, and kafstimod to use kthread_run instead of a combination of kernel_thread and daemonize making the code slightly simpler and more maintainable. In addition since by default all signals are ignored when delivered to a kernel thread the code to flush signals has been removed. Cc: David Howells [EMAIL PROTECTED] Signed-off-by: Eric W. Biederman [EMAIL PROTECTED] --- fs/afs/cmservice.c | 10 +- fs/afs/internal.h | 11 --- fs/afs/kafsasyncd.c | 17 ++--- fs/afs/kafstimod.c | 16 ++-- 4 files changed, 17 insertions(+), 37 deletions(-) diff --git a/fs/afs/cmservice.c b/fs/afs/cmservice.c index 3d097fd..f7e2355 100644 --- a/fs/afs/cmservice.c +++ b/fs/afs/cmservice.c @@ -13,6 +13,7 @@ #include linux/init.h #include linux/sched.h #include linux/completion.h +#include linux/kthread.h #include server.h #include cell.h #include transport.h @@ -120,8 +121,6 @@ static int kafscmd(void *arg) printk(KERN_INFO kAFS: Started kafscmd %d\n, current-pid); - daemonize(kafscmd); - complete(kafscmd_alive); /* loop around looking for things to attend to */ @@ -133,7 +132,6 @@ static int kafscmd(void *arg) for (;;) { set_current_state(TASK_INTERRUPTIBLE); if (!list_empty(kafscmd_attention_list) || - signal_pending(current) || kafscmd_die) break; @@ -297,8 +295,10 @@ int afscm_start(void) down_write(afscm_sem); if (!afscm_usage) { - ret = kernel_thread(kafscmd, NULL, 0); - if (ret 0) + struct task_struct *task; + task = kthread_run(kafscmd, NULL, kafscmd); + ret = PTR_ERR(task); + if (IS_ERR(task)) goto out; wait_for_completion(kafscmd_alive); diff --git a/fs/afs/internal.h b/fs/afs/internal.h index 5151d5d..2d667b7 100644 --- a/fs/afs/internal.h +++ b/fs/afs/internal.h @@ -40,17 +40,6 @@ #define _net(FMT, a...)do { } while(0) #endif -static inline void afs_discard_my_signals(void) -{ - while (signal_pending(current)) { - siginfo_t sinfo; - - spin_lock_irq(current-sighand-siglock); - dequeue_signal(current,current-blocked, sinfo); - spin_unlock_irq(current-sighand-siglock); - } -} - /* * cell.c */ diff --git a/fs/afs/kafsasyncd.c b/fs/afs/kafsasyncd.c index 615df24..ead025f 100644 --- a/fs/afs/kafsasyncd.c +++ b/fs/afs/kafsasyncd.c @@ -21,6 +21,7 @@ #include linux/sched.h #include linux/completion.h #include linux/freezer.h +#include linux/kthread.h #include cell.h #include server.h #include volume.h @@ -56,15 +57,15 @@ static void kafsasyncd_null_call_error_func(struct rxrpc_call *call) */ int afs_kafsasyncd_start(void) { - int ret; + struct task_struct *task; - ret = kernel_thread(kafsasyncd, NULL, 0); - if (ret 0) - return ret; + task = kthread_run(kafsasyncd, NULL, kafsasyncd); + if (IS_ERR(task)) + return PTR_ERR(task); wait_for_completion(kafsasyncd_alive); - return ret; + return 0; } /* end afs_kafsasyncd_start() */ /*/ @@ -95,8 +96,6 @@ static int kafsasyncd(void *arg) printk(kAFS: Started kafsasyncd %d\n, current-pid); - daemonize(kafsasyncd); - complete(kafsasyncd_alive); /* loop around looking for things to attend to */ @@ -106,7 +105,6 @@ static int kafsasyncd(void *arg) for (;;) { if (!list_empty(kafsasyncd_async_attnq) || - signal_pending(current) || kafsasyncd_die) break; @@ -119,9 +117,6 @@ static int kafsasyncd(void *arg) try_to_freeze(); - /* discard pending signals */ - afs_discard_my_signals(); - die = kafsasyncd_die; /* deal with the next asynchronous operation requiring diff --git a/fs/afs/kafstimod.c b/fs/afs/kafstimod.c index 694344e..caeac88 100644 --- a/fs/afs/kafstimod.c +++ b/fs/afs/kafstimod.c @@ -14,6 +14,7 @@ #include linux/sched.h #include linux/completion.h #include linux/freezer.h +#include linux/kthread.h #include cell.h #include volume.h #include kafstimod.h @@ -36,15 +37,15 @@ static int kafstimod(void *arg); */ int afs_kafstimod_start(void) { - int ret; + struct task_struct *task; - ret = kernel_thread(kafstimod, NULL, 0); - if (ret 0) - return ret; + task = kthread_run(kafstimod, NULL,
[PATCH] bluetooth cmtp: Convert to use kthread API.
From: Eric W. Biederman [EMAIL PROTECTED] This patch modifies the kcmptd_ctr_%d daemon using kthread_run instead of a combination of kernel_thread and daemonize making the code a little simpler and more maintainable. Cc: Marcel Holtmann [EMAIL PROTECTED] Signed-off-by: Eric W. Biederman [EMAIL PROTECTED] --- net/bluetooth/cmtp/core.c |8 +--- 1 files changed, 5 insertions(+), 3 deletions(-) diff --git a/net/bluetooth/cmtp/core.c b/net/bluetooth/cmtp/core.c index e1b9db9..993303f 100644 --- a/net/bluetooth/cmtp/core.c +++ b/net/bluetooth/cmtp/core.c @@ -35,6 +35,7 @@ #include linux/file.h #include linux/init.h #include linux/freezer.h +#include linux/kthread.h #include net/sock.h #include linux/isdn/capilli.h @@ -286,7 +287,6 @@ static int cmtp_session(void *arg) BT_DBG(session %p, session); - daemonize(kcmtpd_ctr_%d, session-num); set_user_nice(current, -15); init_waitqueue_entry(wait, current); @@ -329,6 +329,7 @@ static int cmtp_session(void *arg) int cmtp_add_connection(struct cmtp_connadd_req *req, struct socket *sock) { struct cmtp_session *session, *s; + struct task_struct *task; bdaddr_t src, dst; int i, err; @@ -375,8 +376,9 @@ int cmtp_add_connection(struct cmtp_connadd_req *req, struct socket *sock) __cmtp_link_session(session); - err = kernel_thread(cmtp_session, session, CLONE_KERNEL); - if (err 0) + task = kthread_run(cmtp_session, session, kcmtpd_ctr_%d, session-num); + err = PTR_ERR(task); + if (IS_ERR(task)) goto unlink; if (!(session-flags (1 CMTP_LOOPBACK))) { -- 1.5.0.g53756 - To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] macintosh/mediabay: Convert to kthread API.
From: Eric W. Biederman [EMAIL PROTECTED] This patch modifies the startup of the media_bay_task to use kthread_run and not a combination of kernel_thread, deamonize and sigfillset. In addition since we now always want to ignore signals the MB_IGNORE_SIGNALS define is removed along with the test for signal_pending. The result is slightly simpler code that is more maintainable. Cc: Benjamin Herrenschmidt [EMAIL PROTECTED] Cc: Paul Mackerras [EMAIL PROTECTED] Signed-off-by: Eric W. Biederman [EMAIL PROTECTED] --- drivers/macintosh/mediabay.c | 11 ++- 1 files changed, 2 insertions(+), 9 deletions(-) diff --git a/drivers/macintosh/mediabay.c b/drivers/macintosh/mediabay.c index c803d2b..90c853e 100644 --- a/drivers/macintosh/mediabay.c +++ b/drivers/macintosh/mediabay.c @@ -20,6 +20,7 @@ #include linux/stddef.h #include linux/init.h #include linux/ide.h +#include linux/kthread.h #include asm/prom.h #include asm/pgtable.h #include asm/io.h @@ -35,7 +36,6 @@ #define MB_DEBUG -#define MB_IGNORE_SIGNALS #ifdef MB_DEBUG #define MBDBG(fmt, arg...) printk(KERN_INFO fmt , ## arg) @@ -622,11 +622,6 @@ static int media_bay_task(void *x) { int i; - strcpy(current-comm, media-bay); -#ifdef MB_IGNORE_SIGNALS - sigfillset(current-blocked); -#endif - for (;;) { for (i = 0; i media_bay_count; ++i) { down(media_bays[i].lock); @@ -636,8 +631,6 @@ static int media_bay_task(void *x) } msleep_interruptible(MB_POLL_DELAY); - if (signal_pending(current)) - return 0; } } @@ -699,7 +692,7 @@ static int __devinit media_bay_attach(struct macio_dev *mdev, const struct of_de /* Startup kernel thread */ if (i == 0) - kernel_thread(media_bay_task, NULL, CLONE_KERNEL); + kthread_run(media_bay_task, NULL, media-bay); return 0; -- 1.5.0.g53756 - To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] powerpc pseries rtasd: Convert to kthread API.
From: Eric W. Biederman [EMAIL PROTECTED] This patch modifies the startup of rtasd to use kthread_run instaed of a combination of kernel_thread and daemonize. Making the code a little simpler and more maintainble. Cc: Paul Mackerras [EMAIL PROTECTED] Signed-off-by: Eric W. Biederman [EMAIL PROTECTED] --- arch/powerpc/platforms/pseries/rtasd.c |5 ++--- 1 files changed, 2 insertions(+), 3 deletions(-) diff --git a/arch/powerpc/platforms/pseries/rtasd.c b/arch/powerpc/platforms/pseries/rtasd.c index 77d0937..919a374 100644 --- a/arch/powerpc/platforms/pseries/rtasd.c +++ b/arch/powerpc/platforms/pseries/rtasd.c @@ -20,6 +20,7 @@ #include linux/spinlock.h #include linux/cpu.h #include linux/delay.h +#include linux/kthread.h #include asm/uaccess.h #include asm/io.h @@ -429,8 +430,6 @@ static int rtasd(void *unused) int event_scan = rtas_token(event-scan); int rc; - daemonize(rtasd); - if (event_scan == RTAS_UNKNOWN_SERVICE || get_eventscan_parms() == -1) goto error; @@ -497,7 +496,7 @@ static int __init rtas_init(void) else printk(KERN_ERR Failed to create error_log proc entry\n); - if (kernel_thread(rtasd, NULL, CLONE_FS) 0) + if (IS_ERR(kthread_run(rtasd, NULL, rtasd))) printk(KERN_ERR Failed to start RTAS daemon\n); return 0; -- 1.5.0.g53756 - To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] bluetooth bnep: Convert to kthread API.
From: Eric W. Biederman [EMAIL PROTECTED] This patch starts kbenpd using kthread_run replacing a combination of kernel_thread and daemonize. Making the code a little simpler and more maintainable. Cc: Marcel Holtmann [EMAIL PROTECTED] Signed-off-by: Eric W. Biederman [EMAIL PROTECTED] --- net/bluetooth/bnep/core.c |8 +--- 1 files changed, 5 insertions(+), 3 deletions(-) diff --git a/net/bluetooth/bnep/core.c b/net/bluetooth/bnep/core.c index a9f1e88..de3caed 100644 --- a/net/bluetooth/bnep/core.c +++ b/net/bluetooth/bnep/core.c @@ -32,6 +32,7 @@ #include linux/module.h #include linux/kernel.h +#include linux/kthread.h #include linux/sched.h #include linux/signal.h #include linux/init.h @@ -473,7 +474,6 @@ static int bnep_session(void *arg) BT_DBG(); - daemonize(kbnepd %s, dev-name); set_user_nice(current, -15); init_waitqueue_entry(wait, current); @@ -539,6 +539,7 @@ static struct device *bnep_get_device(struct bnep_session *session) int bnep_add_connection(struct bnep_connadd_req *req, struct socket *sock) { + struct task_struct *task; struct net_device *dev; struct bnep_session *s, *ss; u8 dst[ETH_ALEN], src[ETH_ALEN]; @@ -598,9 +599,10 @@ int bnep_add_connection(struct bnep_connadd_req *req, struct socket *sock) __bnep_link_session(s); - err = kernel_thread(bnep_session, s, CLONE_KERNEL); - if (err 0) { + task = kthread_run(bnep_session, s, kbnepd %s, dev-name); + if (IS_ERR(task)) { /* Session thread start failed, gotta cleanup. */ + err = PTR_ERR(task); unregister_netdev(dev); __bnep_unlink_session(s); goto failed; -- 1.5.0.g53756 - To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] arm ecard: Conver to use the kthread API.
From: Eric W. Biederman [EMAIL PROTECTED] This patch modifies the startup of kecardd to use kthread_run not a kernel_thread combination of kernel_thread and daemonize. Making the code slightly simpler and more maintainable. Cc: Russell King [EMAIL PROTECTED] Signed-off-by: Eric W. Biederman [EMAIL PROTECTED] --- arch/arm/kernel/ecard.c | 14 +++--- 1 files changed, 7 insertions(+), 7 deletions(-) diff --git a/arch/arm/kernel/ecard.c b/arch/arm/kernel/ecard.c index f1c0fb9..6c15f5f 100644 --- a/arch/arm/kernel/ecard.c +++ b/arch/arm/kernel/ecard.c @@ -40,6 +40,7 @@ #include linux/device.h #include linux/init.h #include linux/mutex.h +#include linux/kthread.h #include asm/dma.h #include asm/ecard.h @@ -263,8 +264,6 @@ static int ecard_init_mm(void) static int ecard_task(void * unused) { - daemonize(kecardd); - /* * Allocate a mm. We're not a lazy-TLB kernel task since we need * to set page table entries where the user space would be. Note @@ -1058,13 +1057,14 @@ ecard_probe(int slot, card_type_t type) */ static int __init ecard_init(void) { - int slot, irqhw, ret; + struct task_struct *task; + int slot, irqhw; - ret = kernel_thread(ecard_task, NULL, CLONE_KERNEL); - if (ret 0) { + task = kthread_run(ecard_task, NULL, kecardd); + if (IS_ERR(task)) { printk(KERN_ERR Ecard: unable to create kernel thread: %d\n, - ret); - return ret; + PTR_ERR(task)); + return PTR_ERR(task); } printk(Probing expansion cards\n); -- 1.5.0.g53756 - To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] macintosh/therm_windtunnel.c: Convert to kthread API.
From: Eric W. Biederman [EMAIL PROTECTED] Start the g4fand using kthread_run not a combination of kernel_thread and deamonize. This makes the code a little simpler and more maintainable. Cc: Benjamin Herrenschmidt [EMAIL PROTECTED] Signed-off-by: Eric W. Biederman [EMAIL PROTECTED] --- drivers/macintosh/therm_windtunnel.c |5 ++--- 1 files changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/macintosh/therm_windtunnel.c b/drivers/macintosh/therm_windtunnel.c index a1d3a98..5d888e7 100644 --- a/drivers/macintosh/therm_windtunnel.c +++ b/drivers/macintosh/therm_windtunnel.c @@ -36,6 +36,7 @@ #include linux/i2c.h #include linux/slab.h #include linux/init.h +#include linux/kthread.h #include asm/prom.h #include asm/machdep.h @@ -62,7 +63,6 @@ I2C_CLIENT_INSMOD; static struct { volatile intrunning; struct completion completion; - pid_t poll_task; struct semaphorelock; struct of_device*of_dev; @@ -285,7 +285,6 @@ restore_regs( void ) static int control_loop( void *dummy ) { - daemonize(g4fand); down( x.lock ); setup_hardware(); @@ -323,7 +322,7 @@ do_attach( struct i2c_adapter *adapter ) if( x.thermostat x.fan ) { x.running = 1; init_completion( x.completion ); - x.poll_task = kernel_thread( control_loop, NULL, SIGCHLD | CLONE_KERNEL ); + kthread_run( control_loop, NULL, g4fand); } } return ret; -- 1.5.0.g53756 - To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] smbfs: Remove unnecessary allow_signal
From: Eric W. Biederman [EMAIL PROTECTED] Signed-off-by: Eric W. Biederman [EMAIL PROTECTED] --- fs/smbfs/smbiod.c |2 -- 1 files changed, 0 insertions(+), 2 deletions(-) diff --git a/fs/smbfs/smbiod.c b/fs/smbfs/smbiod.c index 3e61b44..67176af 100644 --- a/fs/smbfs/smbiod.c +++ b/fs/smbfs/smbiod.c @@ -298,8 +298,6 @@ out: */ static int smbiod(void *unused) { - allow_signal(SIGKILL); - VERBOSE(SMB Kernel thread starting (%d) ...\n, current-pid); for (;;) { -- 1.5.0.g53756 - To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/