From: Andrea <mariofutire@googlemail.com>
To: linux-dvb@linuxtv.org, o.endriss@gmx.de
Subject: [linux-dvb] [PATCH] 2/3: implement DMX_SET_BUFFER_SIZE for dvr
Date: Mon, 24 Mar 2008 20:49:11 +0000 [thread overview]
Message-ID: <47E813C7.6070208@googlemail.com> (raw)
In-Reply-To: <mailman.1.1206183601.26852.linux-dvb@linuxtv.org>
linux-dvb-request@linuxtv.org wrote:
> What about this fragment:
> ...
> if (!size)
> return -EINVAL;
>
> mem = vmalloc(size);
> if (!mem)
> return -ENOMEM;
>
> mem2 = buf->data;
>
> spin_lock_irqsave(&dmxdev->lock);
> buf->pread = buf->pwrite = 0;
> buf->data = mem;
> buf->size = size;
> spin_unlock_irqrestore(&dmxdev->lock);
>
> vfree(mem2);
> return 0;
Maybe I can think of one reason while the current code is not implemented this way:
In your version the new buffer is allocated before the old one is released.
In the current implementation the old buffer is released and afterwards the new one allocated.
One could argue that the new implementation has a maximum memory requirement higher than the old one.
It's not much but I am not too familiar with kernel development, so I don't know how important that
could be.
What do you think?
About the spin_lock_irqsave: currently it is not used anywhere in the code for the demux in dmxdev.c.
I am always a bit scared when I introduce something new, maybe I am missing the current logic.
Cheers
Andrea
_______________________________________________
linux-dvb mailing list
linux-dvb@linuxtv.org
http://www.linuxtv.org/cgi-bin/mailman/listinfo/linux-dvb
next prev parent reply other threads:[~2008-03-24 20:49 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <mailman.1.1206183601.26852.linux-dvb@linuxtv.org>
2008-03-22 11:32 ` [linux-dvb] [PATCH] 1/3: BUG FIX in dvb_ringbuffer_flush Andrea
2008-04-13 9:30 ` Andrea
2008-04-13 9:49 ` Andrea
2008-04-14 19:51 ` Andrea
2008-04-22 18:54 ` Oliver Endriss
2008-03-22 11:32 ` [linux-dvb] [PATCH] 2/3: implement DMX_SET_BUFFER_SIZE for dvr Andrea
2008-03-24 20:49 ` Andrea [this message]
2008-04-12 0:35 ` Oliver Endriss
2008-04-13 9:30 ` Andrea
2008-04-13 9:50 ` Andrea
2008-04-13 23:50 ` Oliver Endriss
2008-04-14 19:51 ` Andrea
2008-04-22 18:54 ` Oliver Endriss
2008-03-22 0:22 Andrea
2008-03-22 4:45 ` Oliver Endriss
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=47E813C7.6070208@googlemail.com \
--to=mariofutire@googlemail.com \
--cc=linux-dvb@linuxtv.org \
--cc=o.endriss@gmx.de \
/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