public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* Re: [PATCH] Add kerneldoc for flush_scheduled_work()
@ 2009-08-13 12:06 Randy Dunlap
  2009-08-13 14:51 ` Johannes Weiner
  0 siblings, 1 reply; 41+ messages in thread
From: Randy Dunlap @ 2009-08-13 12:06 UTC (permalink / raw)
  To: hannes; +Cc: stern, James.Bottomley, akpm, apw, mingo, linux-kernel, peterz

From: hannes@cmpxchg.org

On Thu, Aug 13, 2009 at 09:25:14AM +0200, Ingo Molnar wrote:
> 
> * James Bottomley <James.Bottomley@HansenPartnership.com> wrote:
> 
> > On Wed, 2009-08-12 at 10:13 -0400, Alan Stern wrote:
> > > On Wed, 12 Aug 2009, Ingo Molnar wrote:
> > > 
> > > > > And here I was thinking kerneldoc doesn't actually work 
> > > > > like that, but perhaps Randy fixed it so the initial 
> > > > > description can line-wrap?
> > > 
> > > Yes, that's what I thought too.  If kerneldoc has been fixed 
> > > then the description line certainly should get wrapped.
> > 
> > I really don't think it needs to be fixed: it's a feature not a 
> > bug.  It requires people writing kernel doc actually to think of 
> > one line summaries.
> 
> As long as the argument is that it's good to have limitations just 
> because it has good effects as well (which the gist of your argument 
> seems to be), i disagree.
> 
> That's a very basic argument of freedom. Just consider the Gestapo 
> which was also a 'feature' to keep criminals in check. Did you know 
> that there were record low levels of petty criminality both in nazi 
> Germany and during communism (and under just about any totalitarian 
> regime)? Still nobody in their right mind is arguing that just due 
> to that they are the right social model ...

| Although I really like how you Godwin'd kerneldoc comments ;-), we do
| have other features that are features because of their limiting effect
| all over the place, don't we?  The 80-columns code rule e.g. or our
| limited set of allowed indenting characters.

> I think this DocBook limitation needs to be fixed, because there are 
> legitimate cases where a function name got too long (for no fault of 
> its own, but for properties of the name-space it is operating in), 
> and we do not want a nanny state beat it into a single line.

| Agreed, just as in the other rules, one should be able to bend this
| one once in a while without technical consequences, i.e. without
| kerneldoc breaking.


Any of you, please feel free to send patches.  Thanks.

~Randy

^ permalink raw reply	[flat|nested] 41+ messages in thread
* Re: [PATCH] Add kerneldoc for flush_scheduled_work()
@ 2009-08-12 18:14 Randy Dunlap
  0 siblings, 0 replies; 41+ messages in thread
From: Randy Dunlap @ 2009-08-12 18:14 UTC (permalink / raw)
  To: peterz; +Cc: stern, James.Bottomley, akpm, mingo, linux-kernel

From: peterz@infradead.org

On Wed, 2009-08-12 at 11:41 +0200, Ingo Molnar wrote:
> * Alan Stern <stern@rowland.harvard.edu> wrote:
> 
> > This patch (as1279) adds kerneldoc for flush_scheduled_work()
> > containing a stern warning that the function should be avoided.
> > 
> > Signed-off-by: Alan Stern <stern@rowland.harvard.edu>

> >  
> > +/**
> > + * flush_scheduled_work - ensure that all work scheduled on keventd_wq has run to completion.

> > + */
> 
> Looks good - a small nit: please use proper/consistent line length, 
> something like:
> 
> /**
>  * flush_scheduled_work - ensure that all work scheduled on 
>  *			  keventd_wq has run to completion
>  *

>  */


| And here I was thinking kerneldoc doesn't actually work like that, but
| perhaps Randy fixed it so the initial description can line-wrap?

Nope, function short description is still just a one-liner.

~Randy

^ permalink raw reply	[flat|nested] 41+ messages in thread
* [PATCH] Add kerneldoc for flush_scheduled_work()
@ 2009-08-11 21:06 Alan Stern
  2009-08-12  9:41 ` Ingo Molnar
  2009-08-12 14:01 ` James Bottomley
  0 siblings, 2 replies; 41+ messages in thread
From: Alan Stern @ 2009-08-11 21:06 UTC (permalink / raw)
  To: Andrew Morton; +Cc: James Bottomley, Kernel development list

This patch (as1279) adds kerneldoc for flush_scheduled_work()
containing a stern warning that the function should be avoided.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>

---

Index: usb-2.6/kernel/workqueue.c
===================================================================
--- usb-2.6.orig/kernel/workqueue.c
+++ usb-2.6/kernel/workqueue.c
@@ -739,6 +739,24 @@ int schedule_on_each_cpu(work_func_t fun
 	return 0;
 }
 
+/**
+ * flush_scheduled_work - ensure that all work scheduled on keventd_wq has run to completion.
+ *
+ * Blocks until all works on the keventd_wq global workqueue have completed.
+ * We sleep until all works present upon entry have been handled, but we
+ * are not livelocked by new incoming ones.
+ *
+ * Use of this function is discouraged, as it is highly prone to deadlock.
+ * It should never be called from within a work routine on the global
+ * queue, and it should never be called while holding a mutex required
+ * by one of the works on the global queue.  But the fact that keventd_wq
+ * _is_ global means that it can contain works requiring practically any
+ * mutex.  Hence this routine shouldn't be called while holding any mutex.
+ *
+ * Consider using cancel_work_sync() or cancel_delayed_work_sync() instead.
+ * They don't do the same thing (they cancel the work instead of waiting
+ * for it to complete), but in most cases they will suffice.
+ */
 void flush_scheduled_work(void)
 {
 	flush_workqueue(keventd_wq);


^ permalink raw reply	[flat|nested] 41+ messages in thread

end of thread, other threads:[~2009-08-24 21:08 UTC | newest]

Thread overview: 41+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-08-13 12:06 [PATCH] Add kerneldoc for flush_scheduled_work() Randy Dunlap
2009-08-13 14:51 ` Johannes Weiner
2009-08-13 15:04   ` James Bottomley
2009-08-13 16:20     ` Randy Dunlap
2009-08-13 18:08       ` Johannes Weiner
2009-08-14 18:23         ` Randy Dunlap
2009-08-16 19:13           ` [PATCH] scsi: fix func names in kernel-doc Randy Dunlap
2009-08-18  9:04           ` [PATCH] Add kerneldoc for flush_scheduled_work() Johannes Weiner
2009-08-19 22:23             ` Johannes Weiner
2009-08-19 23:21               ` Randy Dunlap
2009-08-19 23:27                 ` Randy Dunlap
2009-08-24 19:06                 ` Johannes Weiner
2009-08-24 19:27                   ` Randy Dunlap
2009-08-24 20:09                     ` Johannes Weiner
2009-08-24 20:25                       ` Randy Dunlap
  -- strict thread matches above, loose matches on Subject: below --
2009-08-12 18:14 Randy Dunlap
2009-08-11 21:06 Alan Stern
2009-08-12  9:41 ` Ingo Molnar
2009-08-12 10:47   ` Peter Zijlstra
2009-08-12 10:51     ` Ingo Molnar
2009-08-12 14:13       ` Alan Stern
2009-08-12 14:17         ` Ingo Molnar
2009-08-12 16:22         ` James Bottomley
2009-08-13  7:25           ` Ingo Molnar
2009-08-13  8:47             ` Johannes Weiner
2009-08-13 10:03               ` Ingo Molnar
2009-08-13 14:37             ` James Bottomley
2009-08-12 14:01 ` James Bottomley
2009-08-12 14:54   ` Alan Stern
2009-08-12 15:00     ` James Bottomley
2009-08-12 15:44       ` Alan Stern
2009-08-12 15:58         ` James Bottomley
2009-08-12 16:23           ` Alan Stern
2009-08-12 17:02             ` James Bottomley
2009-08-12 17:25               ` Alan Stern
2009-08-12 17:36                 ` James Bottomley
2009-08-12 18:16                   ` Alan Stern
2009-08-12 18:27                     ` James Bottomley
2009-08-12 18:48                       ` Alan Stern
2009-08-12 20:28                         ` James Bottomley
2009-08-12 20:41                           ` Alan Stern

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox