All of lore.kernel.org
 help / color / mirror / Atom feed
* [KJ] why so many more "down()" than "down_interruptible()" calls?
@ 2007-02-17 13:00 Robert P. J. Day
  2007-02-17 13:58 ` [KJ] why so many more "down()" than "down_interruptible()" Arnd Bergmann
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Robert P. J. Day @ 2007-02-17 13:00 UTC (permalink / raw)
  To: kernel-janitors


  reading robert love's kernel book, he writes that, when going to
sleep on a semaphore, it's more likely you'll want to use
down_interruptible() rather than just down() and, because of this,
"use of down_interruptible() is much more common than down()".

  that's not what i see.  just counting the calls under drivers/, it
looks like there's about four times as many calls of down() as
down_interruptible().  is there some reason that the actual stats
differ so markedly from the claim in love's book?  just curious.

rday

-- 
====================================
Robert P. J. Day
Linux Consulting, Training and Annoying Kernel Pedantry
Waterloo, Ontario, CANADA

http://fsdev.net/wiki/index.php?title=Main_Page
====================================
_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.osdl.org
https://lists.osdl.org/mailman/listinfo/kernel-janitors

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

* Re: [KJ] why so many more "down()" than "down_interruptible()"
  2007-02-17 13:00 [KJ] why so many more "down()" than "down_interruptible()" calls? Robert P. J. Day
@ 2007-02-17 13:58 ` Arnd Bergmann
  2007-02-17 14:03 ` Robert P. J. Day
  2007-02-17 15:56 ` Ahmed S. Darwish
  2 siblings, 0 replies; 4+ messages in thread
From: Arnd Bergmann @ 2007-02-17 13:58 UTC (permalink / raw)
  To: kernel-janitors

On Saturday 17 February 2007 14:00, Robert P. J. Day wrote:
>   that's not what i see.  just counting the calls under drivers/, it
> looks like there's about four times as many calls of down() as
> down_interruptible().  is there some reason that the actual stats
> differ so markedly from the claim in love's book?  just curious.

Using down_interruptible is hard: You need to be in a place where
you can return -EINTR (or -ERESTART*) to user space, and you need
to undo everything that your function did before the down_interruptible
failed.

	Arnd <><

_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.osdl.org
https://lists.osdl.org/mailman/listinfo/kernel-janitors

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

* Re: [KJ] why so many more "down()" than "down_interruptible()"
  2007-02-17 13:00 [KJ] why so many more "down()" than "down_interruptible()" calls? Robert P. J. Day
  2007-02-17 13:58 ` [KJ] why so many more "down()" than "down_interruptible()" Arnd Bergmann
@ 2007-02-17 14:03 ` Robert P. J. Day
  2007-02-17 15:56 ` Ahmed S. Darwish
  2 siblings, 0 replies; 4+ messages in thread
From: Robert P. J. Day @ 2007-02-17 14:03 UTC (permalink / raw)
  To: kernel-janitors

[-- Attachment #1: Type: TEXT/PLAIN, Size: 1080 bytes --]

On Sat, 17 Feb 2007, Arnd Bergmann wrote:

> On Saturday 17 February 2007 14:00, Robert P. J. Day wrote:
> >   that's not what i see.  just counting the calls under drivers/,
> > it looks like there's about four times as many calls of down() as
> > down_interruptible().  is there some reason that the actual stats
> > differ so markedly from the claim in love's book?  just curious.
>
> Using down_interruptible is hard: You need to be in a place where
> you can return -EINTR (or -ERESTART*) to user space, and you need to
> undo everything that your function did before the down_interruptible
> failed.

oh, i believe your logic.  so it's odd that both love's kernel book
and LDD3 seem adamant that the *interruptible* version is the
preferred one.

rday
-- 
========================================================================
Robert P. J. Day
Linux Consulting, Training and Annoying Kernel Pedantry
Waterloo, Ontario, CANADA

http://fsdev.net/wiki/index.php?title=Main_Page
========================================================================

[-- Attachment #2: Type: text/plain, Size: 168 bytes --]

_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.osdl.org
https://lists.osdl.org/mailman/listinfo/kernel-janitors

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

* Re: [KJ] why so many more "down()" than "down_interruptible()"
  2007-02-17 13:00 [KJ] why so many more "down()" than "down_interruptible()" calls? Robert P. J. Day
  2007-02-17 13:58 ` [KJ] why so many more "down()" than "down_interruptible()" Arnd Bergmann
  2007-02-17 14:03 ` Robert P. J. Day
@ 2007-02-17 15:56 ` Ahmed S. Darwish
  2 siblings, 0 replies; 4+ messages in thread
From: Ahmed S. Darwish @ 2007-02-17 15:56 UTC (permalink / raw)
  To: kernel-janitors

On Sat, Feb 17, 2007 at 09:03:59AM -0500, Robert P. J. Day wrote:
> On Sat, 17 Feb 2007, Arnd Bergmann wrote:
> 
> > On Saturday 17 February 2007 14:00, Robert P. J. Day wrote:
> > >   that's not what i see.  just counting the calls under drivers/,
> > > it looks like there's about four times as many calls of down() as
> > > down_interruptible().  is there some reason that the actual stats
> > > differ so markedly from the claim in love's book?  just curious.
> >
> > Using down_interruptible is hard: You need to be in a place where
> > you can return -EINTR (or -ERESTART*) to user space, and you need to
> > undo everything that your function did before the down_interruptible
> > failed.
> 
> oh, i believe your logic.  so it's odd that both love's kernel book
> and LDD3 seem adamant that the *interruptible* version is the
> preferred one.
> 

I think there's no contradiction here. Preffered method is not always the 
easiest one. You don't want your system to hang entirely and lose your work
cause of a weird locking bug.

-- 
Ahmed S. Darwish
http://darwish.07.googlepages.com
_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.osdl.org
https://lists.osdl.org/mailman/listinfo/kernel-janitors

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

end of thread, other threads:[~2007-02-17 15:56 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-02-17 13:00 [KJ] why so many more "down()" than "down_interruptible()" calls? Robert P. J. Day
2007-02-17 13:58 ` [KJ] why so many more "down()" than "down_interruptible()" Arnd Bergmann
2007-02-17 14:03 ` Robert P. J. Day
2007-02-17 15:56 ` Ahmed S. Darwish

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.