Re: Module vs Kernel main performacne

2012-05-30 Thread Mulyadi Santosa
Hi...

On Thu, May 31, 2012 at 4:44 AM, Abu Rasheda  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 cop_from_user is more efficient when copy data is small,
> why it is so ?

you meant, the bigger the buffer, the fewer the instructions, right?

Not sure why, but I am sure it will reach some peak point.

Anyway, you did kmalloc and then kfree()? I think that's why...bigger
buffer will grab large chunk from slab...and again likely it's
physically contigous. Also, it will be placed in the same cache line.

Whereas the smaller onewill hit allocate/free cycle more...thus
flushing the L1/L2 cache even more.

CMIIW people...

-- 
regards,

Mulyadi Santosa
Freelance Linux trainer and consultant

blog: the-hydra.blogspot.com
training: mulyaditraining.blogspot.com

___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: TWD, MCT, MSM timer

2012-05-30 Thread naveen yadav
Hi Sarbojit,

You know the answer and use case for these three different timers. ?
A person will only ask if he could not find answer from google.




On Tue, May 29, 2012 at 7:33 PM, Sarbojit Ganguly
 wrote:
> Try pasting the specific parts of the code you are having trouble
> understanding. One cannot be spoon-fed.
>
> On 29 May 2012 18:53, naveen yadav  wrote:
>> Dear All,
>>
>> I want to know details about TWD, MCT, MSM timer.
>>
>> can any body let me know.
>>
>> Thanks
>>
>> ___
>> Kernelnewbies mailing list
>> Kernelnewbies@kernelnewbies.org
>> http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: task struct and the #! operator

2012-05-30 Thread Vladimir Murzin
Hi,

Have a look at binfmt_script.c [1] $)

[1] http://lxr.free-electrons.com/source/fs/binfmt_script.c

Best wishes
Vladimir Murzin

On 5/31/12, Ranjan Sinha  wrote:
> Hi,
>
> I am trying to understand process creation and associated
> bookkeeping.I am currently trying to understand how interpreted
> scripts (the shebang operator) are executed.
>
> It was surprising to see that the comm member of task_struct (accessed
> through get_task_comm) is actually set to the name of the script
> though /proc/pid/exe correctly points to the invoked interpreter. Does
> anybody know where the necessary magic happen and is it possible to
> get the name of invoked interpreter through any means inside the
> kernel?
>
> Thanks in advance,
> Ranjan
>
> ___
> Kernelnewbies mailing list
> Kernelnewbies@kernelnewbies.org
> http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
>

___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: Module vs Kernel main performacne

2012-05-30 Thread Abu Rasheda
On Wed, May 30, 2012 at 2:44 PM, Abu Rasheda  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 copy_from_user, kfree and return. Test program
> send 120 gigabyte data to module.
>
> If I pass 1k buffer per call, I get
>
> 115,396,349,819 instructions              #    0.90  insns per cycle
>      [95.00%]
>
> 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 cop_from_user is more efficient when copy data is small,
> why it is so ?

Did another experiment:

User program sending 43k and allocating 43k after entering ioctl and
copy_from_user smaller portion in each call to copy_from_user:
--
copy_from_user  0.25k at a time 0.56  insns per cycle
copy_from_user  0.50k at a time 0.42  insns per cycle
copy_from_user  1.00k at a time 0.36  insns per cycle
copy_from_user  2.00k at a time 0.29  insns per cycle
copy_from_user  3.00k at a time 0.26  insns per cycle
copy_from_user  4.00k at a time 0.23  insns per cycle
copy_from_user  8.00k at a time 0.21  insns per cycle
copy_from_user 16.00k at a time 0.19  insns per cycle


User program sending 43k, allocating smaller chunk and sending that
chunk to call to copy_from_user:
--
Allocated 0.25k and copy_from_user  0.25k at a time 1.04 insns per cycle
Allocated 0.50k and copy_from_user  0.50k at a time 0.90 insns per cycle
Allocated 1.00k and copy_from_user  1.00k at a time 0.79 insns per cycle
Allocated 2.00k and copy_from_user  2.00k at a time 0.67 insns per cycle
Allocated 4.00k and copy_from_user  4.00k at a time 0.53 insns per cycle
Allocated 8.00k and copy_from_user  8.00k at a time 0.42 insns per cycle
Allocated 16.00k and copy_from_user 16.00k at a time 0.33 insns per cycle
Allocated 32.00k and copy_from_user 32.00k at a time 0.22 insns per cycle

___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


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 I pass 1k buffer per call, I get

115,396,349,819 instructions  #0.90  insns per cycle
  [95.00%]

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 cop_from_user is more efficient when copy data is small,
why it is so ?

___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


task struct and the #! operator

2012-05-30 Thread Ranjan Sinha
Hi,

I am trying to understand process creation and associated
bookkeeping.I am currently trying to understand how interpreted
scripts (the shebang operator) are executed.

It was surprising to see that the comm member of task_struct (accessed
through get_task_comm) is actually set to the name of the script
though /proc/pid/exe correctly points to the invoked interpreter. Does
anybody know where the necessary magic happen and is it possible to
get the name of invoked interpreter through any means inside the
kernel?

