Re: Module vs Kernel main performacne

2012-06-08 Thread Abu Rasheda
I modified my module (m.c). Still sending buffer from user space using ioctl, but instead of copying data from buffer provided by user, I have allocated (kmalloc) a buffer and I copy from this buffer to another kernel buffer which is allocated each time this module ioclt is invoked.

Re: Module vs Kernel main performacne

2012-06-07 Thread Peter Senna Tschudin
Hello Abu, I had to include linux/module.h or an error was issued about THIS_MODULE. What Kernel version are you using? I'm trying to compile it and I'm getting the error: [peter@ace m]$ make make -C /lib/modules/3.3.7-1.fc17.x86_64/build SUBDIRS=`pwd` modules make[1]: Entering directory

Re: Module vs Kernel main performacne

2012-06-07 Thread Abu Rasheda
Hello Abu, I had to include linux/module.h or an error was issued about THIS_MODULE. I am running this tool on Scientific Linux 6.0, which is 2.6.32 kernel. I know this is old but this is what I have for my product. What Kernel version are you using? I'm trying to compile it and I'm

Re: Module vs Kernel main performacne

2012-06-07 Thread Peter Senna Tschudin
Hi again! On Tue, May 29, 2012 at 8:50 PM, Abu Rasheda rcpilot2...@gmail.com wrote: Hi, I am working on x8_64 arch. Profiled (oprofile) Linux kernel module and notice that whole lot of cycles are spent in copy_from_user call. I compared same flow from kernel proper and noticed that for more

Re: Module vs Kernel main performacne

2012-06-07 Thread Abu Rasheda
peter.se...@gmail.com wrote: Hi again! Hi How did you call from Kernel module? In original code, copied data is dmaed and in experimental code data is dropped. ___ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org

Re: Module vs Kernel main performacne

2012-06-01 Thread Abu Rasheda
If the buffer at user side is more then a page, then it may be that complete user space buffer is not available in memory and kernel spend time in processing page fault I have attached code for module and user program. If anyone is bored over the weekend they are welcome to try and explain

Re: Module vs Kernel main performacne

2012-05-31 Thread Abu Rasheda
On Wed, May 30, 2012 at 10:35 PM, Mulyadi Santosa mulyadi.sant...@gmail.com wrote: Hi... On Thu, May 31, 2012 at 4:44 AM, Abu Rasheda rcpilot2...@gmail.com wrote: as I increase size of buffer, insns per cycle keep decreasing. Here is the data:    1k 0.90  insns per cycle    8k 0.43  insns

Re: Module vs Kernel main performacne

2012-05-31 Thread Chetan Nanda
On May 31, 2012 9:37 PM, Abu Rasheda rcpilot2...@gmail.com wrote: On Wed, May 30, 2012 at 10:35 PM, Mulyadi Santosa mulyadi.sant...@gmail.com wrote: Hi... On Thu, May 31, 2012 at 4:44 AM, Abu Rasheda rcpilot2...@gmail.com wrote: as I increase size of buffer, insns per cycle keep

Re: Module vs Kernel main performacne

2012-05-30 Thread Mulyadi Santosa
Hi... On Wed, May 30, 2012 at 11:51 AM, Abu Rasheda rcpilot2...@gmail.com wrote: When you say, LKM area is prepared with vmalloc is it for code / executable you refering too ? Yes, AFAIK memory area code and static data in linux kernel module is allocated via vmalloc(). if so will it matter

Re: Module vs Kernel main performacne

2012-05-30 Thread Abu Rasheda
I did another experiment. Wrote a stand alone module and user program which does ioctl and pass buffer to kernel module. User program passes a buffer through ioctl and kernel module does kmalloc on it and calls copy_from_user, kfree and return. Test program send 120 gigabyte data to module. If

Re: Module vs Kernel main performacne

2012-05-30 Thread Abu Rasheda
On Wed, May 30, 2012 at 2:44 PM, Abu Rasheda rcpilot2...@gmail.com wrote: I did another experiment. Wrote a stand alone module and user program which does ioctl and pass buffer to kernel module. User program passes a buffer through ioctl and kernel module does kmalloc on it and calls

Re: Module vs Kernel main performacne

2012-05-30 Thread Mulyadi Santosa
Hi... On Thu, May 31, 2012 at 4:44 AM, Abu Rasheda rcpilot2...@gmail.com wrote: as I increase size of buffer, insns per cycle keep decreasing. Here is the data:    1k 0.90  insns per cycle    8k 0.43  insns per cycle  43k 0.18  insns per cycle 100k 0.08  insns per cycle Showing that

Module vs Kernel main performacne

2012-05-29 Thread Abu Rasheda
Hi, I am working on x8_64 arch. Profiled (oprofile) Linux kernel module and notice that whole lot of cycles are spent in copy_from_user call. I compared same flow from kernel proper and noticed that for more data through put cycles spent in copy_from_user are much less. Kernel proper has 1/8

Re: Module vs Kernel main performacne

2012-05-29 Thread Mulyadi Santosa
Hi... On Wed, May 30, 2012 at 6:50 AM, Abu Rasheda rcpilot2...@gmail.com wrote: So obviously, CPU is stalling when it is copying data and there are more cache misses. My question is, is there a difference calling copy_from_user from kernel proper compared to calling from LKM ? Theoritically,

Re: Module vs Kernel main performacne

2012-05-29 Thread Abu Rasheda
What I meant here is, there must be difference speed when you copy onto something contigous vs non contigous. IIRC at least it will waste some portion of L1/L2 cache. When you say, LKM area is prepared with vmalloc is it for code / executable you refering too ? if so will it matter for data