lkml.org 
[lkml]   [2005]   [Dec]   [14]   [last100]   RSS Feed
Views: [more markup]  [less markup]  [headers]  [forward] 
 
Messages in this thread
/
DateWed, 14 Dec 2005 09:47:22 +0300
FromVitaly Wool <>
SubjectRe: [spi-devel-general] [patch 2.6.15-rc5-mm2] SPI, priority inversion tweak
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
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-12-14 07:49    [from the cache]
©2003-2009