linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* RE: vmalloc and kiobuf questions ?
@ 2001-07-19  3:49 Nitin Dhingra
  0 siblings, 0 replies; 4+ messages in thread
From: Nitin Dhingra @ 2001-07-19  3:49 UTC (permalink / raw)
  To: 'Rajeev Bector', linux-kernel

1) Yeah, vmalloc can allocate memory till the
last available ram present in your machine.

2 & 3) You can use kiobuf for locking user memory
area. They are a part of kernel 2.4.x and also if 
you have previous 2.2.x find a patch. If you have
kernel 2.4.4 +, there is a file in source 
arch/cris/drivers/examples/kiobuftest.c that is doing 
exactly what you want. You can check it out. If you 
don't have it, I also made a module for locking user 
buffers using kiobuf, if you want I can mail you the src.


Regards,
Nitin


-----Original Message-----
From: Rajeev Bector [mailto:rajeev_bector@yahoo.com]
Sent: Wednesday, July 18, 2001 11:16 PM
To: linux-kernel@vger.kernel.org
Subject: vmalloc and kiobuf questions ?


MM Gurus, 
  In trying to understand how to map driver
memory into user space memory, I have the following
questions:

1) Is there a limit to how much memory
   I can allocate using vmalloc() ?
   (This is regular RAM)
2) I want to map the vmalloc'ed memory
   to user space via mmap(). I've read
   that remap_page_range() will not do it
   and I have to do it using nopage
   handlers ? Is that true ? Is there
   a simple answer to why is that the case ?

3) I've also read the kiobufs will simplify
   all this. Is there a documentation on 
   kiobufs - what they can and cannot do ?
   Are kiobufs part of the standard kernel
   now ?
Thanks in advance for your answers !

Rajeev


__________________________________________________
Do You Yahoo!?
Get personalized email addresses from Yahoo! Mail
http://personal.mail.yahoo.com/
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: vmalloc and kiobuf questions ?
@ 2001-07-18 18:49 Ramil.Santamaria
  0 siblings, 0 replies; 4+ messages in thread
From: Ramil.Santamaria @ 2001-07-18 18:49 UTC (permalink / raw)
  To: rajeev_bector; +Cc: linux-kernel


It's also a good idea to mem_map_reserve( ) pages that will be remapped to
user space.

Ramil J.Santamaria
Toshiba America Information Systems
ramil.santamaria@tais.toshiba.com


                                                                                                                              
                    Rajeev Bector                                                                                             
                    <rajeev_bector@yahoo.com        To:     linux-kernel@vger.kernel.org                                      
                    >                               cc:                                                                       
                    Sent by:                        Subject:     vmalloc and kiobuf questions ?                               
                    linux-kernel-owner@vger.                                                                                  
                    kernel.org                                                                                                
                                                                                                                              
                                                                                                                              
                    07/18/2001 10:46 AM                                                                                       
                                                                                                                              
                                                                                                                              




MM Gurus,
  In trying to understand how to map driver
memory into user space memory, I have the following
questions:

1) Is there a limit to how much memory
   I can allocate using vmalloc() ?
   (This is regular RAM)
2) I want to map the vmalloc'ed memory
   to user space via mmap(). I've read
   that remap_page_range() will not do it
   and I have to do it using nopage
   handlers ? Is that true ? Is there
   a simple answer to why is that the case ?

3) I've also read the kiobufs will simplify
   all this. Is there a documentation on
   kiobufs - what they can and cannot do ?
   Are kiobufs part of the standard kernel
   now ?
Thanks in advance for your answers !

Rajeev


__________________________________________________
Do You Yahoo!?
Get personalized email addresses from Yahoo! Mail
http://personal.mail.yahoo.com/
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/





^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: vmalloc and kiobuf questions ?
  2001-07-18 17:46 Rajeev Bector
