Linux - KernelThis forum is for all discussion relating to the Linux kernel.
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Introduction to Linux - A Hands on Guide
This guide was created as an overview of the Linux Operating System, geared toward new users as an exploration tour and getting started guide, with exercises at the end of each chapter.
For more advanced trainees it can be a desktop reference, and a collection of the base knowledge needed to proceed with system and network administration. This book contains many real life examples derived from the author's experience as a Linux system and network administrator, trainer and consultant. They hope these examples will help you to get a better understanding of the Linux system and that you feel encouraged to try out things on your own.
Click Here to receive this Complete Guide absolutely free.
I'm writting a kernel module that manages memory pages for user space (stack allocations for micro thread).
It seems that I have a bug during the release of a physical page.
The unitest I'm doing is to write for each page at the allocaed memory (allocated with vmalloc), causing initially to page fault, and then call the kernel module to release each page frame. After the release, a write would cause a page fault. Repeating this procedure causes something very cool - when I look at "top" I see that the physical memory keeps increasing (similar to a memory leak) but the virtual memory remains the same. The increase is steady and even passes my actual memory size (got 88 giga for 8 giga memory!!!!!). Nevertheless the application is not crashing, nor use swapping area. This makes me think that this is a counters problem.
So, it seems like that each page fault increases some counters, but my hand made release fails to do that. Actually I only use "pte_clear()" for each page I want to release.
Using "__page_free()" does not solve the problem, and "page_free()" causes a kernel panic.
Does anyone have any idea for a direction I could investigate?
Maybe someone knows some similar driver I could referenc?
Looks like I found the problem.
Apperantly, in a page fault the kernel preforms "inc_mm_counter()".
Because I relaesed the page table entry by myself, this counter keeped increasing for each page fault.
Adding dec_mm_counter() after the pte_clear() seems to solve the issue.