kernelnewbies.kernelnewbies.org archive mirror
 help / color / mirror / Atom feed
* should drivers avoid the use of in_atomic()?
@ 2011-05-15 19:22 Robert P. J. Day
  2011-05-15 19:41 ` Greg KH
  0 siblings, 1 reply; 2+ messages in thread
From: Robert P. J. Day @ 2011-05-15 19:22 UTC (permalink / raw)
  To: kernelnewbies


  perusing some timer-related kernel stuff and i ran across this in
include/linux/hardirq.h:

/*
 * Are we running in atomic context?  WARNING: this macro cannot
 * always detect atomic context; in particular, it cannot know about
 * held spinlocks in non-preemptible kernels.  Thus it should not be
 * used in the general case to determine whether sleeping is possible.
 * Do not use in_atomic() in driver code.
 */
#define in_atomic()     ((preempt_count() & ~PREEMPT_ACTIVE) != PREEMPT_INATOMIC_BASE)

  but a quick check shows a sprinkling of in_atomic() checks in the
drivers/ directory.  is that admonition overly strict?  or what?

rday

-- 

========================================================================
Robert P. J. Day                                 Ottawa, Ontario, CANADA
                        http://crashcourse.ca

Twitter:                                       http://twitter.com/rpjday
LinkedIn:                               http://ca.linkedin.com/in/rpjday
========================================================================

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

end of thread, other threads:[~2011-05-15 19:41 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-05-15 19:22 should drivers avoid the use of in_atomic()? Robert P. J. Day
2011-05-15 19:41 ` Greg KH

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).