mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* Memory allocation question
@ 2001-11-19 19:23 george anzinger
  2001-11-19 19:50 ` Alan Cox
  0 siblings, 1 reply; 6+ messages in thread
From: george anzinger @ 2001-11-19 19:23 UTC (permalink / raw)
  To: linux-kernel

I need (want) to allocate block of memory for POSIX timers in about page
size chuncks.  Currently I am using kmalloc() to allocate a page at a
time.  I don't want to have to worry about mapping/unmapping etc.  I
just what to go about using the memory.  It will be used for timers so
it must not be paged.  

Is kmalloc() the best interface to use or is there a better one?


-- 
George           george@mvista.com
High-res-timers: http://sourceforge.net/projects/high-res-timers/
Real time sched: http://sourceforge.net/projects/rtsched/

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

* Re: Memory allocation question
  2001-11-19 19:23 Memory allocation question george anzinger
@ 2001-11-19 19:50 ` Alan Cox
  2001-11-21 18:47   ` george anzinger
  0 siblings, 1 reply; 6+ messages in thread
From: Alan Cox @ 2001-11-19 19:50 UTC (permalink / raw)
  To: george anzinger; +Cc: linux-kernel

> size chuncks.  Currently I am using kmalloc() to allocate a page at a
> time.  I don't want to have to worry about mapping/unmapping etc.  I

Use get_free_page() to get page sized chunks

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

* Re: Memory allocation question
  2001-11-19 19:50 ` Alan Cox
@ 2001-11-21 18:47   ` george anzinger
  2001-11-21 18:51     ` Rik van Riel
  0 siblings, 1 reply; 6+ messages in thread
From: george anzinger @ 2001-11-21 18:47 UTC (permalink / raw)
  To: Alan Cox; +Cc: linux-kernel

Alan Cox wrote:
> 
> > size chuncks.  Currently I am using kmalloc() to allocate a page at a
> > time.  I don't want to have to worry about mapping/unmapping etc.  I
> 
> Use get_free_page() to get page sized chunks

What about __get_free_page() ?  I don't need or want the clear page
(performance issues).

And then to return the page, free_page() ?

-- 
George           george@mvista.com
High-res-timers: http://sourceforge.net/projects/high-res-timers/
Real time sched: http://sourceforge.net/projects/rtsched/

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

* Re: Memory allocation question
  2001-11-21 18:47   ` george anzinger
@ 2001-11-21 18:51     ` Rik van Riel
  2001-11-21 20:13       ` george anzinger
  0 siblings, 1 reply; 6+ messages in thread
From: Rik van Riel @ 2001-11-21 18:51 UTC (permalink / raw)
  To: george anzinger; +Cc: Alan Cox, linux-kernel

On Wed, 21 Nov 2001, george anzinger wrote:
> Alan Cox wrote:
> >
> > > size chuncks.  Currently I am using kmalloc() to allocate a page at a
> > > time.  I don't want to have to worry about mapping/unmapping etc.  I
> >
> > Use get_free_page() to get page sized chunks
>
> What about __get_free_page() ?  I don't need or want the clear page
> (performance issues).

get_free_page() doesn't clear the page afaics.

regards,

Rik
-- 
DMCA, SSSCA, W3C?  Who cares?  http://thefreeworld.net/

http://www.surriel.com/		http://distro.conectiva.com/


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

* Re: Memory allocation question
  2001-11-21 18:51     ` Rik van Riel
@ 2001-11-21 20:13       ` george anzinger
  2001-11-21 20:25         ` Rik van Riel
  0 siblings, 1 reply; 6+ messages in thread
From: george anzinger @ 2001-11-21 20:13 UTC (permalink / raw)
  To: Rik van Riel; +Cc: Alan Cox, linux-kernel

Rik van Riel wrote:
> 
> On Wed, 21 Nov 2001, george anzinger wrote:
> > Alan Cox wrote:
> > >
> > > > size chuncks.  Currently I am using kmalloc() to allocate a page at a
> > > > time.  I don't want to have to worry about mapping/unmapping etc.  I
> > >
> > > Use get_free_page() to get page sized chunks
> >
> > What about __get_free_page() ?  I don't need or want the clear page
> > (performance issues).
> 
> get_free_page() doesn't clear the page afaics.
> 
In mm.h (2.4.13 kernel)....

#define __get_free_page(gfp_mask) \
		__get_free_pages((gfp_mask),0)

#define __get_dma_pages(gfp_mask, order) \
		__get_free_pages((gfp_mask) | GFP_DMA,(order))

/*
 * The old interface name will be removed in 2.5:
 */
#define get_free_page get_zeroed_page
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Where as __get_free_page() does not zero.  I know this is an old kernel,
but...


What am I missing?
-- 
George           george@mvista.com
High-res-timers: http://sourceforge.net/projects/high-res-timers/
Real time sched: http://sourceforge.net/projects/rtsched/

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

* Re: Memory allocation question
  2001-11-21 20:13       ` george anzinger
@ 2001-11-21 20:25         ` Rik van Riel
  0 siblings, 0 replies; 6+ messages in thread
From: Rik van Riel @ 2001-11-21 20:25 UTC (permalink / raw)
  To: george anzinger; +Cc: Alan Cox, linux-kernel

On Wed, 21 Nov 2001, george anzinger wrote:

> /*
>  * The old interface name will be removed in 2.5:
>  */
> #define get_free_page get_zeroed_page
> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>
> Where as __get_free_page() does not zero.  I know this is an old
> kernel, but...

Urghhh, you're right.

Rik
-- 
DMCA, SSSCA, W3C?  Who cares?  http://thefreeworld.net/

http://www.surriel.com/		http://distro.conectiva.com/


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

end of thread, other threads:[~2001-11-21 20:26 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-11-19 19:23 Memory allocation question george anzinger
2001-11-19 19:50 ` Alan Cox
2001-11-21 18:47   ` george anzinger
2001-11-21 18:51     ` Rik van Riel
2001-11-21 20:13       ` george anzinger
2001-11-21 20:25         ` Rik van Riel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®