transfering pages from user space to user space

2012-12-05 Thread Pablo Pessolani


Hi:
I am working on a project to copy (page aligned) the buffer content of one 
process to the buffer of other process.



Now I resolved this issue using copy_page() but, analizing performance with 
different buffer sizes, the "copy_page" becames the critical time component and 
limiting factor.

 

I read some articles about, COW,  zero copy and page flipping and I wrote a 
kernel code to implement page "transfer" (only copy page references), but that 
code fail and hang. The kernel I use is 2.6.32.

 

The pseudocode I think is:


 pte_t *src_pte, *dst_pte;

 src_pte =  getpte(src_task);

 dst_pte =  getpte(dst_task);

 free_pte(dst_pte);/*to free the page referenced by this PTE */

 *dst_pte = *src_pte; /*copy source PTE to destination PTE */

 

And here is code added to the kernel:

-

len = PAGE_SIZE;

src_vma=find_vma_intersection(src_proc->p_task->mm,src_addr,src_addr+len);

dst_vma=find_vma_intersection(dst_proc->p_task->mm,dst_addr,dst_addr+len);

 

src_pgd=pgd_offset(src_proc->p_task->mm, (unsigned long) src_addr);

src_pud=pud_offset(src_pgd,(unsigned long) src_addr);

src_pmd=pmd_offset(src_pud,(unsigned long) src_addr);

src_pte=pte_offset_map_lock(src_proc->p_task->mm, src_pmd,(unsigned long) 
src_addr, &src_ptl);

 

dst_pgd=pgd_offset(dst_proc->p_task->mm, (unsigned long) dst_addr);

dst_pud=pud_offset(dst_pgd,(unsigned long) dst_addr);

dst_pmd=pmd_offset(dst_pud,(unsigned long) dst_addr);

dst_pte=pte_offset_map_lock(dst_proc->p_task->mm, dst_pmd,(unsigned long) 
dst_addr, &dst_ptl);

 

pte_free(dst_proc->p_task->mm, dst_pte);

 

copy_pte_range(dst_proc->p_task->mm, src_proc->p_task->mm, dst_pmd, src_pmd, 

dst_vma, (unsigned long) dst_addr, ((unsigned 
long)dst_addr+PAGE_SIZE));

 

spin_unlock(src_ptl);
spin_unlock(dst_ptl);

-

 

There are a lots of kernel functions that are not well documented or they have 
been changed.

 

Can anybody help me with this issue? Does COW (Copy On Write) will make the 
copy when the processes will modify their buffers?

 

I am not suscribed to the mailing list, please CC: the answers to this email 
account.

Thanks in Advance.

I apologize for my basic English.

 

Pablo Pessolani

PD: once finishing with that code, some issues about page protection will be 
considered.

 

 

 


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


Re:

2012-12-05 Thread Anuz Pratap Singh Tomar
On Wed, Dec 5, 2012 at 1:48 PM, Niroj Pokhrel wrote:

> Hi,
> I'm trying to work on android audio (pcm_native.c) but got stuck in some
> parameters like start threshold, stop threshold, silence zone, silence
> threshold. Can anybody please elaborate on what they are each used for ??
>
> Please always use a subject line. This question probably belongs to
android mailing list or linux-sound mailing list.
There is some info in the header about silence_threshold:
http://lxr.free-electrons.com/source/include/sound/pcm.h#L306

-- 
Thank you
Warm Regards
Anuz
___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


[no subject]

2012-12-05 Thread Niroj Pokhrel
Hi,
I'm trying to work on android audio (pcm_native.c) but got stuck in some
parameters like start threshold, stop threshold, silence zone, silence
threshold. Can anybody please elaborate on what they are each used for ??

-- 
Niroj Pokhrel
Software Engineer,
Samsung India Software Operations
___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: Max open file limit

2012-12-05 Thread Denis Kirjanov
Look at the include/asm-generic/resource.h

On 12/5/12, Denis Kirjanov  wrote:
> #define INR_OPEN_CUR 1024   /* Initial setting for nfile rlimits */
>
>
> On 12/5/12, Vijay Chauhan  wrote:
>> Hello,
>>
>> How many files a process can open at a time? Is it configurable?
>>
>> I found following in the kernel code:
>>
>> ..
>>   .max_fds= NR_OPEN_DEFAULT,
>> ..
>> ..
>> #define NR_OPEN_DEFAULT BITS_PER_LONG
>> ..
>> ..
>> #ifdef __KERNEL__
>> #define BITS_PER_LONG 32
>> ..
>>
>> But I can open more than 32 files in my user space program.
>>
>> Thank you,
>> Vijay
>>
>> ___
>> Kernelnewbies mailing list
>> Kernelnewbies@kernelnewbies.org
>> http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
>>
>
>
> --
> Regards,
> Denis
>


-- 
Regards,
Denis

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


Re: Max open file limit

2012-12-05 Thread Denis Kirjanov
#define INR_OPEN_CUR 1024   /* Initial setting for nfile rlimits */


On 12/5/12, Vijay Chauhan  wrote:
> Hello,
>
> How many files a process can open at a time? Is it configurable?
>
> I found following in the kernel code:
>
> ..
>   .max_fds= NR_OPEN_DEFAULT,
> ..
> ..
> #define NR_OPEN_DEFAULT BITS_PER_LONG
> ..
> ..
> #ifdef __KERNEL__
> #define BITS_PER_LONG 32
> ..
>
> But I can open more than 32 files in my user space program.
>
> Thank you,
> Vijay
>
> ___
> Kernelnewbies mailing list
> Kernelnewbies@kernelnewbies.org
> http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
>


-- 
Regards,
Denis

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


Re: Max open file limit

2012-12-05 Thread Rajat Sharma
Well this is not really a limit on number of files, rather a memory
allocation optimization for fd_array. The limit you are looking for is:

int sysctl_nr_open __read_mostly = 1024*1024;

$ cat /proc/sys/fs/nr_open
1048576

-Rajat


On Wed, Dec 5, 2012 at 4:38 PM, Vijay Chauhan wrote:

> Hello,
>
> How many files a process can open at a time? Is it configurable?
>
> I found following in the kernel code:
>
> ..
>   .max_fds= NR_OPEN_DEFAULT,
> ..
> ..
> #define NR_OPEN_DEFAULT BITS_PER_LONG
> ..
> ..
> #ifdef __KERNEL__
> #define BITS_PER_LONG 32
> ..
>
> But I can open more than 32 files in my user space program.
>
> Thank you,
> Vijay
>
> ___
> 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


Max open file limit

2012-12-05 Thread Vijay Chauhan
Hello,

How many files a process can open at a time? Is it configurable?

I found following in the kernel code:

..
  .max_fds= NR_OPEN_DEFAULT,
..
..
#define NR_OPEN_DEFAULT BITS_PER_LONG
..
..
#ifdef __KERNEL__
#define BITS_PER_LONG 32
..

But I can open more than 32 files in my user space program.

Thank you,
Vijay

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