lkml.org 
[lkml]   [2009]   [Jan]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: [RFC][PATCH] create workqueue threads only when needed
    On Tue, Jan 27, 2009 at 03:07:27AM +0000, Alasdair G Kergon wrote:
    > On Tue, Jan 27, 2009 at 01:17:11AM +0100, Frederic Weisbecker wrote:
    > > For several reasons:
    > > _ Unneeded built drivers for my system that create workqueue(s) when they init
    > > _ Services which need their own workqueue, for several reasons, but who receive
    > > very rare jobs (often never)
    >
    > > I hadn't any problems until now with this patch but I think it needs more testing,
    > > like with cpu hotplug, and some renaming for its functions and structures...
    > > And I would like to receive some comments and feelings before continuing. So this
    > > is just an RFC :-)
    >
    > Make sure this optimisation also works when the system's running low on memory
    > if workqueues are involved in "making forward progress". Doubtless there
    > are other reasons for apparently-unused workqueues too.


    That's true. But currently, each useless workqueue thread is consuming a
    task_struct in memory, so this patch makes actually consuming less memory than
    before.
    If the system is running low on memory...well perhaps I can reschedule the thread
    creation after some delays...?


    > How about reviewing each particular workqueue that you've identified to see if
    > it can be created later or even not at all, or destroyed while it's not being
    > used, or if some workqueues can be shared - rather than presuming that a change
    > like this would be safe globally?
    >
    > Alasdair
    > --
    > agk@redhat.com


    I did it with kpsmoused but there are so much workqueues:

    $ git-grep create_singlethread_workqueue | wc -l
    122

    And lot of them are related to particular drivers for hardware I don't have.
    So it wouldn't be easy for me to test and fix them.

    And note that this patch only solves a part of the problem. It breaks the useless
    threads creation, not the useless workqueue creation. So there is still some useless
    memory used, and this problem can only be solved one by one.



    \
     
     \ /
      Last update: 2009-01-27 10:01    [W:6.875 / U:0.016 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site