Thanks in advance,
Ranjan

___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


RE: [RFC]confusions about 'struct' define

2012-05-30 Thread Rajat Sharma
This might be the case of cyclic dependency where header files defining
these structures are also including this .h file.

-Rajat
From: harryxiyou
Sent: 30-05-2012 23:08
To: Gaurav Jain
Cc: Greg-Kroah-Hartman; Harry Wei; kernelnewbies@kernelnewbies.org
Subject: Re: [RFC]confusions about 'struct' define
On Thu, May 31, 2012 at 1:20 AM, Gaurav Jain  wrote:
Hi Gaurav,

> Those are forward declarations as they are being used in defining struct
> bus_attribute. It's nothing special about GNU-C. That's the case for ANSI-C
> too. Pretty standard.
>

Hmmm.., that is to say, they may be used before definitions in this file or
defined in other files like 'struct iommu_ops;' field (Actually, i can
not find this field's
definition in this file). However, if it has been defined in other
header files, we need
not declare here, right?



-- 
Thanks
Harry Wei

___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: [RFC]confusions about 'struct' define

2012-05-30 Thread harryxiyou
On Thu, May 31, 2012 at 1:20 AM, Gaurav Jain  wrote:
Hi Gaurav,

> Those are forward declarations as they are being used in defining struct
> bus_attribute. It's nothing special about GNU-C. That's the case for ANSI-C
> too. Pretty standard.
>

Hmmm.., that is to say, they may be used before definitions in this file or
defined in other files like 'struct iommu_ops;' field (Actually, i can
not find this field's
definition in this file). However, if it has been defined in other
header files, we need
not declare here, right?



-- 
Thanks
Harry Wei

___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: [RFC]confusions about 'struct' define

2012-05-30 Thread Gaurav Jain
Those are forward declarations as they are being used in defining struct
bus_attribute. It's nothing special about GNU-C. That's the case for ANSI-C
too. Pretty standard.

On Wed, May 30, 2012 at 10:20 PM, harryxiyou  wrote:

> Hi guys,
>
> When I read the linux/device.h file for some device driver usage, i find
> some
> confusions like following.
>
> $ head -60 device.h
> [...]
>
> struct device;
> struct device_private;
> struct device_driver;
> struct driver_private;
> struct module;
> struct class;
> struct subsys_private;
> struct bus_type;
> struct device_node;
> struct iommu_ops;
>
> struct bus_attribute {
>struct attributeattr;
>ssize_t (*show)(struct bus_type *bus, char *buf);
>ssize_t (*store)(struct bus_type *bus, const char *buf, size_t
> count);
> };
> [...]
>
> I have never seen struct define like
>
> "struct device;
> struct device_private;
> struct device_driver;
> [...]
> struct device_node;
> struct iommu_ops;"
>
> The common define is like this
>
> "struct a{
>   int a;
>   int b;
> [...]
> }"
>
> Is this just struct declaration or some extension about gcc? Cloud
> anyone give me
> some explanations?
> Thanks in advance ;-)
>
> Note: my kernel version is 3.0 around.
>
> --
> Thanks
> Harry Wei
>
> ___
> Kernelnewbies mailing list
> Kernelnewbies@kernelnewbies.org
> http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
>



-- 
Gaurav Jain
Associate Software Engineer
VxVM Escalations Team, SAMG
Symantec Software India Pvt. Ltd.
___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


[RFC]confusions about 'struct' define

2012-05-30 Thread harryxiyou
Hi guys,

When I read the linux/device.h file for some device driver usage, i find some
confusions like following.

$ head -60 device.h
[...]

struct device;
struct device_private;
struct device_driver;
struct driver_private;
struct module;
struct class;
struct subsys_private;
struct bus_type;
struct device_node;
struct iommu_ops;

struct bus_attribute {
struct attributeattr;
ssize_t (*show)(struct bus_type *bus, char *buf);
ssize_t (*store)(struct bus_type *bus, const char *buf, size_t count);
};
[...]

I have never seen struct define like

"struct device;
struct device_private;
struct device_driver;
[...]
struct device_node;
struct iommu_ops;"

The common define is like this

"struct a{
   int a;
   int b;
[...]
}"

Is this just struct declaration or some extension about gcc? Cloud
anyone give me
some explanations?
Thanks in advance ;-)

Note: my kernel version is 3.0 around.

-- 
Thanks
Harry Wei

___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: Module vs Kernel main performacne

2012-05-30 Thread Mulyadi Santosa
Hi...

On Wed, May 30, 2012 at 11:51 AM, Abu Rasheda  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 for data copy ?

see my previous reply :)

>
> Point # 2. Some one was saying that on atleast MIPS it takes more
> cycle to call kernel main function from module because of log jump.
> Does it apply to x86_64 to ?

IIRC long jump means jumping more than 64 KB...but that's in real mode
in 32 bit...so I am not sure whether it still applies in protected
mode.

> To teat above two should I make my module part of static kernel ?

good ideai think you can try that... :)

-- 
regards,

Mulyadi Santosa
Freelance Linux trainer and consultant

blog: the-hydra.blogspot.com
training: mulyaditraining.blogspot.com

___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies