RE: [PATCH] speedup flush_workqueue for singlethread_workqueue

From: Anil (anil.s.keshavamurthy_at_intel.com)
Date: 06/07/04

  • Next message: Luiz Fernando N. Capitulino: "Re: [PATCH] 2.6.6 memory allocation checks in drivers/pci/hotplug/shpchprm_acpi.c"
    To: "'Rusty Russell'" <rusty@rustcorp.com.au>, "Andrew Morton" <akpm@osdl.org>
    Date:	Mon, 7 Jun 2004 10:46:50 -0700
    
    

    Hi Andrew,
            In the flush_workqueue, can we move lock_cpu_hotplug()/unlock_cpu_hotplug only for _non_single_threaded_ case as shown below
    as these locks are not required for single_threaded_workqueue.

    Thanks,
    Anil

    The attached patch applies on top of your changes.
    Signed-off-by: Anil Keshavamurthy <anil.s.keshavamurthy@intel.com>

    ---
     linux-2.6.7-rc2-mm2-root/kernel/workqueue.c |    4 ++--
     1 files changed, 2 insertions(+), 2 deletions(-)
    diff -puN kernel/workqueue.c~andrew2 kernel/workqueue.c
    --- linux-2.6.7-rc2-mm2/kernel/workqueue.c~andrew2	2004-06-07 18:45:20.332139681 -0700
    +++ linux-2.6.7-rc2-mm2-root/kernel/workqueue.c	2004-06-07 18:46:09.560680511 -0700
    @@ -262,7 +262,6 @@ static void flush_cpu_workqueue(struct c
     void fastcall flush_workqueue(struct workqueue_struct *wq)
     {
      	might_sleep();
    - 	lock_cpu_hotplug();
     
     	if (is_single_threaded(wq)) {
     		/* Always use cpu 0's area. */
    @@ -270,11 +269,12 @@ void fastcall flush_workqueue(struct wor
     	} else {
     		int cpu;
      
    + 		lock_cpu_hotplug();
     		for_each_online_cpu(cpu)
     			flush_cpu_workqueue(wq->cpu_wq + cpu);
    + 		unlock_cpu_hotplug();
      	}
     
    - 	unlock_cpu_hotplug();
     }
     
     static struct task_struct *create_workqueue_thread(struct workqueue_struct *wq,
    _
     	
    >-----Original Message-----
    >From: Rusty Russell [mailto:rusty@rustcorp.com.au] 
    >Sent: Saturday, June 05, 2004 7:11 PM
    >To: Andrew Morton
    >Cc: Keshavamurthy, Anil S; lkml - Kernel Mailing List
    >Subject: Re: [PATCH] speedup flush_workqueue for singlethread_workqueue
    >
    >On Sat, 2004-06-05 at 08:30, Andrew Morton wrote:
    >> "Anil" <anil.s.keshavamurthy@intel.com> wrote:
    >> >
    >> > 	In the flush_workqueue function for a 
    >single_threaded_worqueue case 
    >> > the code seemed to loop the same cpu_workqueue_struct for 
    >> > each_online_cpu's. The attached patch checks this 
    >condition and bails out of for loop there by speeding up the 
    >flush_workqueue for a singlethreaded_workqueue.
    >> 
    >> 
    >> OK, thanks.  I think it's a bit clearer to do it as below.  
    >I haven't 
    >> tested it though.
    >
    >Me neither, but agree.
    >
    >Rusty.
    >--
    >Anyone who quotes me in their signature is an idiot -- Rusty Russell
    >
    >
    >
    -
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to majordomo@vger.kernel.org
    More majordomo info at  http://vger.kernel.org/majordomo-info.html
    Please read the FAQ at  http://www.tux.org/lkml/
    

  • Next message: Luiz Fernando N. Capitulino: "Re: [PATCH] 2.6.6 memory allocation checks in drivers/pci/hotplug/shpchprm_acpi.c"

    Relevant Pages

    • Re: [PATCH][RFC] swsusp: speed up image restoring on x86-64
      ... Speeding up copy loop that takes ... ... Reason is "to crash it early if we have wrong pagetables". ... > If necessary, I can change the patch to work with his code. ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)
    • Re: [patch 3/2] drivers/char/vt.c: remove unnecessary code
      ... Hey, that makes fully sense! ... a loop, and it remains fully readable. ... such a patch would be: ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)
    • Re: [RFC/PATCH 4/5] loop: execute in place (V2)
      ... I don't think loop on xip is performance critical. ... For page cache lookup ... Given that even without this patch we don't do page ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)
    • Re: [PATCH 1/2] kthread_create
      ... On Sun, 4 Jan 2004, Rusty Russell wrote: ... > which is a parent to all the kthreads (it'll get a SIGCHLD when ... With the patch I posted to you, the kthread_stopwill simply miss the ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)
    • Re: CPU boot problem on 2.6.0-test3-bk8
      ... >> So we only loop for the actual number processors found in mpparse.c? ... I think your patch ... > continue you're missing? ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)