[Subject Prev][Subject Next][Thread Prev][Thread Next][Subject Index][Thread Index]

Re: Some memory reallocation in kernel mode

--- Arun Sharma <arun@xxxxxxxxxxxxxxx> wrote:
> kmalloc is allocation. what i want to know is -
> what realloc does in user space, is there something
> like that in kernel space. or i have to do manually.

I have developed a generic device driver based for
parallel port. As far as I do know that memory
allocation in kernel mode is done only in fix size of
chunks i.e, GFP(get free page) size and it depends on
the architecture of the machine. In order to avoid
memory faults it is always safe to allocate memory use
it via kmalloc and once your job is done simply free
it with kfree instead of reallocation.

   It wd be better if you consult LINUX DEVICE DRIVER
by Alessandro Rubini (O'Reilly).
Chapter 13. Mmap and DMA
>>   Memory Management in Linux

Though source code belongs there to be of age old
kernel version but from conceptual point of view its
great and also you will get a good idea on how to
handle version dependencies.

Cherish n Njoy


Do You Yahoo!?
Yahoo! Shopping - Thousands of Stores. Millions of Products.