public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Frederic Weisbecker <fweisbec@gmail.com>
To: Alasdair G Kergon <agk@redhat.com>, Ingo Molnar <mingo@elte.hu>,
	linux-kernel@vger.kernel.org,
	Andrew Morton <akpm@linux-foundation.org>,
	Lai Jiangshan <laijs@cn.fujitsu.com>,
	Peter Zijlstra <a.p.zijlstra@chello.nl>,
	Steven Rostedt <rostedt@goodmis.org>
Subject: Re: [RFC][PATCH] create workqueue threads only when needed
Date: Tue, 27 Jan 2009 09:57:39 +0100	[thread overview]
Message-ID: <20090127085738.GB5498@nowhere> (raw)
In-Reply-To: <20090127030727.GA15101@agk.fab.redhat.com>

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.


  reply	other threads:[~2009-01-27  8:57 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-01-27  0:17 [RFC][PATCH] create workqueue threads only when needed Frederic Weisbecker
2009-01-27  0:30 ` Arjan van de Ven
2009-01-31 18:03   ` Frederic Weisbecker
2009-01-31 18:15     ` Arjan van de Ven
2009-01-31 18:28       ` Frederic Weisbecker
2009-02-01 16:22         ` Stefan Richter
2009-02-01 17:04           ` Arjan van de Ven
2009-02-01 17:40             ` Stefan Richter
2009-02-01 17:47               ` Arjan van de Ven
2009-02-01 18:06                 ` Stefan Richter
2009-02-01 18:11                   ` Arjan van de Ven
2009-02-01 21:37         ` Benjamin Herrenschmidt
2009-02-02  2:24           ` Frederic Weisbecker
2009-02-02  6:00             ` Benjamin Herrenschmidt
2009-02-02  8:42               ` Stefan Richter
2009-02-02  9:05                 ` Benjamin Herrenschmidt
2009-02-02  9:14                   ` Oliver Neukum
2009-02-02  9:46                     ` Benjamin Herrenschmidt
2009-02-02  9:58                       ` Peter Zijlstra
2009-02-02 10:03                       ` Oliver Neukum
2009-02-02 20:44                         ` Benjamin Herrenschmidt
2009-02-04  9:54                           ` Oliver Neukum
2009-02-02 11:39                     ` Stefan Richter
2009-02-02 11:32                 ` Frederic Weisbecker
2009-02-02 11:26               ` Frederic Weisbecker
2009-02-02  5:19           ` Arjan van de Ven
2009-02-02  6:01             ` Benjamin Herrenschmidt
2009-02-02  9:01             ` Stefan Richter
2009-02-02 14:45               ` Arjan van de Ven
     [not found] ` <20090126162807.1131c777.akpm@linux-foundation.org>
2009-01-27  1:46   ` Oleg Nesterov
2009-01-27  8:40     ` Frederic Weisbecker
2009-01-27  3:07 ` Alasdair G Kergon
2009-01-27  8:57   ` Frederic Weisbecker [this message]
2009-01-27 12:43     ` Ingo Molnar
2009-02-02 14:49 ` Daniel Walker
2009-02-02 14:51   ` Frédéric Weisbecker
2009-02-02 15:40     ` Daniel Walker

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20090127085738.GB5498@nowhere \
    --to=fweisbec@gmail.com \
    --cc=a.p.zijlstra@chello.nl \
    --cc=agk@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=laijs@cn.fujitsu.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=rostedt@goodmis.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox