Re: memory management with mmap

2012-10-31 Thread Chetan Nanda
On Oct 28, 2012 11:49 AM, "Sengottuvelan S" 
wrote:
>
>
> Hi Mulyadi
>
> I am able to do mmap and access virual-memory address and pages for a
single process from user-space and working fine. I am not sure how to do it
for multiple processes for shared resources using mmap.  I better explain
in detail here what I am experimenting it.
>
> for example:
>
> Kernel allocates kmalloc or vmalloc of 100 pages and set those pages
as reserved. Kernel uses these pages to send/receive data to Process A or B
depends on a condition.
>
> Process A and B do mmap those region to get/set data on those
virtual-addresses/pages because I want faster access from userpace to
kernel.
>
> Anyone knows if this will work with mmap?. Please let me know  if
anyother way to do it.
>
Not sure about your actual requiremnent, but there are other better way of
sharing data between processes already exist. E.g. Shared memory.
Advisable to use them instead of writing a new one

> On Sat, Oct 27, 2012 at 10:57 PM, Mulyadi Santosa <
mulyadi.sant...@gmail.com> wrote:
>>
>> Hi...
>>
>> On Thu, Oct 18, 2012 at 3:02 AM, Sengottuvelan S
>>  wrote:
>> > For example,
>> >
>> > I have 2 different user space process A,B etc. I have to allocate
memory in
>> > Kernel for each of those processes (for example 2 pages) .  Each
process is
>> > allowed to use only 1 page using mmap from user space.
>> >
>> > Is it possible to do with mmap?.
>>
>> Not sure, but I guess better to do it directly with page_alloc...or at
>> least kmalloc() to better utilize slab.
>>
>> The thing that I think is hard to do, is to implement protection
>> scheme to make sure say process A won't access page allocated by
>> process B.
>>
>> Hopefully I understand your goal correctly.
>>
>>
>> --
>> regards,
>>
>> Mulyadi Santosa
>> Freelance Linux trainer and consultant
>>
>> blog: the-hydra.blogspot.com
>> training: mulyaditraining.blogspot.com
>
>
>
>
> --
> Regards,
> S. Sengottuvelan.
>
> ___
> 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: memory management with mmap

2012-10-27 Thread Sengottuvelan S
Hi Mulyadi

I am able to do mmap and access virual-memory address and pages for a
single process from user-space and working fine. I am not sure how to do it
for multiple processes for shared resources using mmap.  I better explain
in detail here what I am experimenting it.

for example:

Kernel allocates kmalloc or vmalloc of 100 pages and set those pages
as reserved. Kernel uses these pages to send/receive data to Process A or B
depends on a condition.

Process A and B do mmap those region to get/set data on those
virtual-addresses/pages because I want faster access from userpace to
kernel.

Anyone knows if this will work with mmap?. Please let me know  if anyother
way to do it.

On Sat, Oct 27, 2012 at 10:57 PM, Mulyadi Santosa  wrote:

> Hi...
>
> On Thu, Oct 18, 2012 at 3:02 AM, Sengottuvelan S
>  wrote:
> > For example,
> >
> > I have 2 different user space process A,B etc. I have to allocate memory
> in
> > Kernel for each of those processes (for example 2 pages) .  Each process
> is
> > allowed to use only 1 page using mmap from user space.
> >
> > Is it possible to do with mmap?.
>
> Not sure, but I guess better to do it directly with page_alloc...or at
> least kmalloc() to better utilize slab.
>
> The thing that I think is hard to do, is to implement protection
> scheme to make sure say process A won't access page allocated by
> process B.
>
> Hopefully I understand your goal correctly.
>
>
> --
> regards,
>
> Mulyadi Santosa
> Freelance Linux trainer and consultant
>
> blog: the-hydra.blogspot.com
> training: mulyaditraining.blogspot.com
>



-- 
Regards,
S. Sengottuvelan.
___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: memory management with mmap

2012-10-27 Thread Mulyadi Santosa
Hi...

On Thu, Oct 18, 2012 at 3:02 AM, Sengottuvelan S
 wrote:
> For example,
>
> I have 2 different user space process A,B etc. I have to allocate memory in
> Kernel for each of those processes (for example 2 pages) .  Each process is
> allowed to use only 1 page using mmap from user space.
>
> Is it possible to do with mmap?.

Not sure, but I guess better to do it directly with page_alloc...or at
least kmalloc() to better utilize slab.

The thing that I think is hard to do, is to implement protection
scheme to make sure say process A won't access page allocated by
process B.

Hopefully I understand your goal correctly.


-- 
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