* number of elements or bytes for kfifo_in etc @ 2010-08-18 5:29 Huang Ying 2010-08-18 16:35 ` Stefani Seibold 0 siblings, 1 reply; 5+ messages in thread From: Huang Ying @ 2010-08-18 5:29 UTC (permalink / raw) To: Stefani Seibold; +Cc: Andrew Morton, linux-kernel Hi, Stefani, In new kfifo implementation in 2.6.36-rc1, description of the third parameter is: "@n: number of elements to be added" But if my understanding is correct, the actual implementation is: "@n: number of bytes to be added" That is sizeof(*fifo->type) is not considered. I think we should change either the implementation or the description. Best Regards, Huang Ying ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: number of elements or bytes for kfifo_in etc 2010-08-18 5:29 number of elements or bytes for kfifo_in etc Huang Ying @ 2010-08-18 16:35 ` Stefani Seibold 2010-08-19 0:32 ` Huang Ying 0 siblings, 1 reply; 5+ messages in thread From: Stefani Seibold @ 2010-08-18 16:35 UTC (permalink / raw) To: Huang Ying; +Cc: Andrew Morton, linux-kernel Am Mittwoch, den 18.08.2010, 13:29 +0800 schrieb Huang Ying: > Hi, Stefani, > > In new kfifo implementation in 2.6.36-rc1, description of the third > parameter is: > > "@n: number of elements to be added" > > But if my understanding is correct, the actual implementation is: > > "@n: number of bytes to be added" > Number of bytes is wrong, this is only valid for byte stream fifo's where an element is a byte. Have a look at samples/kfifo/inttype-example.c where an element is a int type. ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: number of elements or bytes for kfifo_in etc 2010-08-18 16:35 ` Stefani Seibold @ 2010-08-19 0:32 ` Huang Ying 2010-08-19 1:15 ` Huang Ying 0 siblings, 1 reply; 5+ messages in thread From: Huang Ying @ 2010-08-19 0:32 UTC (permalink / raw) To: Stefani Seibold; +Cc: Andrew Morton, linux-kernel Hi, Stefani, On Thu, 2010-08-19 at 00:35 +0800, Stefani Seibold wrote: > Am Mittwoch, den 18.08.2010, 13:29 +0800 schrieb Huang Ying: > > Hi, Stefani, > > > > In new kfifo implementation in 2.6.36-rc1, description of the third > > parameter is: > > > > "@n: number of elements to be added" > > > > But if my understanding is correct, the actual implementation is: > > > > "@n: number of bytes to be added" > > > > Number of bytes is wrong, this is only valid for byte stream fifo's > where an element is a byte. > > Have a look at samples/kfifo/inttype-example.c where an element is a int > type. Yes. You are right. I misunderstood your code. Sorry for bothering. Best Regards, Huang Ying ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: number of elements or bytes for kfifo_in etc 2010-08-19 0:32 ` Huang Ying @ 2010-08-19 1:15 ` Huang Ying 2010-08-19 6:52 ` Stefani Seibold 0 siblings, 1 reply; 5+ messages in thread From: Huang Ying @ 2010-08-19 1:15 UTC (permalink / raw) To: Stefani Seibold; +Cc: Andrew Morton, linux-kernel On Thu, 2010-08-19 at 08:32 +0800, Huang Ying wrote: > Hi, Stefani, > > On Thu, 2010-08-19 at 00:35 +0800, Stefani Seibold wrote: > > Am Mittwoch, den 18.08.2010, 13:29 +0800 schrieb Huang Ying: > > > Hi, Stefani, > > > > > > In new kfifo implementation in 2.6.36-rc1, description of the third > > > parameter is: > > > > > > "@n: number of elements to be added" > > > > > > But if my understanding is correct, the actual implementation is: > > > > > > "@n: number of bytes to be added" > > > > > > > Number of bytes is wrong, this is only valid for byte stream fifo's > > where an element is a byte. > > > > Have a look at samples/kfifo/inttype-example.c where an element is a int > > type. > > Yes. You are right. I misunderstood your code. Sorry for bothering. And I found __kfifo->esize is used in __kfifo_in/out etc to convert between elements and bytes. Maybe we can pull the conversion code to corresponding macro, because where esize is constant and may be optimized to bit shifting or nothing. What do you think about that? Best Regards, Huang Ying ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: number of elements or bytes for kfifo_in etc 2010-08-19 1:15 ` Huang Ying @ 2010-08-19 6:52 ` Stefani Seibold 0 siblings, 0 replies; 5+ messages in thread From: Stefani Seibold @ 2010-08-19 6:52 UTC (permalink / raw) To: Huang Ying; +Cc: Andrew Morton, linux-kernel Am Donnerstag, den 19.08.2010, 09:15 +0800 schrieb Huang Ying: > On Thu, 2010-08-19 at 08:32 +0800, Huang Ying wrote: > > Hi, Stefani, > > > > On Thu, 2010-08-19 at 00:35 +0800, Stefani Seibold wrote: > > > Am Mittwoch, den 18.08.2010, 13:29 +0800 schrieb Huang Ying: > > > > Hi, Stefani, > > > > > > > > In new kfifo implementation in 2.6.36-rc1, description of the third > > > > parameter is: > > > > > > > > "@n: number of elements to be added" > > > > > > > > But if my understanding is correct, the actual implementation is: > > > > > > > > "@n: number of bytes to be added" > > > > > > > > > > Number of bytes is wrong, this is only valid for byte stream fifo's > > > where an element is a byte. > > > > > > Have a look at samples/kfifo/inttype-example.c where an element is a int > > > type. > > > > Yes. You are right. I misunderstood your code. Sorry for bothering. > > And I found __kfifo->esize is used in __kfifo_in/out etc to convert > between elements and bytes. Maybe we can pull the conversion code to > corresponding macro, because where esize is constant and may be > optimized to bit shifting or nothing. What do you think about that? > esize isn't constant, especially from the point of view inside __kfifo_in and so on. The is ony good reason not to pass the size of the element using sizeof(*fifo->type) as a parameter, it will generate more code. Storing the size of the element in the kfifo structure is the better decision. But if you found a better way and can prove it under any circumstance with a list of measurement results u will get an ack! - Stefani ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2010-08-19 6:52 UTC | newest] Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2010-08-18 5:29 number of elements or bytes for kfifo_in etc Huang Ying 2010-08-18 16:35 ` Stefani Seibold 2010-08-19 0:32 ` Huang Ying 2010-08-19 1:15 ` Huang Ying 2010-08-19 6:52 ` Stefani Seibold
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox
Powered by JetHome