@ 2001-07-18 18:34 ` Anton Altaparmakov
  0 siblings, 0 replies; 4+ messages in thread
From: Anton Altaparmakov @ 2001-07-18 18:34 UTC (permalink / raw)
  To: Rajeev Bector; +Cc: linux-kernel

At 18:46 18/07/2001, Rajeev Bector wrote:
>MM Gurus,

I am definitely not an MM guru but I can try and answer one of your 
questions...

>   In trying to understand how to map driver
>memory into user space memory, I have the following
>questions:
>
>1) Is there a limit to how much memory
>    I can allocate using vmalloc() ?
>    (This is regular RAM)

First of all, note that vmalloc() allocates memory in multiples of PAGE_SIZE.

The maximum you can request is given by (num_physpages << PAGE_SHIFT). - 
You need to #include <linux/mm.h>; to get num_physpages.

In fact, before calling vmalloc(), you are well advised to check that you 
are not calling it with a size which rounded up to PAGE_SIZE is beyond 
above stated maximum, otherwise the result is a call to BUG()...

Also, it is a bad idea to call vmalloc() with a zero size as this results 
in a call to BUG(), too.

You can look at linux/mm/vmalloc.c::__vmalloc() for the test it performs 
and to see it calling BUG()...

As an aside, it may be of interest to know that the pages returned by 
vmalloc() can be HIGHMEM ones. If you don't want that you can use vmalloc_32().

I will leave your other questions to the real MM gurus...

Hope this helps,

         Anton

>2) I want to map the vmalloc'ed memory
>    to user space via mmap(). I've read
>    that remap_page_range() will not do it
>    and I have to do it using nopage
>    handlers ? Is that true ? Is there
>    a simple answer to why is that the case ?
>
>3) I've also read the kiobufs will simplify
>    all this. Is there a documentation on
>    kiobufs - what they can and cannot do ?
>    Are kiobufs part of the standard kernel
>    now ?
>Thanks in advance for your answers !
>
>Rajeev
>
>
>__________________________________________________
>Do You Yahoo!?
>Get personalized email addresses from Yahoo! Mail
>http://personal.mail.yahoo.com/
>-
>To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
>the body of a message to majordomo@vger.kernel.org
>More majordomo info at  http://vger.kernel.org/majordomo-info.html
>Please read the FAQ at  http://www.tux.org/lkml/

-- 
   "Nothing succeeds like success." - Alexandre Dumas
-- 
Anton Altaparmakov <aia21 at cam.ac.uk> (replace at with @)
Linux NTFS Maintainer / WWW: http://linux-ntfs.sf.net/
ICQ: 8561279 / WWW: http://www-stu.christs.cam.ac.uk/~aia21/


^ permalink raw reply	[flat|nested] 4+ messages in thread

* vmalloc and kiobuf questions ?
@ 2001-07-18 17:46 Rajeev Bector
  2001-07-18 18:34 ` Anton Altaparmakov
  0 siblings, 1 reply; 4+ messages in thread
From: Rajeev Bector @ 2001-07-18 17:46 UTC (permalink / raw)
  To: linux-kernel

MM Gurus, 
  In trying to understand how to map driver
memory into user space memory, I have the following
questions:

1) Is there a limit to how much memory
   I can allocate using vmalloc() ?
   (This is regular RAM)
2) I want to map the vmalloc'ed memory
   to user space via mmap(). I've read
   that remap_page_range() will not do it
   and I have to do it using nopage
   handlers ? Is that true ? Is there
   a simple answer to why is that the case ?

3) I've also read the kiobufs will simplify
   all this. Is there a documentation on 
   kiobufs - what they can and cannot do ?
   Are kiobufs part of the standard kernel
   now ?
Thanks in advance for your answers !

Rajeev


__________________________________________________
Do You Yahoo!?
Get personalized email addresses from Yahoo! Mail
http://personal.mail.yahoo.com/

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2001-07-19  3:49 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-07-19  3:49 vmalloc and kiobuf questions ? Nitin Dhingra
  -- strict thread matches above, loose matches on Subject: below --
2001-07-18 18:49 Ramil.Santamaria
2001-07-18 17:46 Rajeev Bector
2001-07-18 18:34 ` Anton Altaparmakov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).