All of lore.kernel.org
 help / color / mirror / Atom feed
From: Vitaly Wool <vwool@ru.mvista.com>
To: David Brownell <david-b@pacbell.net>
Cc: Andrew Morton <akpm@osdl.org>,
	linux-kernel@vger.kernel.org,
	spi-devel-general@lists.sourceforge.net
Subject: Re: [spi-devel-general] [patch 2.6.15-rc5-mm2] SPI, priority inversion tweak
Date: Wed, 14 Dec 2005 09:47:22 +0300	[thread overview]
Message-ID: <439FBFFA.2070804@ru.mvista.com> (raw)
In-Reply-To: <200512131028.49291.david-b@pacbell.net>

Hmm...

>-	down(&lock);
>+	/* ... unless someone else is using the pre-allocated buffer */
>+	if (down_trylock(&lock)) {
>+		local_buf = kmalloc(SPI_BUFSIZ, GFP_KERNEL);
>+		if (!local_buf)
>+			return -ENOMEM;
>+	} else
>+		local_buf = buf;
>+
>  
>
Okay, so suppose we have two controller drivers working in two threads 
and calling write_then_read in such a way that the one called later has 
to allocate a new buffer. Suppose also that both controller drivers are 
working in PIO mode. In this situation you have one redundant kmalloc 
and two redundant memcpy's, not speaking about overhead brought up by 
mutexes. Bad!
So I still can't say I'm accepting this approach.

Worth mentioning is that the approach I propose is free from this drawback.

Vitaly

      parent reply	other threads:[~2005-12-14  6:47 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-12-13 18:28 [patch 2.6.15-rc5-mm2] SPI, priority inversion tweak David Brownell
2005-12-13 21:49 ` [spi-devel-general] " Vitaly Wool
2005-12-13 22:21   ` David Brownell
2005-12-14  6:43     ` Vitaly Wool
2005-12-14  6:47 ` Vitaly Wool [this message]

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=439FBFFA.2070804@ru.mvista.com \
    --to=vwool@ru.mvista.com \
    --cc=akpm@osdl.org \
    --cc=david-b@pacbell.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=spi-devel-general@lists.sourceforge.net \
    /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 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.