public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Steven Rostedt <rostedt@goodmis.org>
To: Al Viro <viro@parcelfarce.linux.theplanet.co.uk>
Cc: ooyama eiichi <ooyama@tritech.co.jp>,
	cw@f00f.org, LKML <linux-kernel@vger.kernel.org>
Subject: Re: kernel stack size
Date: Sat, 02 Apr 2005 14:52:12 -0500	[thread overview]
Message-ID: <1112471532.27149.19.camel@localhost.localdomain> (raw)
In-Reply-To: <20050402193704.GU8859@parcelfarce.linux.theplanet.co.uk>

On Sat, 2005-04-02 at 20:37 +0100, Al Viro wrote:
> On Sat, Apr 02, 2005 at 02:04:11PM -0500, Steven Rostedt wrote:
> > You can also use globally static variables too. But this makes for
> > non-reentry code.
> > 
> > Sometimes I don't feel that a kmalloc is worth it, and if the function
> > in question for the driver would seldom have problems with reentry, I
> > use a statically defined global, and protect it with spin_locks. If
> > these can also be used in interrupt context, you need to use the
> > spin_lock_irqsave variants.  But don't do this if the critical section
> > has long latencies.
> 
> ... and the first time copy_from_user() blocks under your spinlock
> you will get a nice shiny deadlock.

I forgot that he mentioned that this was for ioctls. I then use
semaphores if I need to access userspace. But if it just needs to modify
data around areas that only the kernel uses, without access to
userspace, than I use spinlocks.

I admit you really need to know what you're doing to use this method. If
I believe that a kmalloc would be too expensive, then I use the locking
of static variables. But each situation is different and I try to use
the best method for the occasion.

-- Steve



  reply	other threads:[~2005-04-02 19:52 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-04-02 17:46 kernel stack size ooyama eiichi
2005-04-02 17:53 ` Chris Wedgwood
2005-04-02 18:15   ` ooyama eiichi
2005-04-02 18:24     ` Chris Wedgwood
2005-04-02 18:48       ` ooyama eiichi
2005-04-02 19:04         ` Steven Rostedt
2005-04-02 19:37           ` Al Viro
2005-04-02 19:52             ` Steven Rostedt [this message]
2005-04-02 18:29     ` Brian Gerst
  -- strict thread matches above, loose matches on Subject: below --
2005-04-02 20:14 Manfred Spraul
2005-04-02 22:15 ` Steven Rostedt
2005-04-03  7:10   ` Manfred Spraul
2005-04-03 18:01     ` Steven Rostedt
2005-04-03 19:23       ` Manfred Spraul
2003-10-09 19:14 Punj, Arun

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=1112471532.27149.19.camel@localhost.localdomain \
    --to=rostedt@goodmis.org \
    --cc=cw@f00f.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=ooyama@tritech.co.jp \
    --cc=viro@parcelfarce.linux.theplanet.co.uk \
    /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