2005-05-27 18:19:08

by cranium2003

[permalink] [raw]
Subject: kernel memory usage any restrictions?

hello,
Is there any restricition on using
kernel's memory? also if i require to use some kernel
memory say 625kB by allocating that in GFP_ATOMIC mode
flag, what will be the side effects on kernel memory
if i use that 625kB memory available from kernel
memory for my kernel source code additions to kernel?
I require answer with respect to 2.4 and 2.6 kernel.
regards,
cranium.

__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com


2005-05-27 18:46:51

by Chris Friesen

[permalink] [raw]
Subject: Re: kernel memory usage any restrictions?

cranium2003 wrote:
> hello,
> Is there any restricition on using
> kernel's memory? also if i require to use some kernel
> memory say 625kB by allocating that in GFP_ATOMIC mode

Your call will almost certainly fail. I think kmalloc will only give
you up to 128KB, and even that might be tricky to do with GFP_ATOMIC.

For larger chunks of memory, you can use vmalloc() or reserve it
statically at compile time.

Chris

2005-05-28 01:56:56

by cranium2003

[permalink] [raw]
Subject: Re: kernel memory usage any restrictions?

hello,
--- Chris Friesen <[email protected]> wrote:
> cranium2003 wrote:
> > hello,
> > Is there any restricition on using
> > kernel's memory? also if i require to use some
> kernel
> > memory say 625kB by allocating that in GFP_ATOMIC
> mode
>
> Your call will almost certainly fail. I think
> kmalloc will only give
> you up to 128KB, and even that might be tricky to do
> with GFP_ATOMIC.
>
NO I mean the source code total require 625kB
not i require a single call of kmalloc with GFP_ATOMIC
but many calls whose total sum will be around 625kB.

> For larger chunks of memory, you can use vmalloc()
> or reserve it
> statically at compile time.
>
> Chris
>

__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com

2005-05-28 02:16:50

by Steven Rostedt

[permalink] [raw]
Subject: Re: kernel memory usage any restrictions?

On Fri, 2005-05-27 at 18:56 -0700, cranium2003 wrote:

> > Your call will almost certainly fail. I think
> > kmalloc will only give
> > you up to 128KB, and even that might be tricky to do
> > with GFP_ATOMIC.
> >
> NO I mean the source code total require 625kB
> not i require a single call of kmalloc with GFP_ATOMIC
> but many calls whose total sum will be around 625kB.

Matters what you system is. I have a gig of RAM and can easily allocate
a meg by 32 32K chunks. I haven't tried it with ATOMIC, but that just
means it will fail if it can't get you something right away and it needs
to sleep. But if you keep trying, that is, don't allocate then
(assuming you're in an interrupt) and try again another time (in another
interrupt), you should eventually get the 625kB. But as this answer is,
you need to supply more context. If you can't fail any of those tries,
then it probably won't work. You're system may be cached out, and would
need to write pages to the disk before it can give you the memory you
need, and then it would have to sleep.

-- Steve