[PATCH] 2/3: implement DMX_SET_BUFFER_SIZE for dvr

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



linux-dvb-request@xxxxxxxxxxx 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@xxxxxxxxxxx
http://www.linuxtv.org/cgi-bin/mailman/listinfo/linux-dvb

[Index of Archives]     [Linux Media]     [Video 4 Linux]     [Asterisk]     [Samba]     [Xorg]     [Xfree86]     [Linux USB]

  Powered by Linux